[Oracle Notes] Start, shut down, and view database status

Source: Internet
Author: User
The database can be started in three phases: nomount, mount, and open. The database status can be viewed in three phases. Three phases of database startup 1. Create instance instancenomount in nomount phase. oracle mainly completes five things a. Search for the parameter file. oracle will search for the following parameter files in sequence under the $ ORACLE_HOMEdbs directory, as shown in

The database can be started in three phases: nomount, mount, and open. The database status can be viewed in three phases. Three phases of database startup 1. the nomount stage creates the instance nomount stage, and oracle mainly completes five tasks. search for the parameter file. oracle searches for the following parameter files in sequence under the $ ORACLE_HOME/dbs/directory, as shown in figure

The database can be started in three phases: nomount, mount, and open. The database status can be viewed in three phases.


Three phases of database startup

1. Create an instance in nomount stage

In the nomount stage, oracle mainly completes five tasks

A. Search for the parameter file. oracle will search for the following parameter file in sequence under the $ ORACLE_HOME/dbs/directory. If one of them exists, it will be used. Spfile is a binary file and cannot be edited directly. init (pfile) is a text file that can be edited directly.

1. spfile $ ORACLE_SID.ora

2. spfile. ora

3. init $ ORACLE_SID.ora

B. Read the parameter file to determine the value of the initialization parameter.

C. Allocate the SGA memory Zone according to the initialization parameters.

D. Start the background process

E. Open the alert _ $ ORACLE_SID.log file and trace file, and write the parameters and operations executed during startup into the alert file.

You can manually specify the PFILE

SQL> STARTUP PFILE=/u01/app/oracle/product/10.2.0/dbs/init.ora

2. mount Mode

The instance associates the database with the instance by loading the database. In the mount phase, oracleCONTROL_FILESParameters to find the control file, read the database name from the control file, determine the data file, and the online redo log files accessed during open. At this time, the instance does not open the physical file of the database, that is, data files and redo log files. The user still cannot establish a connection or session with the database in the mount status.

If the control file reuse copy is lost or damaged, oracle Reports an error. You need to restore the control file, modify the parameter file, manually create the control file, or replace the lost or damaged control file.

3. open Mode

You can establish a connection with the database and access the database only after you set the database to open. Oracle will open physical files step by step

A. Open all online tablespace data files except the Undo tablespace

B. Enable undo tablespace to undo the tablespace.

C. Open the online redo log file and redo the log file.

If a data file or redo log file is lost or damaged during the open stage, or the data file is inconsistent, oracle Reports an error and media recovery is required.


View database status

In nomount and mount modes, the database cannot be connected. You can view the dynamic view and lsnrctl to view the database status.

If the database is not started, lsnrctl status

[oracle@localhost dbs]$ lsnrctl status……Listening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))Services Summary...Service "PLSExtProc" has 1 instance(s).  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...The command completed successfully

Start Database

[oracle@localhost dbs]$ sqlplus / as sysdbaSQL> startup nomount

View Dynamic View

SQL> select status from v$instance;STATUS------------STARTEDSQL> select open_mode from v$database;select open_mode from v$database                      *ERROR at line 1:ORA-01507: database not mounted
View lsnrctl status
[oracle@localhost dbs]$ lsnrctl status……Services Summary...Service "PLSExtProc" has 1 instance(s).  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...Service "orcl" has 1 instance(s).  Instance "orcl", status BLOCKED, has 1 handler(s) for this service...Service "orcl_XPT" has 1 instance(s).  Instance "orcl", status BLOCKED, has 1 handler(s) for this service...The command completed successfully

Load Database

SQL> alter database mount;Database altered.SQL> select status from v$instance;STATUS------------MOUNTEDSQL> select open_mode from v$database;OPEN_MODE----------MOUNTED

View lsnrctl status

[oracle@localhost dbs]$ lsnrctl status……Services Summary...Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...Service "orcl" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service...Service "orcl_XPT" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service...The command completed successfully


Open Database

SQL> alter database open;SQL> select status from v$instance;STATUS------------OPENSQL> select open_mode from v$database;OPEN_MODE----------READ WRITE


View lsnrctl statas

[oracle@localhost dbs]$ lsnrctl status……Services Summary...Service "PLSExtProc" has 1 instance(s).     Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...Service "orcl" has 1 instance(s).     Instance "orcl", status READY, has 1 handler(s) for this service...Service "orclXDB" has 1 instance(s).     Instance "orcl", statusREADY, has 1 handler(s) for this service...Service "orcl_XPT" has 1 instance(s).     Instance "orcl", statusREADY, has 1 handler(s) for this service...The command completed successfully

.


Reference: http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/startup.htm#CEGJEJDD





Close Database

In response to database startup, closing the database is also divided into three steps: 1) closing the database oracle writes the redo log buffer into the online redo log, and writes the dirty block in the database buffer cache to datafile, disable all datafile and online redo files. 2) uninstall the database instance, and disable control file. 3) shut down the instance to terminate all background and server processes, and reclaim the memory space. Shutdown [normal | transaction | immediate | abort] 1) shutdown normal is the default method. If there is no time limit for database shutdown, you can use it. oracle performs the following operations:. prevent users from establishing new connections B. wait for the user to actively disconnect c. once all users are disconnected, shut down database d.2) shutdown immediate if you want to close the database in the shortest time, you can use this method. Oracle will perform the following operations: a. Prevent users from establishing new connections B. Roll back all uncommitted transactions. C. Terminate all user connections and close the database. D.3) If shutdown transaction is required to shut down the database in the shortest time and ensure that all the current transactions can be committed, the shutdown transaction command can be used to close the database. Oracle performs the following operations:. prevent users from establishing new connections B. wait for the user to roll back or commit uncommitted transactions, and immediately disconnect the user. shut down database d.4) shutdown abort if the first three methods cannot shut down the database, or if a serious database error occurs, you can only use shutdown abort to shut down the database. This method is equivalent to a sudden disconnection of power, which may lead to loss of some data information. The next time you start the database, oracle will automatically execute instance recovery (roll forward and rollback ). When shutdown abort, oracle performs the following operations:. prevent users from establishing new connections B. immediately end the SQL statement being executed c. no uncommitted transactions will be rolled back. d. disconnect all user connections and immediately close the database

E. instance recovery is required after the database instance is restarted.

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.