RMAN Recovery Catalog

RMAN用来存放数据库元数据的schema。

the catalog includes the following types of metadata:
-Data file and archived redo log backup sets and backup pieces
-Data file copies
-Archived redo logs and their copies
-Database structure (tablespaces and datafiles)
-Stored scripts, which are named user-created sequences of RMAN commands
-Persistent RMAN configuration settings

创建Recovery Catalog

1.配置Recovery Catalog数据库

2.创建Recovery Catalog的属主

不可以让sys用户成为Recovery Catalog的属主。

SQL> create user rman identified by password
  temporary tablespace temp
  default tablespace tools
  quota unlimited on tools;
SQL> grant recovery_catalog_owner to rman;

3.执行create catalog命令

从rman客户端登陆到catalog所在的数据库

RMAN> connect catalog rman/[email protected]
RMAN> create catalog tablespace cat_tbs;

验证一下:

SQL> select table_name from user_tables;

注册数据库到Recovery Catalog

$ rman target / catalog rman/[email protected]

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Sep 21 09:10:48 2015

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

connected to target database: DB11 (DBID=1422808181)
connected to recovery catalog database

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 DB11

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               YES     /u11/app/oracle/oradata/db11/system01.dbf
2    520      SYSAUX               NO      /u11/app/oracle/oradata/db11/sysaux01.dbf
3    110      UNDOTBS1             YES     /u11/app/oracle/oradata/db11/undotbs01.dbf
4    5        USERS                NO      /u11/app/oracle/oradata/db11/users01.dbf
5    313      EXAMPLE              NO      /u11/app/oracle/oradata/db11/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    29       TEMP                 32767       /u11/app/oracle/oradata/db11/temp01.dbf

向Recovery Catalog中注册备份集

RMAN> catalog datafilecopy ‘/disk1/old_datafiles/01_01_2003/users01.dbf‘;
RMAN> catalog archivelog ‘/disk1/arch_logs/archive1_731.dbf‘, ‘/disk1/arch_logs/archive1_732.dbf‘;
RMAN> catalog backuppiece ‘/disk1/backups/backup_820.bkp‘;

也可以将备份文件放到一个目录下,将整个目录注册进去:

RMAN> catalog start with ‘/disk1/backups/‘;

下面两个语法是不同的:

RMAN> CATALOG START WITH ‘/disk1/backups‘;           #任何以backups开头的目录都被注册进去
RMAN> CATALOG START WITH ‘/disk1/backups/‘;         #只是注册backups目录

创建和管理Virtual Private Catalogs

recovery catalog的拥有者是catowner
注册的数据库有:prod1、prod2、prod3
创建数据库用户vpc1,并被授予访问prod1、prod2

1.创建数据库用户(VPC的拥有者)并授权

    登陆到recovery catalog所在的数据库
    SQL> create user vpc1 identified by vpc1 default tablespace vpcusers quota unlimited on vpcusers;
    SQL> grant recovery_catalog_owner to vpc1;
    SQL> exit;

    以base recovery catalog用户身份rman登陆到recovery catalog所在的数据库
    $ rman
    RMAN> connect catalog [email protected];
    RMAN> grant catalog for database prod1 to vpc1;
    RMAN> grant catalog for database prod2 to vpc1;
    RMAN> grant register database to vpc1;

2.创建VPC

    $ rman
    RMAN> connect catalog [email protected];
    RMAN> create virtual catalog;

3.收回Virtual Private Catalog Owner的权限

    以base recovery catalog用户身份rman登陆到recovery catalog所在的数据库
    $ rman
    RMAN> connect catalog [email protected];
    RMAN> revoke catalog for database prod1 from vpc1;
    RMAN> revoke register database from vpc1;

4.删除Virtual Private Catalog

    $ rman
    RMAN> connect catalog [email protected];
    RMAN> drop catalog;

Stored Scripts
Stored Scripts有两种:本地的、全局的

创建Stored Scripts
本地stored scripts:

RMAN> create script full_backup{
        backup database plus archivelog;
        delete obsolete;
    }

全局stored scripts:

