Oracle Startup and shutdown

Source: Internet
Author: User
Tags naming convention terminates

1 Database Startup 1.1 Required PermissionsSYSDBA or Sysoper system permissions. 1.2 How to start
    • Sql*plus STARTUP Command
    • Oracle Enterprise Manager (Enterprise Manager)
    • SRVCTL Utility
1.3 Starting the processBoot is divided into three main steps: 1) Start the database to Nomount State 2) Start the database to Mount State 3) Start the database to the open state 1.3.1 Boot to NomountThe process of nomount is essentially the process of creating a DB instance. This process in the background is the process of starting the ORACLE executable, on Windows is the execution of the Oracle.exe file to initialize, on the unix/linux is the execution of the $oracle_home/bin/oracle executable file to initialize. Main steps: 1) find the parameter file according to Oracle_sid to the default directory. If a parameter file is specified at startup, the specified parameter file is found. 2) Read the initialization parameters in the parameter file. 3) Allocation of SGA based on initialization parameters. 4) Start the Oracle background process in turn. 5) Open the alarm log and trace file. Use the following command to boot to Nomount:startup Nomount [Pfile=filename]You can view the instance status from the dynamic performance view V$instance:sql> Select status from V$instance; STATUS------------STARTEDDefault directory for parameter files: The Windows default directory is the order of the default directory for $oracle_home/dbs to find the parameter files for the $ORACLE _home\databaseunix/linux: spfile<oracle_sid>. Spfile.ora-----Init<oracle_sid>.ora instance startup minimum parameter requirements: Db_name query background process information:select Addr,pid,spid,username,program from v$process;Alarm Log Location: In Oracle 10g, the Background_dump_dest parameter determines the location of the alarm log, but the file name of the alarm log cannot be modified, the name of the alarm log is: Alert_<sid>.log, where <sid > is the name of the instance. Starting with Oracle 11g, the location of the alert log file has changed. Mainly because of the introduction of ADR (Automatic Diagnostic Repository: A directory for database diagnostic logs, trace files), the location of the directory corresponding to the ADR can be viewed by viewing the V$diag_info system view. The alarm log is stored in the Diag trace directory. 1.3.2 Boot to MountOracle locates the control file based on the value of the Control_files parameter in the parameter file and determines the existence of the data file based on the data file location recorded in the control file. command to boot the database to mount:startup Mount [Pfile=filename]To convert a database from Nomount to mount state:ALTER DATABASE mount;Usually under the Linux/unix platform, in the $oracle_home/dbs directory, there will also be another file, the file naming convention lk<oracle_sid>,lk refers to lock. This file is created at Mount of the database and is used by the operating system to lock the database. The lock is obtained when the database is started and released when the database is closed. Use the following command to view the lock information for the file:$ fuser-u $ORACLE _home/dbs/lkfsdb/u01/app/oracle/product/11.2.0/dbhome_1/dbs/lkfsdb:15228 (Oracle) 15230 (Oracle) 15236 (Oracle) 15240 (Oracle) 15244 (Oracle) 15246 (Oracle) 15248 (Oracle) 15250 ( Oracle) 15252 (Oracle) 15254 (Oracle) 15256 (Oracle) 1.3.3 Boot to openThe control file records the data files in the database, the location of the log files, checkpoint information and other important information, in the open phase of the database, Oracle based on the information recorded in the control file to locate these files, and then perform checkpoints and integrity checks. If there is no problem, you can start the database, and if there are inconsistencies or if the file is missing, you need to recover. Main steps: 1) Open an online data file other than the undo tablespace for the table space. 2) Get an undo table space. 3) Open the online redo log file. Oracle will perform many check checks during the open phase, where the main checksum includes the following two items: 1) The first check of the checkpoint count (Checkpoint CNT) in the data file header is consistent with the checkpoint count (Checkpoint CNT) in the control file. This step checks to confirm that the data file is from the same version rather than recovering from the backup (since checkpoint CNT will not be frozen and will be modified). 2) The second check the beginning of the data file header SCN and the control file is recorded in the end of the SCN is consistent, if the control file is recorded in the end of the SCN is equal to the beginning of the data file header SCN, you do not need to restore that file (if the previous database exception crashes, The end SCN remains at the maximum (infinity), and the database must perform an instance recovery to ensure consistency. 2 Database shutdown

Steps for database shutdown in Oracle 11g: 1) Close the databaseALTER DATABASE close;The close database is only allowed to occur without a connection, or you may encounter a ORA-01093 error. 2) Uninstalling the databaseALTER DATABASE dismount;3) Close the DB instanceshutdown;2.1 Closing Mode

Database Behavior

ABORT

IMMEDIATE

Transactional

NORMAL

Permits new user connections

No

No

No

No

Waits until current Sessions end

No

No

No

Yes

Waits until current transactions end

No

No

Yes

Yes

Performs a checkpoint and closes open files

No

Yes

Yes

Yes

2.1.1 SHUTDOWN NORMAL

The default option for the shutdown command is normal, and Oracle shuts down the database normally when the shutdown command is executed. Shutting down the database in this way does not require any instance recovery at the next boot, but because the normal mode waits for all users to disconnect before shutting down the database, the wait time can be very long, and in a production environment it is rarely used to close a database with a large number of user connections. 2.1.2 SHUTDOWN IMMEDIATESHUTDOWN Immediate mode is the most commonly used way to close a database, when using this command, the transaction that is currently being processed by Oracle is immediately interrupted, uncommitted transactions are rolled back, and the system does not wait for users connected to the database to exit, forcing all connected users to be disconnected. The checkpoint is then executed, all the change data is written back to the data file, and the database is closed. Using this method to shut down the database is a safe way to shut down the database when the next time you start the database without instance recovery. Note, however, that if the database system is busy and there are currently a large number of transactions executing (even if large transactions are being processed), shutting down the database with this option can also take a significant amount of time. 2.1.3 SHUTDOWN TransactionalThe SHUTDOWN transactional option is available only after Oracle 8i, when using this command, the database no longer allows new connections to be made, prevents new transactions from being performed, but allows the currently active transaction to complete. After all active transactions are complete, the database shuts down the database in the same way as shutdown immediate. 2.1.4 SHUTDOWN ABORTSHUTDOWN Abort is the least recommended method of shutting down the database, and using this option, the database immediately terminates all user connections, interrupts all transactions, shuts down the database immediately, closes the database in this way, does not complete the transaction is not rolled back, and the database does not perform checkpoints, so at the next boot, The database must perform instance recovery, the instance recovery may take a significant amount of time, and the database startup may therefore take a long time to wait. The Abort method of shutting down the database is similar to a sudden power outage of the database server, which can lead to inconsistencies, so it is not easy to shut down the database this way unless it is a last resort. So under what circumstances need to use shutdown Abort method to shut down the database? Here are some common scenarios:
    • Database or application exception, other ways cannot close database
    • Fast shutdown of the database due to immediate power outages or other maintenance situations
    • You need to retry startup after starting an exception
    • When using shutdown immediate cannot be closed
    • Need to quickly restart the database
    • Shutdown Timeout or exception
2.2 Process of closing 2.2.1 Shutting down the databaseNon-abort method: Writes data from the SGA to a data file and an online redo log file. Then close the data file and the online redo log file. Abort mode: Directly close the database and the instance. Similar to power outages. 2.2.2 Uninstalling the databaseDisconnects the database and the instance. Close the control file for the database. 2.2.3 Closing a DB instanceTerminates the associated process and reclaims the memory of the SGA.

Reference: http://docs.oracle.com/database/122/CNCPT/oracle-database-instance.htm#CNCPT602 HTTP://WWW.EYGLE.COM/ORABK /hforacle/01.dbstartandshutdown.pdf

Oracle Startup and shutdown

Related Article

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.