在存储恢复目录的数据库创建表空间用于存储恢复目录schema及恢复目录数据(本文使用已经创建好的数据库catadb来存储恢复目录)
SQL> create tablespace tbs_rman datafile '/s01/orabase/oradata/CWEOLQ/tbs_rman01.dbf' size 200m autoextend on;
Tablespace created.
SQL> create user rman identified by rman temporary tablespace temp default tablespace tbs_rman quota unlimited on tbs_rman;--创建rman schema
SQL> grant recovery_catalog_owner to rman;
Grant succeeded.
SQL> conn rman/rman
Connected.
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
11 rows selected.
SQL> select * from session_roles;
ROLE
------------------------------
RECOVERY_CATALOG_OWNER
进入要备份的数据库:
RMAN> connect catalog rman/rman@CWEOLQ;
connected to recovery catalog database
RMAN> create catalog tablespace tbs_rman;
recovery catalog created
[oracle@cwogg admin]$ rman target sys/123123@PHUB catalog rman/rman@CWEOLQ --连接目标库和恢复目录数据库
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Sep 24 10:25:47 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PHUB (DBID=536511065)
connected to recovery catalog database
RMAN> register database; --将目标库注册到恢复目录
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
全备数据库:
run{
allocate channel ch1 device type disk;
backup as compressed backupset
database plus archivelog delete input
format='+DATA/backup/full_%d_%U'
tag='full_bak';
7> release channel ch1;}
released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: ch1
channel ch1: SID=68 device type=DISK,,,,
处理另外一个需要备份的数据库:
[oracle@rac1 admin]$ rman target sys/oracle@COWELLORC catalog rman/rman@CWEOLQ
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Sep 24 11:15:50 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: COWELLOR (DBID=335454682)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete