rman管理4 CATALOG DB

catalog database 的功能

1)集中存放rman的资料库(备份的元数据),并且可以和target database 的controlfile同步

2)存放rman的备份脚本

catalog database 的配置

1)需要建立一个单独的database

SQL> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string catdb
db_unique_name string catdb
global_names boolean FALSE
instance_name string catdb
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string catdb
SQL>

2)建立存放rman 元数据的tablespace

SQL> create tablespace catalogtbs datafile '/u01/app/oracle/oradata/catdb/catalogtbs01.dbf' size 100m;

Tablespace created.

3)建立user,用于管理rman,并授权

SQL> create user rman identified by oracle default tablespace catalogtbs;

User created.

SQL>

SQL> grant connect, resource, recovery_catalog_owner to rman;

Grant succeeded.

4)启动listener ,链接catalog database

[[email protected] ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 03-JUL-2015 15:12:08

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora11g)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 03-JUL-2015 15:11:18
Uptime 0 days 0 hr. 0 min. 50 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/ora11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "catdb" has 1 instance(s).
Instance "catdb", status READY, has 1 handler(s) for this service...
Service "catdbXDB" has 1 instance(s).
Instance "catdb", status READY, has 1 handler(s) for this service...
Service "prod" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
Service "prodXDB" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
The command completed successfully
[[email protected] ~]$
[[email protected] admin]$ rman catalog [email protected]

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jul 3 16:38:30 2015

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

connected to recovery catalog database

RMAN> create catalog ; // 建立catalog 的对象

recovery catalog created

--------建立以下对象,存储rman 元数据
SQL> conn rman/oracle
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
AL TABLE
AL_V VIEW
BCB TABLE
BCB_V VIEW
BCF TABLE
BCF_V VIEW
BCR TABLE
BCR_V VIEW
BDF TABLE
BDF_V VIEW
BP TABLE

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BP_V VIEW
BRL TABLE
BRL_V VIEW
BS TABLE
BSF TABLE
BSF_V VIEW
BS_V VIEW
CCB TABLE
CCB_V VIEW
CCF TABLE
CCF_V VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
CDF TABLE
CDF_V VIEW
CFS TABLE
CFS_V VIEW
CKP TABLE
CKP_V VIEW
CONF TABLE
CONFIG TABLE
CONFIG_V VIEW
CONF_V VIEW
DB TABLE

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DBINC TABLE
DBINC_V VIEW
DB_V VIEW
DF TABLE
DF_V VIEW
FB TABLE
FB_V VIEW
GRSP TABLE
GRSP_V VIEW
NODE TABLE
NODE_V VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
NRSP TABLE
NRSP_V VIEW
OFFR TABLE
OFFR_V VIEW
ORL TABLE
ORL_V VIEW
RCVER TABLE
RCVER_V VIEW
RC_ARCHIVED_LOG VIEW
RC_BACKUP_ARCHIVELOG_DETAILS VIEW
RC_BACKUP_ARCHIVELOG_SUMMARY VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
RC_BACKUP_CONTROLFILE VIEW
RC_BACKUP_CONTROLFILE_DETAILS VIEW
RC_BACKUP_CONTROLFILE_SUMMARY VIEW
RC_BACKUP_COPY_DETAILS VIEW
RC_BACKUP_COPY_SUMMARY VIEW
RC_BACKUP_CORRUPTION VIEW
RC_BACKUP_DATAFILE VIEW
RC_BACKUP_DATAFILE_DETAILS VIEW
RC_BACKUP_DATAFILE_SUMMARY VIEW
RC_BACKUP_FILES VIEW
RC_BACKUP_PIECE VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
RC_BACKUP_PIECE_DETAILS VIEW
RC_BACKUP_REDOLOG VIEW
RC_BACKUP_SET VIEW
RC_BACKUP_SET_DETAILS VIEW
RC_BACKUP_SET_SUMMARY VIEW
RC_BACKUP_SPFILE VIEW
RC_BACKUP_SPFILE_DETAILS VIEW
RC_BACKUP_SPFILE_SUMMARY VIEW
RC_CHECKPOINT VIEW
RC_CONTROLFILE_COPY VIEW
RC_COPY_CORRUPTION VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
RC_DATABASE VIEW
RC_DATABASE_BLOCK_CORRUPTION VIEW
RC_DATABASE_INCARNATION VIEW
RC_DATAFILE VIEW
RC_DATAFILE_COPY VIEW
RC_LOG_HISTORY VIEW
RC_OFFLINE_RANGE VIEW
RC_PROXY_ARCHIVEDLOG VIEW
RC_PROXY_ARCHIVELOG_DETAILS VIEW
RC_PROXY_ARCHIVELOG_SUMMARY VIEW
RC_PROXY_CONTROLFILE VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
RC_PROXY_COPY_DETAILS VIEW
RC_PROXY_COPY_SUMMARY VIEW
RC_PROXY_DATAFILE VIEW
RC_REDO_LOG VIEW
RC_REDO_THREAD VIEW
RC_RESTORE_POINT VIEW
RC_RESYNC VIEW
RC_RMAN_BACKUP_JOB_DETAILS VIEW
RC_RMAN_BACKUP_SUBJOB_DETAILS VIEW
RC_RMAN_BACKUP_TYPE VIEW
RC_RMAN_CONFIGURATION VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
RC_RMAN_OUTPUT VIEW
RC_RMAN_STATUS VIEW
RC_SITE VIEW
RC_STORED_SCRIPT VIEW
RC_STORED_SCRIPT_LINE VIEW
RC_TABLESPACE VIEW
RC_TEMPFILE VIEW
RC_UNUSABLE_BACKUPFILE_DETAILS VIEW
RLH TABLE
RLH_V VIEW
ROUT TABLE

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
ROUT_V VIEW
RR TABLE
RR_V VIEW
RSR TABLE
RSR_V VIEW
RT TABLE
RT_V VIEW
SCR TABLE
SCRL TABLE
SCRL_V VIEW
SCR_V VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
SITE_DFATT TABLE
SITE_DFATT_V VIEW
SITE_TFATT TABLE
SITE_TFATT_V VIEW
TEMPRES TABLE
TF TABLE
TF_V VIEW
TS TABLE
TSATT TABLE
TSATT_V VIEW
TS_V VIEW

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
VPC_DATABASES TABLE
VPC_DATABASES_V VIEW
VPC_USERS TABLE
VPC_USERS_V VIEW
XAL TABLE
XAL_V VIEW
XCF TABLE
XCF_V VIEW
XDF TABLE
XDF_V VIEW

