暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 如何使用catalog

oracleEDU 2017-09-05
2263

Catalog Additional Files

1. Add backup pieces and image copies on disk to the RMAN repository。把RMAN不知道的备份信息加入到RMAN


2. Record a data file copy as a level 0 incremental backup in the RMAN repository, which enables you to use it as part of an incremental backup strategy。你的文件拷贝作为0级别增量备份 ,加入到RMAN列表


catalog目录需要专门创建一个用于恢复的数据库

1. 创建表空间

    

SQL> create tablespace rman datafile '+data' size 50M extent management local uniform size 128K;

2. 创建用户

SQL> create user rman identified by rman default tablespace rman temporary tablespace temp quota unlimited on rman;

User created.

3. 授权

SQL> grant connect,resource,recovery_catalog_owner to rman;

Grant succeeded.

4. 创建恢复目录

$ rman catalog rman/rman

connected to recovery catalog database

RMAN> create catalog;

recovery catalog created

5. 注册需要备份的数据库

    注册数据库需要同时连接到目标(target)数据库和目录(catalog)数据库

[oracle@oracleEDU ~]$ rman catalog rman/rman target sys/orcl

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Sep 3 00:20:16 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1479315187)

connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

6. 注销已注册的数据库

RMAN>unregister database;

7. 使用catalog数据库对目标数据库进行备份

RMAN> create script fullback{ 

backup full tag 'sys' database 

include current controlfile format '+fra'

 plus archivelog format '+fra' 

delete all input;

}

created script fullback

RMAN>run{execute script fullbk;}  #调用脚本

删除脚本:

RMAN>delete script fullbk;

查看备份信息:

RMAN> list backupset;

List of Backup Sets

===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

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

94      Full    9.36M      DISK        00:00:04     03-SEP-17      

        BP Key: 97   Status: AVAILABLE  Compressed: NO  Tag: SYS

        Piece Name: +FRA/orcl/backupset/2017_09_03/ncsnf0_sys_0.353.953686751

  SPFILE Included: Modification time: 03-SEP-17

  SPFILE db_unique_name: ORCL

  Control File Included: Ckp SCN: 1145820      Ckp time: 03-SEP-17

把RMAN信息加入到catalog:

RMAN> catalog recovery area;

searching for all files in the recovery area

List of Files Unknown to the Database

=====================================

File Name: +fra/ORCL/ARCHIVELOG/2017_08_09/thread_1_seq_54.367.951532267

File Name: +fra/ORCL/ARCHIVELOG/2017_08_08/thread_1_seq_53.366.951456471

File Name: +fra/ORCL/ARCHIVELOG/2017_08_02/thread_1_seq_28.320.950954531

File Name: +fra/ORCL/ARCHIVELOG/2017_08_02/thread_1_seq_29.332.950954531

File Name: +fra/ORCL/ARCHIVELOG/2017_08_02/thread_1_seq_32.365.950956275

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: +fra/ORCL/ARCHIVELOG/2017_08_09/thread_1_seq_54.367.951532267

File Name: +fra/ORCL/ARCHIVELOG/2017_08_08/thread_1_seq_53.366.951456471

File Name: +fra/ORCL/ARCHIVELOG/2017_08_02/thread_1_seq_28.320.950954531

File Name: +fra/ORCL/ARCHIVELOG/2017_08_02/thread_1_seq_29.332.950954531

File Name: +fra/ORCL/ARCHIVELOG/2017_08_02/thread_1_seq_32.365.950956275

List of files in Recovery Area not managed by the database

==========================================================

File Name: +FRA/orcl/backupset/2017_09_03/ncsnf0_sys_0.353.953686751

  RMAN-07527: Reason: File was not created using DB_RECOVERY_FILE_DEST initialization parameter

number of files not managed by recovery area is 1, totaling 9.36MB

RMAN> list backup summary;

List of Backups

===============

Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag

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

94      B  F  A DISK        03-SEP-17       1       1       NO         SYS

143     B  F  A DISK        03-SEP-17       1       1       NO         TAG20170903T011046

144     B  F  A DISK        03-SEP-17       1       1       NO         TAG20170903T011101

建议:以后把备份集存储快速恢复区 (集中管理,直接用catalog RECOVERY AREA; 重新加入RMAN) 

手工备份,把备份加入到RMAN列表;

手工备份:

SQL> alter tablespace users begin backup;

$ su - grid

$ asmcmd

cp +data/orcl/datafile/USERS.263.951533911 u01/app/oracle/user.back

SQL> alter tablespace users end backup;

RMAN不知道手工备份:

RMAN> list copy of datafile 4;

specification does not match any datafile copy in the repository

加入到catalog(作为0级增量备份)

RMAN> catalog datafilecopy '/u01/app/oracle/user.back' level 0;

cataloged datafile copy

datafile copy file name=/u01/app/oracle/user.back RECID=3 STAMP=953688662

查看加入RMAN的手工备份:

RMAN> list copy of datafile 4;

List of Datafile Copies

=======================

Key     File S Completion Time Ckp SCN    Ckp Time       

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

3       4    A 03-SEP-17       1147256    03-SEP-17      

        Name: u01/app/oracle/user.back

参考手册:Backup and Recovery Reference



最后修改时间:2021-04-28 19:57:48
文章转载自oracleEDU,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论