博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
RMAN Recovery Catalog
阅读量:6481 次
发布时间:2019-06-23

本文共 4438 字,大约阅读时间需要 14 分钟。

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/oracle@catdbRMAN> create catalog tablespace cat_tbs;

验证一下:

SQL> select table_name from user_tables;

 

注册数据库到Recovery Catalog

$ rman target / catalog rman/oracle@catdbRecovery Manager: Release 11.2.0.4.0 - Production on Mon Sep 21 09:10:48 2015Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.connected to target database: DB11 (DBID=1422808181)connected to recovery catalog databaseRMAN> register database;database registered in recovery catalogstarting full resync of recovery catalogfull resync completeRMAN> report schema;Report of database schema for database with db_unique_name DB11List of Permanent Datafiles===========================File Size(MB) Tablespace           RB segs Datafile Name---- -------- -------------------- ------- ------------------------1    750      SYSTEM               YES     /u11/app/oracle/oradata/db11/system01.dbf2    520      SYSAUX               NO      /u11/app/oracle/oradata/db11/sysaux01.dbf3    110      UNDOTBS1             YES     /u11/app/oracle/oradata/db11/undotbs01.dbf4    5        USERS                NO      /u11/app/oracle/oradata/db11/users01.dbf5    313      EXAMPLE              NO      /u11/app/oracle/oradata/db11/example01.dbfList 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 catowner@catdb;    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 vpc1@catdb;    RMAN> create virtual catalog;

3.收回Virtual Private Catalog Owner的权限

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

4.删除Virtual Private Catalog

$ rman    RMAN> connect catalog vpc1@catdb;    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;

 

转载地址:http://kdfuo.baihongyu.com/

你可能感兴趣的文章
兼容几乎所有浏览器的透明背景效果
查看>>
Linux VNC server的安装及简单配置使用
查看>>
阿里宣布开源Weex ,亿级应用匠心打造跨平台移动开发工具
查看>>
Android项目——实现时间线程源码
查看>>
招商银行信用卡重要通知:消费提醒服务调整,300元以下消费不再逐笔发送短信...
查看>>
C#_delegate - 调用列表
查看>>
[转]Windows的批处理脚本
查看>>
数据库运维体系_SZMSD
查看>>
js的AJAX请求有关知识总结
查看>>
三分 POJ 2420 A Star not a Tree?
查看>>
修改OBS为仅直播音频
查看>>
OCA读书笔记(3) - 使用DBCA创建Oracle数据库
查看>>
Python基础进阶之路(一)之运算符和输入输出
查看>>
阻塞非阻塞异步同步 io的关系
查看>>
ClickStat业务
查看>>
spring3.0.7中各个jar包的作用总结
查看>>
Windows 10 /win10 上使用GIT慢的问题,或者命令行反应慢的问题
查看>>
Windows平台分布式架构实践 - 负载均衡
查看>>
iOS自定制tabbar与系统的tabbar冲突,造成第一次点击各个item图片更换选中,第二次选中部分item图片不改变...
查看>>
我的路上
查看>>