Database Reference
In-Depth Information
The
STARTUP
Command
This command is used to start the instance and/or database only
when the database is in a shutdown state. The
STARTUP
command can be used to completely
open the database, as shown in this code snippet:
SQL> startup
The
STARTUP
command also has options that you can use to indicate that you want Oracle to
start the startup operation at a certain point. For example, you can indicate that you want
the instance to be started only by using the
STARTUP NOMOUNT
command:
SQL> startup nomount
Or perhaps you want to start the instance and mount the database. In this case, the com-
mand would be as follows:
SQL> startup mount
Sometimes you want to shut down the database and start it up in one command. You can
use the
STARTUP FORCE
command to perform this action. Note that the
STARTUP FORCE
com-
mand will shut down your database in an inconsistent manner (which we discussed earlier in
this chapter), and some operations (such as putting the database in ARCHIVELOG mode)
will not complete successfully if the database was shut down in an inconsistent manner.
Here is an example of the
STARTUP FORCE
command:
SQL> startup force
The SHUTDOWN Command
The
SHUTDOWN
command does what it says; it shuts down
the database. As with the
SHUTDOWN
command, it comes with a few options. First there is
the plain-Jane
SHUTDOWN
command, which will shut down the database if absolutely nothing
is going on and if absolutely no one is logged in. You can guess how often those conditions
happen in reality! Until its conditions are met, the
SHUTDOWN
command will just sit there,
waiting for its opportunity to shut down the database.
Here is an example of the
SHUTDOWN
command:
SQL> shutdown
If waiting is not your forte, then you may want to try the
shutdown immediate
command.
The
shutdown immediate
command will prevent new logons, roll back any uncommitted
transactions, and then bring the database down. It's a consistent-shutdown, no-waiting
approach to stopping the database, and lots of DBAs like it. Here is an example:
SQL> shutdown immediate
The cousin of
SHUTDOWN IMMEDIATE
is
SHUTDOWN TRANSACTIONAL
(we are not sure if it's a
first cousin or second cousin; Oracle has not defined this within the body of the Oracle
Search WWH ::
Custom Search