Startup and shutdown of Oracle database instances

Source: Internet
Author: User
Tags rollback oracle database

To start and close the database,must be logged on as a user with Oracle Administrator privileges, usually with aSYSDBAPermission for the user to log in. In general, we often use the SYS user to start and close the database with a SYSDBA connection. The following describes the differences between how several different database startup and shutdown methods are in the Oracle database and their different capabilities.1 start of database (startup)   In the startup command, you can control different startup steps for a database with different options.   1, STARTUP nomount   nonount option only creates an Oracle instance. Reads the Init.ora initialization parameter file, starts the background process, initializes the system global area (SGA). The Init.ora file defines the configuration of the instance, including the size of the memory structure and the number and type of startup background processes. The instance name is set according to Oracle_sid and does not necessarily have to be the same as the name of the Open database. When the instance is open, the system displays a list of the SGA memory structure and size, as follows:   sql> startup Nomount Oracle instance started. Total System Global area 35431692 bytes Fixed Size 70924 bytes Variable Size 18505728 bytes Database buffers 16777216 byte s Redo buffers 77824 bytes    2, STARTUP MOUNT   This 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 method is often used in database maintenance operations, such as renaming the data file, changing the redo log, opening the archive, and executing the database recovery. In this open mode, in addition to seeing the SGA system list, the system also gives a " database mounted. " hint.   3, STARTUP   This command completes all three steps for creating an instance, installing an instance, and opening a database. At this point, the database makes the data file and the redo log file online, and usually requests one or more rollback segments. In addition to the system can see the previous startup Mount method under all the prompts, 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 open a command by using startup Nomount or a database on startup mount, you must use the ALTER DATABASE command to execute the open numberAccording to the operation of the library. For example, if you open the database as a startup Nomount, that is, the instance has been created, but the database is not installed and opened. The following two commands must be run to enable the database to start correctly. ALTER DATABASE MOUNT; ALTER DATABASE OPEN;   If you start the database in startup mount, you can open the database simply by running one of the following commands: ALTER database open;   4, other open mode   In addition to the three types of database open options described earlier, there are other options.   (1) STARTUP RESTRICT   In this way, the database will be opened successfully, but only some privileged users (users with DBA role) can use the database. This approach is commonly used to maintain the database, such as data import/export operations 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 closes the database (Shutdown Abort) and start the database (Startup) A synthesis of two commands.     This command is used only if you have problems shutting down the database and you cannot close the database.   (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 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 indeed province option. That is, if you enter a command such as shutdown, the shutdown nornal command is executed.   Once this command is issued, any new connections will no longer be allowed to connect to the database. Before the database is closed, Oracle waits for all users currently connected to exit from the database before shutting down the database. Shutting down the database in this manner does not require any instance recovery at the next startup. Note, however, that in this way, it may take 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 want to let the database cleanly shut down, often in 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 there is a long uncommitted transaction in the system, it also takes a while to shut down the database in this way (the transaction rollback time). The system does not wait for all users connected to the database to exit the system, force the rollback of all current active transactions, and then disconnect all connected users.   3, SHUTDOWN transactional   This option is only available after Oracle 8i. This command is commonly used to schedule a shutdown of a database that is currently connected to the system and that the active transaction completes, and any new connections and transactions are not allowed after the command is run. After all active transactions have been completed, the database closes the database in the same way as shutdown immediate.   4, SHUTDOWN ABORT   This is the last resort to close the database, but also in the absence of any way to close the database in the case to be used in the way, generally do not use. You can consider shutting down the database in this way if the following conditions occur.     1, the database is in an abnormal working state, can not use shutdown normal or shutdown immediate such commands to close the database; 2, need to close the database immediately, 3, when starting the database instance encountered problems;   All running SQL statements will be aborted immediately. Any 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 the database, an instance recovery is required, so the next boot may be more than usualMore time is needed.   The following table provides the differences and links between the four different types of closing databases.

Off mode Abort Immediate Transaction Nornal
Allow new connections X X X X
Wait until the current session is aborted X X X
Wait until the current transaction is aborted X X
Force checkpoint, close all files X

Programmer's Basic tutorial: Rookie Programmer

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.