Home » Oracle DBA » Starting and Shutting Down a Database with RMAN in Oracle

Starting and Shutting Down a Database with RMAN in Oracle

Starting and Shutting Down a Database with RMAN in Oracle

You need to start and shut down the Oracle database from the RMAN client during a backup
and recovery–related task.
You can both shut down and start up a database using the equivalent of the usual SQL*Plus
startup and shutdown commands from the RMAN client. The following sections show how to
issue the startup and shutdown commands from RMAN.
Starting a Database
You can use the startup command with several options. Here’s an example that shows how the
database is opened using the startup command:
RMAN> startup
RMAN enables you to do more with the nomount option, however. In the following example,
you can see how you can go through all the steps of opening a database—starting the
instance, restoring the control file, mounting the control files, recovering the database, and,
finally, opening the database. The example shows how to restore the control file while connected
to the recovery catalog. After restoring the control file, the database is mounted with
the alter database mount command. Next you see the recover command, which is mandatory
after restoring a control file. Finally, the database is opened with the open resetlogs

RMAN> connect target /
RMAN> connect catalog rman/rman@catdb
RMAN> startup nomount;
RMAN> restore controlfile;
RMAN> alter database mount;
RMAN> recover database;
RMAN> alter database open resetlogs;

The nomount option also comes in handy when you lose your spfile or are forced to start
the instance without a spfile (and any init.ora file). You can then use the nomount option to
start up the database with a dummy parameter file. For example:
set DBID 1296234570;
startup force nomount; # RMAN will start the instance with a dummy parameter file
Once RMAN starts the database with the dummy parameter file, you can restore the
actual spfile from the autobackup:
restore spfile from autobackup; # restore a server parameter file
startup force; # restart instance with the new server parameter file
After restoring the spfile, you can start the database using that spfile.
You can also use the dba option with the shutdown command to restrict access only to
those users who’ve been granted the restricted session privilege. Here’s how to do that:

RMAN> startup dba pfile=/tmp/initprod1.ora;

The database is now open, but only users with the restricted session privilege will be
able to connect. Typically, DBAs give the restricted session privilege only to each other. It
gives you a way to do work in the database while ensuring that no business users are connected.
Shutting Down a Database
Issue the shutdown command to close down the database and stop the instance. All the standard
SQL*Plus options you can use with the shutdown command—normal, immediate, abort,
and transactional—have the same effect and meaning when used from within RMAN. Here’s
an example:

RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> backup database;
RMAN> alter database open;

This example shuts down the database, kicking off any current users as soon as their currently
executing SQL statements finish. The database is then backed up and reopened for use.