What is the Oracle database shutdown and startup command ?, Oracle commands

Source: Internet
Author: User

What is the Oracle database shutdown and startup command ?, Oracle commands
Preface

Log on to sqlplus with sysdba and run the following command.

On windows, the background processes that constitute instances in oracle are implemented by threads derived from the oracle service, therefore, the task manager cannot see background processes such as DBWn (which can be seen by running the ps aux command on linux ). Shutdown refers to the process of stopping the instance, which is to close the background process (corresponding to the thread here) and release the SGA memory. Because the thread is closed, no changes can be seen in the task manager. An oracle process is a service process used to derive background threads. Although it is still running, the oracle instance has actually stopped. The oracle process can be stopped only after the oracle service is stopped.

Three steps are required to start a database:

1. Create an Oracle instance (not in the installation phase)

2. Database Installation By instance (installation phase)

3. Open the database (open stage)

Close

SHUTDOWN NORMAL

This is indeed a saving option for shutting down the SHUTDOWN command of the database. That is to say, if you issue a command like SHUTDOWN, it means shutdown nornal. After this command is issued, no new connections are allowed to connect to the database. Before the database is closed, Oracle will close the database only after any user connected to the database exits. Close the database in this way, and no instance recovery is required at the next startup. However, it may take several days or longer to close a database.

SHUTDOWN IMMEDIATE

This is a common method to close a database. This method is often used to close the database quickly but to make it clean. SQL statements currently being processed by Oracle are immediately interrupted, and all uncommitted transactions in the system are rolled back. If a long uncommitted transaction exists in the system, it may take some time (the transaction rollback time) to close the database in this way ). The system does not wait for any user connected to the database to exit the system, forcibly roll back any active transactions, and then disconnect any connected users.

SHUTDOWN TRANSACTIONAL

This option can only be used after Oracle 8i. This command is often used to plan to shut down the database. It completes the execution of active transactions that are currently connected to the system. After running this command, any new connections and transactions are not allowed. After any active transaction is completed, the database will be shut down in the same way as shutdown immediate.

SHUTDOWN ABORT

This is the last way to shut down the database. It is also the method that has to be used when there is no way to shut down the database. If the following situations occur, you can consider using this method to shut down the database.

1. The database is in an abnormal working state and cannot be shut down using commands such as shutdown normal or shutdown immediate;

2. immediately shut down the database;

3. problems encountered when starting the database instance;

Any running SQL statement will be aborted immediately. No uncommitted transactions will be rolled back. Oracle does not wait for the user connected to the database to exit the system. The instance must be restored when the database is started next time. Therefore, the next start may take more time than usual.

Enable

STARTUP NOMOUNT

The NOMOUNT option only creates an Oracle instance. Read the init. ora initialization parameter documentation, start the background process, and initialize the system global zone (SGA ). The Init. ora document defines instance configurations, including the size of the memory structure and the number and type of background processes. The instance name is configured according to Oracle_SID and does not have to be the same as the name of the opened database. When the instance is turned on, the system displays a list of SGA Memory Structures and sizes, as shown below:

SQL> startup nomount

The ORACLE routine has been started.

Total System Global Area 35431692 bytes

Fixed Size 70924 bytes

Variable Size 18505728 bytes

Database Buffers 16777216 bytes

Redo Buffers 77824 bytes

STARTUP MOUNT

This command creates an instance and installs the database, but does not open the database. This document does not open the data document and rebuild log document in the Oracle read control document. This method is often used in database maintenance operations, such as renaming data documents, changing duplicate logs, and opening and archiving methods. In this way, in addition to the SGA system list, the system will also prompt "database load is complete.

STARTUP

This command completes the three steps of creating an instance, installing an instance, and opening a database. At this time, the database makes the data document and the re-log document online, and usually requests one or more rollback segments. In this case, the system will not only see any prompts in the Startup Mount mode, but also give a prompt "the database has been opened. In this case, the database system is in normal operation and can accept user requests.

Others

If you use startup nomount or startup mount to open a DATABASE, you must use the alter database command to open the DATABASE. For example, if you use startup nomount to open a database, that is, the instance has been created but the database has not been installed or opened. The following two commands must be run to start the database correctly.

Alter database mount;

Alter database open;

If you start the database in the startup mount mode, you only need to run the following command to open the database:

Alter database open.

STARTUP RESTRICT

In this way, the database is successfully opened, but only privileged users (users with DBA roles) are allowed to use the database. This method is often used to maintain the database. For example, you do not want other users to connect to the database for data import/export operations.

STARTUP FORCE

This command is a combination of the two commands, shutdown abort and startup. This command is used only when the database is shut down and cannot be shut down.

ALTER DATABASE OPEN READ ONLY

This command opens the database in read-only mode after creating an instance and installing the database. This method can be used to open product databases that only provide the query function.

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.