ALTER DATABASE

Syntax

alterDatabase::=

Description of alterdatabase.gif follows
Description of the illustration alterdatabase.gif

Purpose

To mount or open a database.

See Also:

Oracle Database SQL Reference for ALTER DATABASE syntax

Restrictions and Usage Notes

  • Execute this command either within the braces of a RUN command or at the RMAN prompt.

  • The target instance must be started.

Keywords and Parameters

Syntax Element Description
MOUNT Mounts the database without opening it. This option is equivalent to the SQL statement ALTER DATABASE MOUNT.
OPEN Opens the database.
RESETLOGS Archives the current online redo logs (or up to the last redo record before redo corruption if corruption is found), clears the contents of the online redo logs, and resets the online redo logs to log sequence 1. The RMAN RESETLOGS option is equivalent to the SQL statement ALTER DATABASE OPEN RESETLOGS.

If you use a recovery catalog, then RMAN performs an implicit RESET DATABASE after the database is opened to make this new incarnation the current one in the catalog. If you execute the SQL statement ALTER DATABASE OPEN RESETLOGS (not the RMAN command of the same name), then you must manually run the RESET DATABASE command.


Examples

Opening the Database After a Backup: Example This example mounts the database, takes a whole database backup, then opens the database. At the RMAN prompt enter:

STARTUP MOUNT; 
BACKUP DATABASE;  
# now that the backup is complete, open the database. 
ALTER DATABASE OPEN; 

Mounting the Database After Restoring the Control File: Example To restore the control file to its default location when connected to a recovery catalog, enter the following:

STARTUP NOMOUNT;
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
# you must run the RECOVER command after restoring a control file even if no datafiles 
# require recovery
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;

Performing RESETLOGS After Incomplete Recovery: Example This example uses a manually allocated channel to perform incomplete recovery and then resets the online redo logs:

RUN
{
  ALLOCATE CHANNEL ch1 DEVICE TYPE sbt; 
  SET UNTIL SCN 1024;
  RESTORE DATABASE; 
  RECOVER DATABASE;
  ALTER DATABASE OPEN RESETLOGS;
}