Here I am taking simple scenario to recover the controlfile. Following describes a scenario when my database is in NOARCHIVELOG mode. Database in oracle 10.2.0.1.0
SCENARIO: WHEN USED WITH DEFAULT RMAN CONFIGURATION SETTINGS.
Here only controlfile is lost, all the datafile and redo log files remain intact.
Following are the steps that can be taken:
1.RMAN> STARTUP MOUNT
2.RMAN> BACKUP DATABASE
3. RMAN> ALTER DATABASE OPEN;
4. delete controlfile.
5. RMAN> SHUTDOWN ABORT;
6. RMAN> STARTUP;
Database will not start. It starts in nomount state.
7. RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
8. RMAN> ALTER DATABASE MOUNT;
9. RMAN> RESTORE DATABASE;
10.RMAN> RECOVER DATABASE ;
11.RMAN> ALTER DATABASE OPEN RESETLOGS;
And database will be recovered. Here SET DBID command is not needed because backup is located in flash recovery area. Controlfile autobackup default format is used.
SCENARIO: WHEN USED WITH non-DEFAULT RMAN CONFIGURATION SETTINGS.
I changed some of the default RMAN configuration settings. Now backup is not using flash recovery area. Also, controlfile autobackup is not using flash recovery area.
RMAN> SHOW ALL;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/usr/lib/oracle/xe/backup/cf_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 400 M FORMAT '/usr/lib/oracle/xe/backup/df_%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs/snapcf_XE.f'; # default
Now follow these steps:
1.RMAN> STARTUP MOUNT
2.RMAN> BACKUP DATABASE
3. RMAN> ALTER DATABASE OPEN;
4. delete controlfile.
5. RMAN> SHUTDOWN ABORT;
6. RMAN> STARTUP;
Database will not start. It starts in nomount state.
7. RMAN> SET DBID=
8. RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/usr/lib/oracle/xe/backup/cf_%F';
9. RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
10. RMAN> ALTER DATABASE MOUNT;
11. RMAN> RESTORE DATABASE;
12.RMAN> RECOVER DATABASE ;
13.RMAN> ALTER DATABASE OPEN RESETLOGS;
Note: If all the redo logs since the last database exist, then you can skip RESTORE DATABASE statement in both the above cases.
SCENARIO: WHEN USED WITH DEFAULT RMAN CONFIGURATION SETTINGS.
Here only controlfile is lost, all the datafile and redo log files remain intact.
Following are the steps that can be taken:
1.RMAN> STARTUP MOUNT
2.RMAN> BACKUP DATABASE
3. RMAN> ALTER DATABASE OPEN;
4. delete controlfile.
5. RMAN> SHUTDOWN ABORT;
6. RMAN> STARTUP;
Database will not start. It starts in nomount state.
7. RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
8. RMAN> ALTER DATABASE MOUNT;
9. RMAN> RESTORE DATABASE;
10.RMAN> RECOVER DATABASE ;
11.RMAN> ALTER DATABASE OPEN RESETLOGS;
And database will be recovered. Here SET DBID command is not needed because backup is located in flash recovery area. Controlfile autobackup default format is used.
SCENARIO: WHEN USED WITH non-DEFAULT RMAN CONFIGURATION SETTINGS.
I changed some of the default RMAN configuration settings. Now backup is not using flash recovery area. Also, controlfile autobackup is not using flash recovery area.
RMAN> SHOW ALL;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/usr/lib/oracle/xe/backup/cf_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 400 M FORMAT '/usr/lib/oracle/xe/backup/df_%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs/snapcf_XE.f'; # default
Now follow these steps:
1.RMAN> STARTUP MOUNT
2.RMAN> BACKUP DATABASE
3. RMAN> ALTER DATABASE OPEN;
4. delete controlfile.
5. RMAN> SHUTDOWN ABORT;
6. RMAN> STARTUP;
Database will not start. It starts in nomount state.
7. RMAN> SET DBID=
8. RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/usr/lib/oracle/xe/backup/cf_%F';
9. RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
10. RMAN> ALTER DATABASE MOUNT;
11. RMAN> RESTORE DATABASE;
12.RMAN> RECOVER DATABASE ;
13.RMAN> ALTER DATABASE OPEN RESETLOGS;
Note: If all the redo logs since the last database exist, then you can skip RESTORE DATABASE statement in both the above cases.
Is this article is oracle xe based?
ReplyDeleteYes that is. I tested this scenario in oracle 10g xe.
ReplyDelete