oracle11g RMAN catalog的基本使用

编辑

/etc/hosts文件

tnsnames.ora文件


创建
SQL> create tablespace ts_rman_catalog datafile '/u01/app/oracle/oradata/elon/data_rman_catalog1.dbf' size 5G autoextend on;
SQL>  select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/elon/system01.dbf
/u01/app/oracle/oradata/elon/sysaux01.dbf
/u01/app/oracle/oradata/elon/undotbs01.dbf
/u01/app/oracle/oradata/elon/users01.dbf
/u01/app/oracle/oradata/elon/data_rman_catalog1.dbf
SQL> create user rman_cat identified by "rman_cat" DEFAULT TABLESPACE ts_rman_catalog;
User created.
SQL> create temporary tablespace temp_rman_catalog tempfile '/u01/app/oracle/oradata/elon/temp_rman_catalog1.dbf' size 5G autoextend on;
Tablespace created.
SQL>  alter user rman_cat temporary tablespace temp_rman_catalog ;
User altered.
SQL> GRANT connect,resource,recovery_catalog_owner TO rman_cat;
Grant succeeded.
在目标库orcl1授权;

SQL> grant RECOVERY_CATALOG_OWNER to RMAN_CAT;

Grant succeeded.

SQL> grant unlimited tablespace to RMAN_CAT;

Grant succeeded.

SQL> grant connect,resource,create session to RMAN_CAT;

Grant succeeded.

在catalog库服务器连接target库orcl1
[oracle@8202-oem admin]$ rman catalog rman_cat/rman_cat@elon target elon/rman_cat@orcl1
创建catalog
RMAN> create catalog;
RMAN> upgrade catalog;

recovery catalog owner is RMAN_CAT
enter UPGRADE CATALOG command again to confirm catalog upgrade

RMAN> upgrade catalog;

recovery catalog upgraded to version 11.02.00.04
DBMS_RCVMAN package upgraded to version 11.02.00.04
DBMS_RCVCAT package upgraded to version 11.02.00.04

注册orcl1库
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
同步catalog和控制文件
RMAN> resync catalog;


在目标库orcl2授权

SQL> grant RECOVERY_CATALOG_OWNER to RMAN_CAT;

Grant succeeded.

SQL> grant unlimited tablespace to RMAN_CAT;

Grant succeeded.

SQL> grant connect,resource,create session to RMAN_CAT;

Grant succeeded.


然后注册第二台数据库
catalog库:rman catalog rman_cat/rman_cat@elon target elon/rman_cat@orcl2

RMAN> register database;

RMAN> list backup;

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       2       ORCL1     1539306881       CURRENT 1          21-JUN-19
2301    2317    ORCL1     1543986452       PARENT  1          24-AUG-13
2301    2302    ORCL1     1543986452       CURRENT 925702     13-AUG-19
1841    1853    ORCL2     3097378921       PARENT  1          24-AUG-13
1841    1854    ORCL2     3097378921       PARENT  925702     12-JUN-19
1841    1842    ORCL2     3097378921       CURRENT 1058098    13-JUN-19
RMAN>  list backup summary;


RMAN>  crosscheck copy;
RMAN> list backup by file;

11.其它
RMAN> list backupset;
RMAN> crosscheck backupset;
RMAN> validate backupset 1322;
RMAN> change backupset 1322

另外:
    rman catalog,撤消目标数据库注册
    步骤一:获取数据库的DBID
  SQL>select dbid from v$database;
  DBID
  -----------
  2539725638  
  步骤二:连接拥有恢复目录的模式(rman_cat用户),确定恢复目录中该数据库的DB_KEY
  SQL>select db_key from db where db_id=2539725638
  DB_KEY
  -----------
  1  
  步骤三:(rman_cat用户)使用dbms_rcvcat.unregisterdatabase过程从恢复目录中撤消数据库的注册
  exec dbms_rcvcat.unregisterdatabase(1,2539725638)


参考博客:

http://blog.sina.com.cn/s/blog_14b674edd0102xxb9.html

posted on 2019-09-04 14:16  HelonTian  阅读(876)  评论(0编辑  收藏  举报