The schema that Rman uses to store database metadata.
The catalog includes the following types of metadata:
-data file and archived redo log backup sets and backup pieces
-data file copies
-archived redo logs and their copies
-database structure (tablespaces and datafiles)
-stored scripts, which is named user-created sequences of RMAN commands
-persistent RMAN configuration settings
Create Recovery Catalog
1. Configuring the Recovery Catalog Database
2. Create the owner of the recovery catalog
It is not possible to make the SYS user the owner of the recovery catalog.
sql> Create user Rman identified by password temporary tablespace temp default Tablespace Tools quota unlimited on tools; SQL> Grant Recovery_catalog_owner to Rman;
3. Execute the Create catalog command
Log in to the database where the catalog resides from the Rman client
Rman> Connect Catalog rman/[email protected]rman> Create catalog tablespace cat_tbs;
Verify that:
Select from User_tables;
Register database to recovery Catalog
$ Rman Target/catalog rman/[email protected]recovery manager:release11.2.0.4.0-Production on Mon Sep + the:Ten: - -Copyright (c)1982, ., Oracle and/or its affiliates. All rights reserved.connected to target DATABASE:DB11 (DBID=1422808181) connected to recovery catalog Databaserman>Register Database;database Registeredinchrecovery catalogstarting Full resync of recovery catalogfull Resync Completerman>Report schema; Report of the database schema fordatabase with Db_unique_name db11list of Permanent datafiles===========================File Size (MB) tablespace RB segs datafile Name---- -------- -------------------- ------- ------------------------1 -SYSTEM yes/u11/app/oracle/oradata/db11/system01.dbf2 520Sysaux no/u11/app/oracle/oradata/db11/sysaux01.dbf3 theUNDOTBS1 yes/u11/app/oracle/oradata/db11/undotbs01.dbf4 5USERS no/u11/app/oracle/oradata/db11/users01.dbf5 313EXAMPLE no/u11/app/oracle/oradata/db11/example01.dbflist of temporary Files=======================File Size (MB) tablespace Maxsize (MB) tempfile Name---- -------- -------------------- ----------- --------------------1 inTEMP32767/u11/app/oracle/oradata/db11/temp01.dbf
Registering a backup set with the recovery catalog
' /disk1/old_datafiles/01_01_2003/users01.dbf ' ; RMAN'/disk1/arch_logs/archive1_731.dbf'/disk1/arch_logs/archive1 _732.DBF'; RMAN'/disk1/backups/backup_820.bkp';
You can also place the backup file in a directory and register the entire directory:
' /disk1/backups/ ';
The following two syntaxes are different:
' /disk1/backups ' ; #任何以backups开头的目录都被注册进去RMAN'/disk1/backups/'; #只是注册backups目录
Create and manage virtual Private catalogs
Recovery catalog is owned by Catowner
The registered databases are: PROD1, PROD2, prod3
Create database user VPC1 and be granted access to PROD1, prod2
1. Create a database user (the owner of the VPC) and authorize
Log in to the database where recovery catalog is located SQLdefault tablespace vpcusers Quota Unlimited on vpcusers; SQL> grant Recovery_catalog_owner to VPC1; SQL> exit; As base recovery catalog user, Rman logs in to the database where recovery catalog is located. rman Rman> Connect Catalog [email protected]; RMAN for database prod1 to VPC1; RMAN for database prod2 to VPC1; RMAN> Grant Register database to VPC1;
2. Create a VPC
$ rman rman> Connect Catalog [email protected]; RMANvirtual catalog;
3. Recover permissions for virtual Private Catalog owner
as base recovery catalog user, Rman logs in to the database where recovery catalog is located. rman Rman> Connect Catalog [ email protected]; RMAN for from VPC1; RMAN from VPC1;
4. Delete Virtual Private Catalog
$ rman rman> Connect Catalog [email protected]; RMAN> Drop catalog;
Stored Scripts
There are two types of Stored scripts: local, Global
Create stored Scripts
Local stored scripts:
rman> Create script full_backup{ backup database plus archivelog; Delete obsolete; }
Global stored scripts:
Global Script Global_full_backup ' With archivelog mode databases ' { backup database plus archivelog; Delete obsolete; }
Read from other files create stored scripts:
rman> Create script full_backup from'/tmp/my_script_file.txt' ;
Update stored scripts
Use the keyword replace:
rman> Replace script full_backup { backup database plus archivelog; }
Run stored scripts
Rman> Run { global script global_full_backup; } RMAN> Run { execute script full_backup; }
Print stored Scripts
Use the keyword print scripts
rman> Print Script full_backup;
RMAN Recovery Catalog