Starting and shutting down an Oracle DB instance

Source: Internet
Author: User

To start and shut down a database, you must log in as a user with Oracle Administrator privileges , typically logged in as a user with SYSDBA permissions. Generally we use the SYS user to start and close the database with a SYSDBA connection. Here are the differences between the different database startup and shutdown methods of the Oracle database and their different capabilities.

1 Starting the database (startup)  In the startup command, different options are available to control the different startup steps of the database.   1, STARTUP nomount  nonount option creates only one Oracle instance. Reads the Init.ora initialization parameter file, initiates a background process, initializes the system global Zone (SGA). The Init.ora file defines the configuration of the instance, including the size of the memory structure and the number and type of background processes that are started. The instance name is set according to Oracle_sid and does not have to be the same as the open database name. When the instance is opened, the system displays a list of the SGA memory structure and size, as shown below: sql> startup Nomountoracle instance started. Total System Global area 35431692 bytesfixed size 70924 bytesvariable size 18505728 bytesdatabase buffers 16777216 bytesre Do buffers 77824 bytes   2, STARTUP mount  The command creates an instance and installs the database, but does not open the database. The Oracle system reads the contents of the control file about the data file and the redo log file, but does not open the files. This open mode is often used in database maintenance operations, such as renaming a data file, changing the redo log and opening the archive, and executing the database recovery. In this open mode, the system also gives a hint of " database mounted. " In addition to the list of SGA systems.   3, startup  This command completes all three steps to create an instance, install an instance, and open a database. At this point the database makes the data file and the redo log file online, and typically requests one or more rollback segments. In addition to the system can see the previous startup Mount mode of all the hints, but also give a " database opened. " hint. At this point, the database system is in a normal working state and can accept user requests.   If you use the startup Nomount or startup Mount database to open a command, you must use the ALTER DATABASE command to perform an open database operation. For example, if you use the startup NOMThe Ount method opens the database, which means that the instance has been created, but the database is not installed and opened. The following two commands must be run for the database to start correctly. ALTER DATABASE MOUNT; ALTER DATABASE open;  and if you start the databases in startup mount, you can open the database by running only the following command: ALTER database open;  4, other open mode   except before There are several other options available in addition to the three database open methods options described in the   (1) STARTUP restrict  in this way, the database will be opened successfully, but only some privileged users (users with DBA roles) can use the database. This approach is often used to maintain the database, such as data import/export operations when you do not want other users to connect to the database operation data, data loading, specific migration or upgrade operations.   (2) STARTUP force  the command actually forcibly shuts down the database ( Shutdown Abort) and start the database ( Startup) A synthesis of two commands.   This command is only used when the database is closed and the database is not closed. (3) ALTER DATABASE OPEN READ only; This command opens the database as read-only after the instance is created and the database is installed. A product database that only provides query functionality can be opened in this way. 2 shutdown of the database (SHUTDOWN)  For database shutdown, there are four different shutdown options.   1, SHUTDOWN normal  This is the database Shutdown SHUTDOWN command does save the option. In other words, if you enter a command such as shutdown, the shutdown nornal command is executed.   When this command is issued, any new connections will not be allowed to connect to the database. Before the database shuts down, Oracle waits for all users who are currently connected to exit from the database before shutting down the database. By shutting down the database in this way, no instance recovery is required at the next boot. However, it is important to note that in this way, it may take a few days or longer to close a database.    2, SHUTDOWN immediate  This is a common way to close the database, want to close the database quickly, but also want to make the database clean shutdown, often used this way. The SQL statement currently being processed by Oracle is immediately interrupted, and any transactions that are not committed in the system are rolled back. If a long uncommitted transaction exists in the system, it can take a while for the database to be shut down in this manner (the transaction is rolled back time). The system does not wait for all users connected to the database to exit the system, forcibly rollback all currently active transactions, and then disconnects all connected users.   3, SHUTDOWN transactional  This option is only available after Oracle 8i. This command is commonly used to schedule a shutdown of the database, which causes the current connection to the system to execute and the active transaction is completed, and any new connections and transactions are disallowed after the command is run. After all active transactions are complete, the database shuts down the database in the same way as shutdown immediate.   4, SHUTDOWN abort  This is the last move to close the database, but also in the absence of any way to close the database in the case only have to use the way, generally do not use. You might consider shutting down the database this way if the following conditions occur.    1, the database is in a non-normal working state, can not be used shutdown normal or shutdown immediate such a command to close the database; 2, need to close the database immediately; 3. You encounter a problem when you start the DB instance;  all running SQL statements are aborted immediately. All uncommitted transactions will not be rolled back. Oracle also does not wait for users who are currently connected to the database to exit the system. The next time you start a database, you need to perform an instance recovery, so the next boot may take longer than usual.   The following table for each of the four different closeThe differences and linkages between databases.
Closed mode Abort Immediate Transaction Nornal
Allow a new connection X X X X
Wait until the current session is aborted X X X
Wait until the current transaction aborts X X
Force checkpoint, close all files X

Starting and shutting down an Oracle DB instance

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.