Oracle & mdash; database startup and Shutdown

Source: Internet
Author: User

Content

  • Server Environment
  • Client Environment
  • Overview
  • Start Database
  • Close Database
  • Supplement
  • References

This article describes how to start and shut down the Oracle database. Although the content is basic, it is required in many database operations. Therefore, it is important to understand the basics. For example, what Database loading mode should be used and the database file opening mode should be used.

Server Environment
  • Windows 2003 R2
  • Oracle11g 32-bit

 

Client Environment
  • Windows 2008R2
  • Oracle 11g 32-bit Client

 

Overview

If you use the startup command to start the database, the Operation will go through three different stages:

  • Instance startup)
  • Database mount)
  • Database open)

At this stage, Oracle analyzes the database parameter files and tries to obtain the instance lock to determine that the instance is not running. Then, Oracle started a variety of different database processes, such as DBWn and LGWR processes. Oracle will also allocate the memory required for the SGA. Once the instance is started, Oracle Reports to the user who started the instance that the background process has started the instance.

Database loading (loading and starting). In the loading phase, Oracle opens the Database Control File. After the control file is opened successfully, Oracle extracts the database data file name from the control file to prepare for opening these database files. It should be noted that at this time, Oracle will not check whether these data files exist, but only identify the location of the data files from the control file. After completing this step, Oracle Reports to users that the database has been loaded.

When the database is opened, Oracle continues to start the process and tries to open the database. In the database open stage, Oracle verifies the existence of database files and opens these files. When opening a data file, Oracle checks the data file header and compares the SCN information in these file headers with the SCN stored in the control file (SCN is the Oracle Method for tracking the database status ).

When Oracle tries to open the database, it checks each data file and the SCN in the Database Control File. If the SCN is the same and the bit ing mark is set correctly, the database is considered to be the same, and the database can be opened and used. If the SCN is different, Oracle automatically performs disaster recovery or instance recovery. If the online redo log file contains the redo required to generate a consistent image, a disaster or instance recovery will occur. If the data file is damaged or the redo required for recovery is not in the online redo log and the disaster or instance recovery cannot be performed, Oracle requires DBA to perform media recovery. The restoration of media must recover one or more database data files from a database backup. Unlike the restoration of an instance, the restoration of media is a manual process.

The shutdown command is used to close the database, unmount the database, and execute the opposite operation as startup.

 

In the following example, the database is started or shut down on the server.

 

Start Database

Figure 1 start a database

Close Database

Figure 2 shut down the database

Shut down the database and then start it.

 

Supplement

Startup has several different variants, including:

  • Startup: enables Oracle to go through three Startup stages.
  • Startup restrict: enables Oracle to go through three Startup stages and opens the database in restricted mode. Only users with limited permissions can access the database.
  • Startup nomount: After the database instance is started successfully, the process is stopped. You can use this command to start a database instance before creating a database. If you need to re-create the control file, this command is also very convenient. To use RMAN in a given database, you must be able to start the instance successfully using the startup nomount command.
  • Startup mount: After the database instance is started successfully and the database is loaded, the process is stopped. This command is useful if you need to restore the system tablespace.
  • Startup read only: enables the Oracle database (or backup database) to be opened in read only mode. In this way, DML operations are not supported, but databases can be queried. This command is useful if you are executing a time point recovery operation and want to restore the database to the current time point before using the resetlogs command to submit the database instance.
  • Startup force: Close the database together with the shutdown abort command (as described below. After the Startup force command, you can add the database open mode. Example:

Startup force restrict

Startup force mount

Startup force nomount

 

In other words, the Startup command can be followed by the Database loading mode command; the Database loading mode command can be followed by the database opening mode command.

 

The Shutdown command has the following forms:

  • Shutdown (and shutdown normal): enables Oracle to wait until all user processes are disconnected from the database. After all processes are disconnected, the database is completely closed. This command can avoid instance recovery. After execution, no new user process can connect to the database.
  • Shutdown immediate: clears all existing user calls and rolls back all uncommitted transactions. This command can avoid instance recovery. After execution, no new user process can connect to the database.
  • Shutdown abort: usually causes database crash. This command requires instance recovery (instead of media recovery ). After execution, no new user process can connect to the database.
  • Shutdown transactional: enables Oracle to wait for all user processes to submit the current transaction, disconnect these user processes, and shut down the database. No new user can talk back to the database while waiting to complete these transactions.

Shutdown immediate is commonly used, while Shutdown is often slow to shut down the database ~

 

References
  • Database and Instance 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.