Oracle442 Application Scenario----------DB instance

Source: Internet
Author: User
Tags sqlplus

Application Scenario 1-7 is the installation process of Oracle, there is not too much to explain, the material on the internet a lot, perhaps in the late to fill in.

Application Scenario 8
To view the location of all data files:
SELECT NAME from V$datafile;
List command:
LIST
Save command:
SAVE D:\ORACLESQL. SQL;

Scenario 9-16 is the uninstallation and configuration process for the database

-----------------a DB instance------------------

Instance (instance): A set of Oracle background processes/threads and a shared memory area that is shared by threads/processes running on the same computer. Volatile, non-persistent content (some of which can be flushed out to disk) can be maintained here. A DB instance can exist even without disk storage. Perhaps the example is not the most useful thing in the world, but you can think of it as the most useful thing, which helps to draw a line between examples and databases.

The following shows the process of starting a XXX instance, hooking up a database, opening a database, shutting down a database, unloading a database, shutting down an instance.

1, in order to perform the above operation, the monitoring of Oracle must be started first, so that we have the opportunity to connect to the Oracle server side. Can be done by the following command: Lsnrctl start;

2, Oracle startup, under Windows usually start Oracle in the service, generally start the relevant instance at the same time, but you can also set the start Oracle, do not start any specified instance, so that Oracle boot speed is quite fast.

3, set the relevant examples we need to start. In the console window, enter set ORACLE_SID=XXX (use Export command in UNIX environment)

4, use/nolog way, enter Sqlplus. In the console window, enter Sqlplus/nolog, and then enter the Sqlplus environment.

5, Input command connect sys as SYSDBA Enter, prompt for password, direct carriage return, the role of SYSDBA to connect to the idle instance of Oracle.

6, the input command startup Nomount Enter, then launched the XXX instance, set by set oracle_sid=xxx.

7, enter the command ALTER DATABASE Mount carriage return, then attach the corresponding databases to the XXX instance.

8, the input command ALTER DATABASE open ENTER, the corresponding database is opened.

9. Enter the command shutdown, close the database, unload the database, and close the instance.


4 State in the Oracle DB instance: on (open), off (close), mounted (mount), and started (Nomount).
------------------------------------------------------------------------------------

Scenario 17: Gracefully shut down a DB instance
To close a DB instance using the Showdown command:
SHUTDOWN Normal (the normal parameter is the default parameter)

Open Sqlplus:
CMD-in command Window input--Sqlplus/nolog
(Open sqlplus but not logged in, database not connected)

Connect to the database in the Admin province:
CONN SYS as SYSDBA; (Will be used in the back, using the SYS user logged in as Administrator)
Through the above administrator status to the shutdown command----------"the use of caution
However, this approach is slower and generally not used in this way.

Scenario 18: Close the DB instance immediately

Showdown IMMEDIATE

Scenario 19: Closing a DB instance in a transactional manner

SHUTDOWN Transactional

Scenario 20: Terminating a DB instance

SHUTDOWN ABORT

Scenario 21: Shutting down a DB instance in Enterprise Manager
To close a DB instance via the PHP graphical interface control terminal

Scenario 22: Start the DB instance, mount and open the DB instance:
Only the system administrator has permission to close the DB instance. The SYS user is therefore required to connect to SQL Plus as a system administrator. ----"Execute the startup command to start the DB instance, mount and open the DB instance.


Scenario 23: Launch an instance with the specified initialization meal data file
Use the Pfile clause in the start command to specify that the startup database is used to initialize the parameter file with the history.
SPFILE = C:\Users\Administrator\Desktop\ software 12-oracle\ source code \4.1.4 Section \initoradb.ora

Use the SYS user to connect to SQL Plus as an administrator sysdba. If the database is in a startup state, you can use the SHUTDOWN immediate mentioned in scenario 18 to close the database, and then execute the following command.
STARTUP PFILE = C:\Users\Administrator\Desktop\ software 12-oracle\ source code \4.1.4 Section \initoradb.ora

Scenario 24: Start the DB instance without loading the database
Startup Nomount----> Start a DB instance to perform operations such as intermediate databases or data files.

Scenario 25: Start a DB instance, mount the database
STARTUP MOUNT-----> does not open a database, you can perform database log archiving, database media recovery, relocation data files, and redo log file operations.

Scenario 26: Forcing the data instance to start
If the current DB instance does not shut down properly and you start another DB instance, you will need to use the option to force the database instance to close.
Log in as the SYS user Administrator. Connect to SQL Plus,
Startup Force---First forcibly closes the current DB instance, and then starts a new DB instance.
This command corresponds to the preceding shutdown Abort command, and then executes startup.

Scenario 27: Starting a DB instance in restricted mode
In the following scenario, you need to start the DB instance in restricted mode.
1, perform the database operation (at this time there should be no other ordinary user access to the database, so as not to cause inconsistent data) 2, using Sql*loader to extract data from the database. 3, need to deny ordinary users access to the database. 4, the database migration or upgrade operation.

Use
STARTUP RESTRICT
Statement to start a DB instance in restricted mode, only a user with restrict session permission can access the database.

Scenario 28: Start Media recovery at database startup
If media recovery is required, use
STARTUP Recober
Automatically executes the recovery program.

Scenario 29: Changing the startup mode with the Alter DATABASE command
1. Switch mount mode: User use
The startup Nomount command launches the DB instance and performs tasks such as rebuilding the database and data files. Once execution is complete, you can mount the DB instance. Execute the following command
ALTER DATABASE MOUNT;
2. Switch to open mode, after performing the above operation, the DB instance is still closed, need to open the DB instance, execute the following command
ALTER DATABASE OPEN;
To prevent user transactions from modifying data in the database, you can open the database in read-only mode.
ALTER DATABASE OPEN READ only; ----> A bit of a problem

Scenario 30: Pausing a database
When a database is paused, it refers to turning the database into a "paused" state. When the database is in that state, only the DBA user (SYS and system) can execute transactions, queries, and PL/SQL statements, and ordinary users will not be able to perform these operations. The pause database can be used
Alter system QUIESCE restricted
Command
Change to normal state can be used
Alter system UNQUIESCE
Command.
To view the active status of the DB instance at this time:
Select Active_state from V$instance

Scenario 31: Suspend (Suspending) database
To prohibit I/O operations on data files and control files, you can use the
Alter system suspend
command to pause the database, in order to continue the normal use of I/O operations, you can use
Alter system resume
Command.

To view the active status of the DB instance at this time:
Select Active_state from V$instance

Oracle442 Application Scenario----------DB instance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.