RMAN> create global script global_full_backup
    comment ‘use only with archivelog mode databases‘
    {
        backup database plus archivelog;
        delete obsolete;
    }

从其他文件读取创建stored scripts:

RMAN> create script full_backup
    from file ‘/tmp/my_script_file.txt‘;

更新stored scripts

使用关键字replace:

RMAN> replace script full_backup {
        backup database plus archivelog;
    }

运行stored scripts

RMAN> run {
        execute global script global_full_backup;
    }

RMAN> run {
        execute script full_backup;
    }

打印stored scripts
使用关键字print scripts

RMAN> print script full_backup;
时间: 2024-10-08 15:29:15

RMAN Recovery Catalog的相关文章

【oracle】oracledba28 open a connection to the RMAN recovery catalog, which contains the RMAN metada

You executed the following command in Recovery Manager (RMAN): RMAN> RESTORE CONTROLFILE; Which operation must you perform before this command is executed? A. back up the control file to trace B. bring database to the MOUNT state C. open a connection

11g rman 配置catalog

1.官方文档 https://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmcatdb.htm#BRADV89656 2.配置步骤如下 --创建表空间 create tablespace catalog datafile size 2G; SQL> create tablespace catalog datafile size 2G; Tablespace created. SQL> --创建用户 CREATE USER rman IDEN

Oracle网络公开课《让我们捧起2014备份与恢复的世界之杯-再叙Recovery Catalog》

世界杯是全球各个国家在足球领域最梦寐以求的神圣荣耀,哪一支国家足球队能得到冠军,就是名正言顺的世界第一,整个世界都会为之疯狂沸腾.世界杯上发挥出色的球员都会被该国家奉为民族英雄永载史册,所以它亦代表了各个足球运动员的终极梦想. 玩转恢复目录,也是每个备份管理员的顶级追求,通过使用恢复目录可以将许多还原和恢复过程简化,从而缩短还原和恢复的时间.让我们一起轻松搞定所有数据库的备份信息的守候.监控和报告,一起来享受世界杯的比赛. 小贴士:世界杯(FIFA World Cup)即国际足联世界杯,是世界上

RMAN恢复目录

是否使用RMAN恢复目录(Recovery Catalog 你可能从其他人或书上听过RMAN恢复目录(也有可能是其他名字,RMAN Recovery Catalog的翻译较多较杂,以下简称恢复目录),旁人的表达或书中模糊不清的描述,导致很多朋友一直对其实际意义和作用感到疑惑.在我看来,可以将其视作存储RMAN备份恢复相关信息的数据库(在物理形式上可以对应成Oracle中的一个SCHEMA). 当没有恢复目录时,RMAN相关的备份信息,比如归档文件路径.备份集路径等均存储在目标数据库的控制文件中,

官方文档 恢复备份指南四 Starting and Interacting with the RMAN Client

本章讲: Starting and Exiting RMAN Specifying the Location of RMAN Output                                                        指定RMAN输出位置 Setting Globalization Support Environment Variables for RMAN            设置RMAN全局变量 Entering RMAN Commands         

OCP读书笔记(24) - 题库(ExamD)

301.Which command is used to configure RMAN to perform a compressed backup for every backupexecuted?A. BACKUP AS COMPRESSED BACKUPSET DATABASEB. BACKUP AS COMPRESSED COPY OF DATABASEC. CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSETD.

053(六十一)

301. 301.Which command is used to configure RMAN to perform a compressed backup for every backup executed? A. BACKUP AS COMPRESSED BACKUPSET DATABASE B. BACKUP AS COMPRESSED COPY OF DATABASE C. CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BAC

053(二十三)

111. 111.Which three statements are true regarding persistent lightweight jobs? (Choose three.) A. Persistent lightweight jobs modify several tables in the data dictionary to generate a lot of redo. B. The user cannot set privileges on persistent lig

OCP读书笔记(22) - 题库(ExamB)

101.Identify two situations in which you can use Data Recovery Advisor for recovery. (Choose two.) A. The user has dropped an important table that needs to be recovered. B. The database files are corrupted when the database is open. C. You are not ab