catalog数据库的学习

恢复目录是位于数据库里的一个schema,该schema下包含多个表,视图以及存储过程。在恢复目录中存放RMAN的元数据,也就是说可以使用目标数 据库中的控制文件,将目标数据库的结构、归档日志文件、备份集以及镜像副本等信息插入到恢复目录中相关的表中,也叫做同步。
创建恢复目录:
单独创建一个数据库用来存放恢复目录,这里就放在apex实例名的数据库中。
export ORACLE_SID=apex
SQL>conn /as sysdba
SQL>create tablespce rman datafile '/u01/app/oracle/oradata/APEX/datafile/rman01.dbf' size 50m
extent management local uniform. size 128k;
SQL>create user rman identified by rman
default tablespace rman
temporary tablespace temp
quota unlimited on rman;
SQL>grant connect,resource,recovery_catalog_owner to rman;
SQL>select * from dba_sys_privs where grantee='RECOVERY_CATALOG_OWNER';
再起一个窗口,起动到orcl实例数据库中,通过以下方式连接到目录数据库并创建恢复目录:
[oracle@apex ~]$ rman  catalog rman/rman@apex
RMAN> create catalog;               

recovery catalog created

RMAN> quit
注册目标数据库
[oracle@apex ~]$ rman catalog rman/rman@apex target sys/oracle
connected to target database: ORCL (DBID=1241155926)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
查看目标数据库的标识符(DB_ID)和数据库键值(DB_KEY).
SQL> conn rman/rman
Connected.
SQL> select * from db;

DB_KEY      DB_ID HIGH_CONF_RECID LAST_KCCDIVTS HIGH_IC_RECID CURR_DBINC_KEY
---------- ---------- --------------- ------------- ------------- --------------
1 1241155926                     713375190             2              2

注销注册:
[oracle@apex ~]$ rman catalog rman/rman@apex target sys/oracle
RMAN>unregister database;
使用catalog数据库对目标数据库进行备份( 数据库必须归档模式)。
[oracle@apex ~]$ rman catalog rman/rman@apex target sys/oracle
RMAN> create script. fullbk{
2> backup full tag 'test' database
3> include current controlfile
4> format '/u01/app/oracle/fullbk/full_%d_%T_%s'
5> plus archivelog
6> format '/u01/app/oracle/fullbk/arch_%d_%T_%s'
7> delete all input;
8> }
RMAN> run {execute script. fullbk;}
更改和删除脚本
RMAN>replace script. fullbk{
2> backup full tag 'test' database
3> include current controlfile
4> format '/u01/app/oracle/fullbk/full_%d_%T_%s'
5> plus archivelog
6> format '/u01/app/oracle/fullbk/arch_%d_%T_%s'
7> delete all input;
8> }
RMAN>delete script. fullbk;
主要转摘eygle的《循序渐进oracle》

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23567090/viewspace-631033/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23567090/viewspace-631033/

你可能感兴趣的:(catalog数据库的学习)