2014-08-07 Baoxinjian
I. Summary
The complete start-up process for the Oracle database is done in steps, and consists of the following 3 steps:
Launch instance-load database--Open database
Because different stages of the Oracle database startup process can perform different maintenance operations on the database, corresponding to our different requirements, we need different schemas to start the database.
1. Oracle boot requires four states: SHUTDOWN, Nomount, MOUNT, OPEN
2. Four ways that Oracle shuts down: Normal, Immediate, transactional, Abort
3. Start and close process details
Second, the database startup process
1.NoMount mode (boot instance does not load database)
(1). Command: Startup Nomount
(2). Explanation: This startup mode only creates instances, does not load the database, Oracle creates a variety of memory structures and service processes for the instance, and does not open any data files.
In Nomount mode, you can access only those data dictionary views related to the SGA area, including V$parameter, V$SGA, v$process, and V$session, all of which are obtained from the SGA area, regardless of the database.
(3). Mode use:
- Create a new database;
- rebuilding control files;
2.Mount mode (load database without opening database)
(1). Command: Startup Mount
(2). Explanation: This startup mode will load the database for the instance, but keep the database off state. Because the database control file needs to be opened when the database is loaded, neither the data file nor the redo log file can read and write, so the user cannot manipulate the database.
In Mount mode, you can access only those data dictionary views associated with the control file, including V$thread, V$controlfile, V$database, V$datafile, and V$logfile, which are all obtained from the control file.
(3). Mode use:
- renaming data files;
- Add, remove, or rename redo log files;
- Perform a full database restore operation;
- Change the archiving mode of the database;
3.Open mode (Open database normally)
(1). Command: Startup [Open]
(2). Explanation: Normal 3 steps to start a database.
(3). Mode use:
- Usually do not do what the database maintenance, like only do application development, with this model is good;
4. Forced Start mode
(1). Command: Startup force
(2). Usage & Explanation:
- In some cases, you can try to force the startup mode when you cannot successfully start the database by using the preceding various modes.
5. Other
You can also switch between startup modes by using the ALTER DATABASE statement. Also, you can set different states for the database to use for different operations, such as the subject/non-restricted pumping state, read-only.
Third, the database shutdown process
1. Nomal (normal shutdown mode)
(1). Command: Shutdown nomal
(2). Explanation: When the data is closed normally, Oracle performs the following actions:
- Prevents any user from establishing a new connection.
- Waits for all currently connected users to be actively disconnected (this way Oracle does not immediately disconnect the current user, who still operates on the relevant actions)
- Once all users are disconnected, shut down, unload the database, and terminate the instance immediately. (therefore, when you normally close the database in the normal way, you should notify all online users to disconnect as soon as possible)
2. Immediate (immediate closing mode)
(1). Command: Shutdown immediate
(2). Explanation:
- Prevents any user from establishing a new connection and prevents the currently connected user from starting any new transactions.
- Oracle does not wait for the online user to actively disconnect, forcing the user to terminate the current transaction and rollback any uncommitted transactions. (This method can take a long time to terminate and rollback transactions if there are too many uncommitted transactions)
- Directly shuts down, unloads the database, and terminates the instance.
3. Transactional (transaction shutdown mode)
(1). Command: Shutdown transactional
(2). Explanation: This way between the normal shutdown mode and the immediate shutdown mode, the response time will be faster, processing will be more appropriate. The execution process is as follows:
- Prevents any user from establishing a new connection and prevents the currently connected user from starting any new transactions.
- Wait for all uncommitted active transactions to complete, and then immediately disconnect the user.
- Directly shuts down, unloads the database, and terminates the instance.
4. Abort (terminate shutdown mode)
(1). Command: Shutdown abort
(2). Explanation: This is a rough way to close, and when the previous 3 ways cannot be closed, you can try to use the termination method to shut down the database. However, shutting down the database in this way will lose a portion of the data, and when the instance is restarted and the database is opened, the background process Smon performs an instance recovery operation. In general, you should avoid using this method to close the database as much as possible. The execution process is as follows:
- Prevents any user from establishing a new connection and prevents the currently connected user from starting any new transactions.
- Immediately terminates the currently executing SQL statement.
- Any uncommitted transactions are not called back.
- Disconnect all users directly, shut down, unload the database, and terminate the instance.
Four, the case database start the whole process
Step1. SQLPLUS/' as SYSDBA '
Sql*plus:release 10.2.0.1.0-production on Sat 3 22:48:27 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
Step2. Startup Nomount
ORACLE instance started.
-
Total System Global area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 104859892 bytes
Database buffers 58720256 bytes
Redo buffers 2973696 bytes
Oracle@db1:~> Ps-ef | grep Ora_
Oracle 3626 1 0 22:48? 00:00:00 ORA_PMON_ORCL1
Oracle 3628 1 0 22:48? 00:00:00 ORA_PSP0_ORCL1
Oracle 3630 1 0 22:48? 00:00:00 ORA_MMAN_ORCL1
Oracle 3632 1 0 22:48? 00:00:00 ORA_DBW0_ORCL1
Oracle 3634 1 0 22:48? 00:00:00 ORA_LGWR_ORCL1
Oracle 3636 1 0 22:48? 00:00:00 ORA_CKPT_ORCL1
Oracle 3638 1 0 22:48? 00:00:00 ORA_SMON_ORCL1
Oracle 3640 1 0 22:48? 00:00:00 ORA_RECO_ORCL1
Oracle 3642 1 0 22:48? 00:00:00 ORA_CJQ0_ORCL1
Oracle 3644 1 0 22:48? 00:00:00 ORA_MMON_ORCL1
Oracle 3646 1 0 22:48? 00:00:00 ORA_MMNL_ORCL1
Oracle 3648 1 0 22:48? 00:00:00 ORA_D000_ORCL1
Oracle 3650 1 0 22:48? 00:00:00 ORA_S000_ORCL1
Step3. Startup Mount
Oracle instance started.
-
Total System Global area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 104859892 bytes
Database buffers 58720256 bytes
Redo buffers 2973696 bytes
Database mounted.
Step4. Startup
ORACLE instance started.
-
Total System Global area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 104859892 bytes
Database buffers 58720256 bytes
Redo buffers 2973696 bytes
Database mounted.
Database opened.
Abalone New ********************