Starting and shutting down a database

Source: Internet
Author: User
Tags requires sqlplus

Use of Dbstart and Dbshut, and start and close the database using Sqlplus or SVRMGRL.


Use of Dbstart and Dbshut
Dbstart is used to start a DB instance Dbshut to shut down the DB instance these two script commands
Requires Oracle user to perform a hypothetical control file/etc/oratab has the following two descriptions
Cams:/u01/app/oracle/product/8.1.7:y
Oid:/u01/app/oracle/product/8.1.7:n
Then executing the Dbstart system with an Oracle user will attempt to start the Cams DB instance but will not
Attempting to start an OID DB instance

2.2 Starting and closing a database using Sqlplus or SVRMGRL
2.2.1 Starting the database
To start the database using Sqlplus, proceed as follows

1 Executing commands with Oracle users
$ sqlplus/nolog
Enter the sqlplus command interactive status prompt to "sql>"
2 Execute the following Sqlplus command in the sqlplus command interaction State
Connect/as SYSDBA
3 Execute command to start the database in Sqlplus command interaction State
Startup

Attention
If there are multiple instances on your machine, for example, there are two instances of cams and OID.
The database instance started when the database is started depends on the environment variable Oracle_sid
Because a row is set in the/etc/profile file
Export Oracle_sid=cams
So cams is the default instance of the above operation is to start the CAMS instance if you need to start the OID
Instance simply executes the following environment variable Settings command
Export Oracle_sid=oid
Set the value of the environment variable ORACLE_SID to OID before continuing with the above boot count
According to the operation of the library.


& Description
A further explanation is that the command to start the database, that is, startup will be executed in sequence
Experience three steps 1 launch Instance 2 Assembly database associates an instance with a specified database
3 Opening a database typically when you start a database, these three steps are required, but in some special
The application requires that only the previous step or the first two steps correspond to the following command
Startup Nomount Oracle Boot instance allocates related memory and starts background process
But does not assemble the database This command is typically used to create a new database or create a new control file for the
Situation
Startup Mount Oracle launches the instance and assembles the database but does not open the database that
Commands are typically used to perform specific maintenance operations such as enabling or disabling the renaming of data files
Archive a full backup of the log database, etc.

Starting a database using SVRMGRL Server Manager is similar to starting a database using Sqlplus
The operation is as follows

(1) Execute commands with Oracle user
$ svrmgrl
Enter the Server Manager command interaction status Prompt to "svrmgr>"
(2) Execute the following Server Manager commands in the interactive state of the Server Manager command
Svrmgr> Connect Internal
(3) Execute the command to start the database in the interactive state of the Server Manager command
Svrmgr> Startup


Other than that:
Database startup process:
1. Launch instance: Oracle Instance =SGA +processes
Read the parameter file. Init.ora
Allocate the SGA area.
Starts a background process.
2. Database installation: DB mounted
Control file Init.ora
3. Open databases: Database opened
Open all data files and all log files ' control files.
Parameter files? control files? data files and log files
4. Several startup commands:
Svrmgr> startup starts normally. Start all of the above
Svrmgr> Startup Mount startup 1, 2 items
Here you can modify the archive mode
You can use the ALTER DATABASE command
All v$** data dictionaries can be queried
Can do database recovery
Cases:
Svrmgr>alter database open Read only;
--(The entire database is opened as read-only)
Svrmgr>alter database open Read write;
--(The entire database opens in read/write mode) (default)
Svrmgr> startup Nomount startup 1 items
You can create a new database
Create a control file.

5. Commands that can be used under open:
To start multiple databases:
svrmgr> startup pfile = first parameter filename and path;
svrmgr> Startup pfile = second parameter filename and path;

6. Mandatory and restrictive database startup commands:
Force database Start command: (as described above only part of the startup case)
svrmgr> startup force;
To restrict database startup commands:
Svrmgr>startup RESTRICT; --Only DBA users can connect


Close the database
To close the database using Sqlplus:
(4) Execute commands with Oracle user
$ sqlplus/nolog
Enter the sqlplus command interactive status prompt to "sql>"
(5) Execute the following Sqlplus command in the sqlplus command interaction State
Sql> Connect/as SYSDBA
(6) Execute the command to close the database in the interactive state of the Sqlplus command
sql> shutdown

Shutting down a database using SVRMGRL Server Manager is similar to shutting down a database by using Sqlplus
The operation is as follows
(1) Execute commands with Oracle user
$ svrmgrl
Enter the Server Manager command interaction status Prompt to "svrmgr>"
(2) Execute the following Server Manager commands in the interactive state of the Server Manager command
Svrmgr> Connect Internal

(3) Execute the command to close the database in the interactive state of the Server Manager command
svrmgr> shutdown

Other than that
Database Shutdown Command:
svrmgr> shutdown +
Nomal; Exit normally. Used when all users have exited
Immediate Immediately shut down the machine. Interrupts all users and rolls back any unsaved commands. (Recommended use)
Abort Abnormal shutdown. Just shutting down the instance is a dangerous shutdown.
transactional; Shutdown after the end of the thing. Wait for all users to shut down after completing the submission.

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.