RMAN Recovery Catalog的作用
RMAN Recovery catalog 是一个用于存放 RMAN 元数据的 schema。有以下作用:
作为control file保存rman元数据的一个冗余副本;
集中管理rman元数据;
保存周期比control file长;
一些特性,如:rman脚本只能保存在recovery catalog 中;
创建Recovery Catalog
在catalog服务器上创建schema
SQL> create tablespace tools datafile '/u01/app/oracle/oradata/orcl/tools.dbf' size 10m autoextend on maxsize unlimited; Tablespace created. SQL> CREATE USER rco IDENTIFIED BY dingjia TEMPORARY TABLESPACE temp DEFAULT TABLESPACE tools QUOTA UNLIMITED ON tools; User created. SQL> GRANT RECOVERY_CATALOG_OWNER TO rco; Grant succeeded.
使用rman登录,创建catalog
$ rman catalog rco/dingjia RMAN> create catalog; recovery catalog created RMAN>
DataGuard 注册到 Recovery Catalog
连接到RMAN Recovery Catalog进行注册,注意:Recovery Catalog所在的数据库的版本要比被注册的数据库版本高。
这两个版本差0.0.1也不行,而下面这个Recovery Catalog的Oracle版本比比被注册的数据库版本高则可以。
[oracle@dg121-1 ~]$ rman target / catalog rco/dingjia@192.168.17.201/test1 Recovery Manager: Release 12.1.0.2.0 - Production on Wed Sep 2 19:36:02 2020 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1461820645) connected to recovery catalog database recovery catalog schema release 12.02.00.01. is newer than RMAN release RMAN> register database; database registered in recovery catalog starting full resync of recovery catalog full resync complete RMAN> report schema; Report of database schema for database with db_unique_name ORCL List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 810 SYSTEM YES /u01/app/oracle/oradata/orcl/system01.dbf 3 990 SYSAUX NO /u01/app/oracle/oradata/orcl/sysaux01.dbf 4 165 UNDOTBS1 YES /u01/app/oracle/oradata/orcl/undotbs01.dbf 5 250 PDB$SEED:SYSTEM NO /u01/app/oracle/oradata/orcl/pdbseed/system01.dbf 6 5 USERS NO /u01/app/oracle/oradata/orcl/users01.dbf 7 490 PDB$SEED:SYSAUX NO /u01/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf 8 260 PDBORCL:SYSTEM NO /u01/app/oracle/oradata/orcl/pdborcl/system01.dbf 9 530 PDBORCL:SYSAUX NO /u01/app/oracle/oradata/orcl/pdborcl/sysaux01.dbf 10 5 PDBORCL:USERS NO /u01/app/oracle/oradata/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf 11 1243 PDBORCL:EXAMPLE NO /u01/app/oracle/oradata/orcl/pdborcl/example01.dbf 12 6195 PDBORCL:SOE NO /u01/app/oracle/oradata/orcl/pdborcl/soe01 13 1 EX1 NO /u01/app/oracle/oradata/orcl/ex1.dbf 14 100 SOE NO /u01/app/oracle/oradata/orcl/soe.dbf List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 1 60 TEMP 32767 /u01/app/oracle/oradata/orcl/temp01.dbf 2 20 PDB$SEED:TEMP 32767 /u01/app/oracle/oradata/orcl/pdbseed/pdbseed_temp012017-01-23_03-32-32-PM.dbf 3 159 PDBORCL:TEMP 32767 /u01/app/oracle/oradata/orcl/pdborcl/pdborcl_temp012017-01-23_03-36-43-PM.dbf RMAN> list backup; specification does not match any backup in the repository RMAN> resync catalog; starting full resync of recovery catalog full resync complete RMAN>
然后用report schema检查一下,显示正常。
也可以手工执行一下resync catalog,虽然这通常是不必要的,通常会自动resync。
连接上recovery catalog后发现执行命令通常会慢一点,这是因为要到recovery catalog进行同步。
VPC(virtual private catalogs.)
通常在一个企业里面有同一个DBA来负责所有数据库的备份,这样就不存在需要将recovery catalog的权限进一步细分,但如果有这样的需求,Oracle从11G后提供了VPC(virtual private catalogs)来进行实现,实际上是采用 Virtual Private Database (VPD) 来实现 virtual private catalogs,具体可以查阅Oracle的文档。