142 rows selected.

--------注册目标库(将目标库controlfile的rman 元数据 同步到 catalog database)
[[email protected] ~]$ rman target / catalog [email protected]

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jul 3 16:47:19 2015

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

connected to target database: PROD (DBID=293516844)
connected to recovery catalog database

RMAN> register database;

starting full resync of recovery catalog
full resync complete

---------------查看注册信息
SQL> desc rc_database;
Name Null? Type
----------------------------------------- -------- ----------------------------
DB_KEY NOT NULL NUMBER
DBINC_KEY NUMBER
DBID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(8)
RESETLOGS_CHANGE# NOT NULL NUMBER
RESETLOGS_TIME NOT NULL DATE
SQL> select * from rc_database;

DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
1 2 293516844 PROD 1592300 01-JUL-15
SQL>

----------利用catalog database存放rman 脚本

1)创建脚本(replace 是修改已经存在的脚本)

create script prod_bk {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup database format '/ora_data/prod/full_bk_%U.dbf';
release channel c1;
release channel c2;
}
RMAN> create script prod_bk {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> backup database format '/ora_data/prod/full_bk_%U.dbf';
5> release channel c1;
6> release channel c2;
7> }

created script prod_bk

created script prod_bk
2)查看脚本信息
RMAN> print script prod_bk;

RMAN> print script prod_bk;

printing stored script: prod_bk
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup database format '/ora_data/prod/full_bk_%U.dbf';
release channel c1;
release channel c2;
}
------通过catalog database 查看
SQL> col SCRIPT_NAME for a30
SQL> col SCRIPT_COMMENT for a50
SQL> select * from RC_STORED_SCRIPT;

DB_KEY DB_NAME SCRIPT_NAME SCRIPT_COMMENT
---------- -------- ------------------------------ --------------------------------------------------
1 PROD prod_bk

SQL> col text for a50
SQL> select * from RC_STORED_SCRIPT_LINE
2 ;

DB_KEY SCRIPT_NAME LINE TEXT
---------- ------------------------------ ---------- --------------------------------------------------
1 prod_bk 1 {
1 prod_bk 2 allocate channel c1 type disk;
1 prod_bk 3 allocate channel c2 type disk;
1 prod_bk 4 backup database format '/ora_data/prod/full_bk_%U
.dbf';

1 prod_bk 5 release channel c1;
1 prod_bk 6 release channel c2;
1 prod_bk 7 }

