Oracle start and stop (three start phases and four shutdown modes)

                                  Oracle start and stop (three start phases and four shutdown modes)

Everyone knows that Oracle database supports various platforms. The most commonly used platforms are windows8 and Linux centos, redhat platform and mac platform, etc. Various platforms are supported. Because of the different platforms, then Oracle's operating mode is also very big. Differences, this article focuses on the windows platform and Linux centos, redhat platform to explain the details of some work done by Oracle during the start and stop phases of Oracle.

Windows Oracle start and stop :

Oracle under the Windows platform is relatively simple compared to Linux, because the Oracle database has been made into several services during the installation, among which the more important services are Oracle's monitoring service and Oracle's instance start and stop service.

Start the Oracle database: start the instance first. In the above figure, my instance is the service of OracleServerTEST, and then start the service of listening TNSListener. Shut down the Oracle database: first shut down the monitoring service, and then shut down the instance service.

Linux Oracle start and stop  :

Oracle startup under Linux is generally divided into three stages, nomount, mount, and open. The things that can be done in these three stages are different, so if there is a problem with the database that needs to be debugged, it may be necessary to start the database to a different stage to quickly locate the problem.

The first stage, this stage is the first step to start the Oracle database instance. The work done is to indicate the status of the instance, allocate memory to support subsequent steps such as reading configuration files, Oracle control files, and writing audit files and Alarm log (the following shows the first stage of starting the instance and querying the instance status). At this stage, we can modify the parameters, view the memory and background process information, or create a new database, or rebuild the control file

In this state, you can query background process and instance information. Such as:

select * from v$bgporcess;

select * from v$instance;

v $ parameter 、 v $ sga 、 v $ process 、 v $ session 、 v $ instance 等等

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size		    2213896 bytes
Variable Size		  973080568 bytes
Database Buffers	  671088640 bytes
Redo Buffers		    7135232 bytes
SQL> select status from v$instance;

STATUS
------------
STARTED
[root@centos55 dbs]# ps -ef | grep oracle
oracle   21881     1  0 21:34 ?        00:00:00 /home/oracle/app/oracle/product/11.2.0/dbhome_1//bin/tnslsnr LISTENER -inherit
root     24768  2066  0 22:20 pts/0    00:00:00 su - oracle
oracle   24769 24768  0 22:20 pts/0    00:00:00 -bash
oracle   25987     1  0 22:35 ?        00:00:00 ora_pmon_orcl
oracle   25989     1  0 22:35 ?        00:00:00 ora_vktm_orcl
oracle   25993     1  0 22:35 ?        00:00:00 ora_gen0_orcl
oracle   25995     1  0 22:35 ?        00:00:00 ora_diag_orcl
oracle   25997     1  0 22:35 ?        00:00:00 ora_dbrm_orcl
oracle   25999     1  0 22:35 ?        00:00:00 ora_psp0_orcl
oracle   26001     1  0 22:35 ?        00:00:00 ora_dia0_orcl
oracle   26003     1  0 22:35 ?        00:00:00 ora_mman_orcl
oracle   26005     1  0 22:35 ?        00:00:00 ora_dbw0_orcl
oracle   26007     1  0 22:35 ?        00:00:00 ora_lgwr_orcl
oracle   26009     1  0 22:35 ?        00:00:00 ora_ckpt_orcl

 

The second stage, entering this stage, we can backup, restore, restore the database, move the database file, open or close the database flashback function, open or close the archive mode, delete the database, the work done in this stage is to load the control file to RAM

In this state: The commands that can be executed are:

select * from v$tablespace; namespace

select * from v$datafile; data file

select * from v$database; database information

v$controlfile、v$database、v$datafile、v$logfile

SQL> alter database mount;

Database altered.

SQL> show parameter name

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert		     string
db_name 			     string	 orcl
db_unique_name			     string	 orcl
global_names			     boolean	 FALSE
instance_name			     string	 orcl
lock_name_space 		     string
log_file_name_convert		     string
service_names			     string	 orcl
SQL> select status from v$instance;

STATUS
------------
MOUNTED

In the third stage, all data files and redo logs are opened based on the record of the control file on the basis of mount. All operations within the scope of authority can be performed. :

SQL> alter database open;

Database altered.

SQL> select status from v$instance;

STATUS
------------
OPEN

There is also a read-only mode to open the database, that is, the database can only be queried and cannot be changed, a change in the third stage. The physical backup library can only be opened in this way, and the main library can be opened in any way.

SQL> alter database open read only;

Database altered.

SQL> select status from v$instance;

STATUS
------------
OPEN

 The three stages are started in sequence, and no one stage can be skipped. startup normal is equal to startup, which means that all three stages are completed at once. The following is the starup in place after closing the database, all three stages are completed. You can see that closing the database is a three-stage reverse operation.

SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size		    2213896 bytes
Variable Size		  973080568 bytes
Database Buffers	  671088640 bytes
Redo Buffers		    7135232 bytes
Database mounted.
Database opened.



Four shutdown modes of the Oracle database (the four are all commands that run under the sqlplus tool):

1. Shutdown normal is equal to shutdown:

Do not allow new connections, wait for the end of the session, wait for the end of the transaction, do a checkpoint and close the data file. No instance recovery is required at startup.

2. Shutdown transactional, this mode is also called transaction shutdown mode:

Do not allow new connections, do not wait for the end of the session, wait for the end of the transaction, do a checkpoint and close the data file. No instance recovery is required at startup.

3. Shutdown immediate, the most commonly used method of shutting down the library. :

Do not allow new connections, do not wait for the end of the session, do not wait for the end of the transaction, do a checkpoint and close the data file. Transactions that are not over are automatically rolled back. No instance recovery is required at startup.

4. Shutdown abort, which is equivalent to the operation of unplugging the power source of the host, which will generate a dirty library. This operation is generally not used, unless there is a special emergency. :

Do not allow new connections, do not wait for the end of the session, do not wait for the end of the transaction, do not checkpoint and do not close the data file. Automatic instance recovery at startup.

shutdown force =shutdown abort +startup #The stage of startup entry after shutdown

shutdown force nomount=shutdown abort +startup nomount#After shutting down, enter the stage of startup

shutdown force mount =shutdown abort +startup mount#After shutting down, enter the stage of startup

Summary :

All commands are executed under sqlplus.

Start the database: The three-phase commands are: startup nomount, alter database mount; alter database open; and a read-only open mode alter database open read only;

The normal startup method is that startup is   equivalent to startup normal , and the three stages are completed at once.

Shut down the database: The most commonly used shutdown command is shutdown immediate, followed by shutdown, which is equivalent to shutdown normal , and shutdown transactional again. Shutdown abort is extremely not recommended. This command is a dangerous command and is likely to damage the database. You can try to use it in special emergency situations, including three shutdown forces.

 

 

 

Guess you like

Origin blog.csdn.net/alwaysbefine/article/details/112445639