当前位置:  数据库>oracle

RMAN catalog 的创建和使用

    来源: 互联网  发布时间:2017-05-25

    本文导语: --========================== -- RMAN catalog 的创建和使用 --==========================   一、创建恢复目录 创建恢复目录一般分为三大步骤 创建存放恢复目录的数据库(或使用已存在的数据库) 创建恢复目录的的所有者 创建恢复目录   创建数...

--==========================

-- RMAN catalog 的创建和使用

--==========================

 

一、创建恢复目录

创建恢复目录一般分为三大步骤

创建存放恢复目录的数据库(或使用已存在的数据库)

创建恢复目录的的所有者

创建恢复目录

 

创建数据库可以参考:Oralce 10g 使用DBCA创建数据库

 

在存储恢复目录的数据库创建表空间用于存储恢复目录schema及恢复目录数据(本文使用已经创建好的数据库catadb来存储恢复目录)

 

SQL> create tablespace tbs_rman datafile '/u01/app/Oracle/oradata/catadb/tbs_rman01.dbf'--创建rman恢复目录表空间

2size 200m autoextend on;

 

SQL> create user rman identified by rman--创建rman schema

2temporary tablespace temp

3default tablespace tbs_rman

4quota unlimited on tbs_rman;

 

SQL> grant recovery_catalog_owner to rman;--角色授予

 

SQL> conn rman/rman

 

SQL> select * from session_privs;

 

PRIVILEGE

----------------------------------------

CREATE SESSION

ALTER SESSION

CREATE TABLE

CREATE CLUSTER

CREATE SYNONYM

CREATE VIEW

CREATE SEQUENCE

CREATE DATABASE LINK

CREATE PROCEDURE

CREATE TRIGGER

CREATE TYPE

SQL> select * from session_roles;

 

ROLE

------------------------------

RECOVERY_CATALOG_OWNER

 

RMAN> connect catalog rman/rman@catadb--连接到恢复目录

 

connected to recovery catalog database

 

RMAN> create catalog tablespace tbs_rman;--创建恢复目录

 

recovery catalog created

 

[oracle@oradb ~]$ rman target sys/RedHat@orcl catalog rman/rman@catadb--连接到目标数据库及恢复目录

 

connected to target database: ORCL (DBID=1260850162)

connected to recovery catalog database

 

RMAN> register database;--将目标数据库注册到恢复目录

 

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

 

二、基于恢复目录的备份

 

1.查看相关信息

RMAN> list incarnation;

 

List of Database Incarnations

DB KeyInc Key DB NameDB IDSTATUSReset SCNReset Time

------- ------- -------- ---------------- --- ---------- ----------

18ORCL1260850162PARENT130-JUN-05

12ORCL1260850162CURRENT 44607522-OCT-10

 

----------------------------------------------------------------------------------------------------

 

RMAN> crosscheck copy;--校验copy

RMAN> delete expired copy;--删除过期的copy

 

2.全备

RMAN> run{

2> allocate channel ch1 device type disk;

3>backup as compressed backupset

4> database plus archivelog delete input

5> format='/u01/app/oracle/bk/rmbk/Whole_%d_%U'

6>tag='Whole_bak';

7> release channel ch1;}

 

3.增量备份(0级)

RMAN> run{

2> allocate channel ch1 device type disk;

3> allocate channel ch2 device type disk;

4> backup as compressed backupset

5> incremental level 0

6> database plus archivelog delete input

7> format='/u01/app/oracle/bk/rmbk/Inc_0_%d_%U'

8> tag='Inc_0';

9> release channel ch1;

10> release channel ch2;}

 

RMAN> list backup summary;

 

4.增量备份(1级)

RMAN> run{

2> allocate channel ch1 device type disk;

3> allocate channel ch2 device type disk;

4> backup as compressed backupset

5> incremental level 1 database

6> format='/u01/app/oracle/bk/rmbk/Inc_1_%d_%U'

7> tag='Inc_1';

8> release channel ch1;

9> release channel ch2;}

 

RMAN> list backup by file;

 

5.累计增量备份(1级)

RMAN> run{

2> allocate channel ch1 device type disk;

3> backup as compressed backupset

4> incremental level 1 cumulative database

5> format '/u01/app/oracle/bk/rmbk/Cum_1_%d_%U'

6> tag='Cum_1';

7> release channel ch1;}

 

6.备份表空间

RMAN> run{

2> allocate channel ch1 device type disk;

3> backup as compressed backupset

4> tablespace users,example

5> format='/u01/app/oracle/bk/rmbk/tbs_%d_%U'

6> tag='tbs';

 

RMAN> list backupset tag=tbs;

 

7.备份数据文件

RMAN> run{

2> allocate channel ch1 device type disk;

3> backup as compressed backupset

4> datafile 3

5> format='/u01/app/oracle/bk/rmbk/df_%d_%U'

6> tag='df';

7> release channel ch1;}

 

8.备份归档日志

备份归档日志前,建议先使用crosscheck校验一下

crosscheck通常用于检查备份是否被删除,如果删除将会打上删除标签

RMAN> crosscheck archivelog all;

 

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=148 devtype=DISK

validation succeeded for archived log

archive log filename=/u01/app/oracle/oradata/orcl/arch/log_1_117_733069427.arc recid=111 stamp=733171369

Crosschecked 1 objects

 

RMAN> sql 'alter system switch logfile';

 

sql statement: alter system switch logfile

 

RMAN> sql 'alter system switch logfile';

 

sql statement: alter system switch logfile

 

RMAN> list archivelog all;

 

List of Archived Log Copies

KeyThrd SeqS Low TimeName

------- ---- ------- - --------- ----

4651117A 22-OCT-10 /u01/app/oracle/oradata/orcl/arch/log_1_117_733069427.arc

5531118A 23-OCT-10 /u01/app/oracle/oradata/orcl/arch/log_1_118_733069427.arc

5691119A 23-OCT-10 /u01/app/oracle/oradata/orcl/arch/log_1_119_733069427.arc

 

9.基于SCN来备份归档日志

RMAN> run{

2> allocate channel ch1 device type disk;

3> backup as compressed backupset

4> archivelog from scn 848043

5> format='/u01/app/oracle/bk/rmbk/arc_%d_%U'

6> tag='arc';

7> release channel ch1;

8> }

 

10.镜像备份

RMAN> run{

2> allocate channel ch1 device type disk;

3> backup as copy datafile 1,4

4> format '/u01/app/oracle/bk/rmbk/df_%d_%U'

5> tag 'copybak';

6> release channel ch1;}

 

11.其它

RMAN> crosscheck backupset;

 

RMAN> change backupset 1

 

RMAN> validate backupset

 

RMAN> validate backupset 635;

 

12.基于catalog的数据库恢复请参考:基于catalog 的RMAN 备份与恢复


    
 
 

您可能感兴趣的文章:

  • catalog方式的rman备份与恢复示例
  •  
    本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
    本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • rman备份脚本和rman增量备份脚本分享
  • Oracle数据库备份和恢复工具 RMan
  • rman配置及rman常用命令操作
  • win平台oracle rman备份和删除dg备库归档日志脚本
  • linux自动运行rman增量备份脚本
  • 9i下RMAN的备份及恢复步骤
  • Oracle相关:Rman Crosscheck删除失效归档
  • ORACLE 数据库RMAN备份恢复
  • rman恢复方案和oracle异机恢复
  • Oracle RMAN快速入门指南


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,