7 rows selected.
3)运行脚本
RMAN> run { execute script prod_bk;}
run {execute script prod_bk;}

4) 删除脚本
RMAN> delete script prod_bk;

deleted script: prod_bk

本文出自 “DBA的天空” 博客,请务必保留此出处http://kevinora.blog.51cto.com/9406404/1670760

更多相关文章
  • 1.$.extend({},defaults, options) 这样做的目的是为了保护包默认参数.也就是defaults里面的参数. 做法是将一个新的空对象({})做为$.extend的第一个参数,defaults和用户传递的参数对象紧随其后,这样做的好处是所有值被合并到这个空对象上,保护了插件里 ...
  • 无论是在学习.工作还是生活中,我们都会遇到各式各样的事.有按部就班的,有突如其来的,如何安排好自己的时间,才不会让自己面对突如其来的事情,感到手忙脚乱,整天在慌乱中度过,变得尤为重要. 在你的工作中,肯定有这样的场景:早上来到公司,想起来之前遗留的任务没有完成,就马上开始做了起来,就在这个时候,突然 ...
  • 执行以下语句,在执行前将dbname修改为需要瘦身的数据库名称,执行后数据库日志文件将变为1M大小. backup log dbName with NO_LOG;backup log dbName with TRUNCATE_ONLY;DBCC SHRINKDATABASE(dbName);  
  • 光纤收发器的概述 光纤收发器:Transceiver. 由光电子器件.功能电路和光接口等组成,光电子器件包括发射和接收两部分. 简单的说,光纤收发器的作用就是光电转换,发送端把电信号转换成光信号,通过光纤传送后,接收端再把光信号转换成电信号. 光纤收发器的发展 根据不同的封装格式,比较常见的有1X9 ...
  • Qglfnts Blog 影响ECSHOP2.6.1/2.6.2版本EXP:#!/usr/bin/php
一周排行
  • 文_本刊记者 陈曦 编辑_袭祥德 摄影_姬东 高翔经常过着每日一城的生活.这天中午他从广州飞到北京,开完N个会之后入住酒店,已是凌晨两点. “做投资绝对是个体力活.”高翔有些疲惫.拍照时,摄影师让他摆出激情活泼的表情 ...
  •     自从武总和黄华中那次和吵架无异的沟通之后,武总已经两个星期没有来公司了.按张文香的说法,武总是回澳洲了.武总是台湾人,但入了澳洲国籍,如果不在澳洲当地的话,需要每隔三个月就回去一趟.想想也有道理,如果出国太久 ...
  • 彼岸.花未開 wingide是一款非常不错的Python集成开发环境,最新版没记错的话应该到3.2了,网上有3.18的注册机和注册方法,但是都是针对windows下面的.很多朋友都是在Linux下面做Python的开 ...
  • 全民英雄萌宠推塔版活动火爆来袭 十连抽必掉双紫卡.3月3日当天,玩家参与高级英雄祭坛,可100%获得两张紫卡!活动.连续登陆,领取金币.魔钻.技能书.紫卡 <全民英雄>最新公布了一个萌宠推塔版本,官方整理 ...
  • 3389端口是Windows 2000(2003) Server 远程桌面的服务端口,可以通过这个端口,用"远程桌面"等连接工具来连接到远程的服务器,如果连接上了,输入系统管理员的用户名和密码后, ...
  • measure调用次数 public class TestMeasureActivity extends Activity { @Override protected void onCreate(Bundle sav ...
  • 有用户反馈,通过盘古完美越狱工具进行越狱后,设备中存储的照片发生丢失等现象,而就在就在昨晚,盘古团队发布了iOS8越狱工具的更新版本,旨在修复此前所出现的主要错误问题,详情我们一起来了解一下把 就在昨晚,盘古团队发布 ...
  •             红外遥控应用广泛,而编码及识别往往是单片机初学者最头痛的问题,其实红外编码及识别并不难,关键是要掌握红外编码及识别的方法,首先让我们来了解下红外编码.           一.红外编码.    ...
  • 文|郑凯8月12日,阿里财报一出,又是一片感叹号.从阿里集团宣布的2015年第二季度(2016财年第一季度)看:第2季度收入202.45亿元,净利润308.16亿,同比增长148%.其中,最大的亮点我认为有两个.第一 ...
  • 邮件解决方案的软件组成 功能模块 实现软件 软件介绍 操作系统(OS) CentOS CentOS和RHEL是一样的,而且升级免费 Web 服务器 Apache 流行.强大的web服务器 数据库/目录服务 MySQL ...