【Vegas改编】RMAN Catalog建立、备份及还原实施
-- Target DB ORACLE_SID=oralin CATALOG DB ORACLE_SID=oratest
******************************************************************
1. Create catalog DB and register database.
1.1. Connect to the catalog database and Create tablespace for the catalog:
1.2. Create Recovery Manager User:
1.3. Grant the role and privilege to this user to maintain the recovery catalog and perform the backup and recovery operations.
SQL> GRANT CONNECT,RESOURCE TO rmanoralin;
1.4. Create catalog.
RMAN> create catalog tablespace RMAN_ORALIN;
RMAN> exit;
1.5. Check rmanoralin.log
1.6. Log in as a user with SYSDBA priviledge on the target database tp perform all the backup and recovery operations.
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
connected to target database: ORALIN (DBID=34306947)
connected to recovery catalog database
1.7. Register target database in the catalog.
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
*******************************************************
2. Backup databse using RMAN catalog and incremetallevel 0;
allocate channel d1 type disk;
backup incremental level=0 filesperset 3 format '/u01/app/oracle/oradata/oralin/backup/%d.s%s.t%t.L0'
( database include current controlfile);
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup filesperset 3 format '/u01/app/oracle/oradata/oralin/backup/ARCH.%d.s%s.t%t'
(archivelog all delete input);
}
*******************************************************************************************
3. Backup database using RMAN catalog and incremetallevel 1;
run {
allocate channel d1 type disk;
backup incremental level=1 filesperset 3 format '/u01/app/oracle/oradata/oralin/backup/%d.s%s.t%t.L1'
( database include current controlfile);
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup filesperset 3 format '/u01/app/oracle/oradata/oralin/backup/ARCH.%d.s%s.t%t'
(archivelog all delete input);
}
*******************************************************************************************
4. Create script and stroe in catalog db , and use store scripts to backup.
4.1. Create script example:
allocate channel d1 type disk;
backup incremental level=0 filesperset 3 format '/u01/app/oracle/oradata/oralin/backup/%d.s%s.t%t.L0'
( database include current controlfile);
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup filesperset 3 format '/u01/app/oracle/oradata/oralin/backup/ARCH.%d.s%s.t%t'
(archivelog all delete input);
}
4.2. Execute script example:
*******************************************************************************************
5. Restore all datafile include control file and imcomplete recovery database.
5.1 Connect target and catalog DB.
5.2 Startup nomount target DB.
5.3 restore target DB's control files.
5.4 Startup mount Target DB
5.5. Restore target data files and auto-recovery database.
RMAN> recover database;
RMAN> exit
5.6 Incomplete recovery and open database resset logs.
SQL> recover database using backup controlfile until cancel;
SQL> alter database open resetlogs;
5.7. If using a recovery catalog , register the new incarnation of the database:
*******************************************************************************************
6. Restore a database to a previous incarnation.
6.1 List the incarnation of database:
6.2 Start the instance in the NOMOUNT state:
6.3 Reset the database to the previous incarnation.
6.4 Restore the control file from the previous incarnation.
6.5 Mount the database.
6.6 Restore the database.
6.7 Recover the database.
RMAN>exit;
6.8 Incomplete recovery and open database resset logs.
SQL> recover database using backup controlfile until cancel;
SQL> alter database open resetlogs;
6.9 If using a recovery catalog , register the new incarnation of the database: