oracle 例項啟動和關閉解讀

studywell發表於2015-03-05

About Instance Startup

When you start the Oracle instance, you typically start it such that the state of the database is OPEN and ready for user connections. However, there are situations in which you may want to start the instance with the database in the MOUNTED state, but not open. An instance can also be started without the database either mounted or open. Thus, there are three stages to starting an instance:

  1. You start the instance using one of the following methods:

    • Using the SQL*Plus STARTUP command. See .

    • On Microsoft Windows, using the Services program in Control Panel to start the Oracle Database services. See .

    The instance reads the initialization parameter file, allocates SGA memory, and starts the background processes.

  2. If you mount the database, then the Oracle instance opens the control file for the database, but does not open the data files. The database is now considered to be in the MOUNT state. This state enables you to perform certain administrative functions that cannot be performed when other users are accessing the database. An example of such a function is enabling or disabling the archiving of online redo log files. See for information about online redo log file archiving.

  3. If you open the database, then, after reading the parameter file and control file, the online redo log files and data files for the database are also opened. The state of the database is now OPEN and user access to the data is available.

The default startup mode for the database (OPEN) completes the three stages in sequence. Unless you explicitly specify otherwise, the instance is started, the database is mounted, and then the database is opened.

About Instance Shutdown

Instance shutdown is the reverse of instance startup. When you shut down the Oracle instance, the default mode is a NORMAL shutdown, which means users are not allowed to create new connections to the database, but the shutdown process waits for all currently connected users to exit their sessions. After all the users have disconnected, then the committed transactions are written to disk, the database files are closed, and the instance is stopped. However, there are situations in which you may not want to wait for users to disconnect on their own (IMMEDIATE mode), or you want to let the current transactions for each user complete before they are disconnected (TRANSACTIONAL mode). In emergency situations you can even shut down the database without waiting for the committed transactions to be written to disk (ABORT mode).

Shutting down an instance goes through the following stages:

  1. After all the users have exited from their sessions, or been disconnected, Oracle Database writes data in the SGA to the data files and online redo log files. A checkpoint is performed on the data files and their headers are marked current as of the time of the instance shutdown. The data files and online redo log files are then closed and the state of the database is changed to CLOSED. The control file remains open to the instance.

  2. The Oracle instance dismounts the database and updates relevant entries in the control file to record a clean shutdown. The control file is closed. The database is now closed and dismounted. The instance is in the NOMOUNT state.

  3. The Oracle instance stops the background processes and deallocates the shared memory used by the SGA.

If a SHUTDOWN ABORT or abnormal termination occurs, then the instance of an open database closes and shuts down the database instantaneously. Oracle Database does not write data in the buffers of the SGA to the data files and redo log files. The subsequent reopening of the database requires instance recovery, which Oracle Database performs automatically.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29519108/viewspace-1449625/,如需轉載,請註明出處,否則將追究法律責任。

相關文章