집 >데이터 베이스 >MySQL 튜토리얼 >rman 创建catalog实验及说明
rman 创建catalog实验及说明,请在两台机器上分别装上数据库软件,分别创建数据库,并启动数据库;
前提:
请在两台机器上分别装上数据库软件,,分别创建数据库,并启动数据库;
本例相关说明
一、主机作用说明:
[Oracle@Oracle11gOcp_catalog ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.0.253 Oracle11gOcp_catalog #作为 catalog 主机
192.168.0.252 Oracle11gOcp #作为 需要备份的 主机
二、tnsname样例:
[oracle@Oracle11gOcp_catalog ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
CATALOG_ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11gOcp_catalog)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
TARGET_ORCL=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11gOcp)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
三、实验
-- 1、在Oracle11gOcp_catalog主机中(作为catalog的数据库),准备tablespace,user, permissions and quota,执行操作如下:
[oracle@Oracle11gOcp_catalog ~]$sqlplus / as sysdba
SQL> create tablespace rmancatalog_tablespace datafile '/u01/app/oracle/oradata/orcl/rmancatlog_tablespace.dbf' size 50m;
SQL> create user rman identified by rman default tablespace rmancatalog_tablespace;
SQL> grant recovery_catalog_owner to rman;
SQL> alter user rman quota unlimited on rmancatalog_tablespace;
-- 2、操作系统下执行:以注册目标库到catalog库中;
-- catalog_ORCL是配置连接到catlog数据库的tnsname;
[oracle@Oracle11gOcp_catalog ~]$ rman catalog rman/rman@catalog_ORCL target sys/123123@target_orcl
RMAN> create catalog;
RMAN> register database;
RMAN> list backup;
RMAN>
说明:rman catalog rman/rman@catalog_ORCL target sys/123123@target_orcl
catalog rman/rman@catalog_ORCL 表示要连接的 catalog 数据库为: catalog_ORCL
target sys/123123@target_orcl 表示要连接的 target 数据库为: target_orcl
-- 3、可以开始在catalog数据库中查询注册信息;
[oracle@Oracle11gOcp_catalog ~]$ sqlplus rman/rman@catalog_orcl
SQL> select dbid, name from rc_database;
SQL> select db_id, bs_key, backup_type from rc_backup_set;
-- 作完 1,2 步骤后,即可开始执行rman 备份等操作;例如:执行备份,查询备份信息等 ;
RMAN> backup datafile 4; -- 备份4号文件;
RMAN> list backup; -- 列出备份信息;
备份集列表
===================
BS 关键字 类型 LV 大小 设备类型 经过时间 完成时间
------- ---- -- ---------- ----------- ------------ ----------
230 Full 2.54M DISK 00:00:05 06-10月-12
BP 关键字: 231 状态: AVAILABLE 已压缩: NO 标记: TAG20121006T085542
段名:/u01/app/oracle/backup_rman/795948944_17_1.bk
备份集 230 中的数据文件列表
文件 LV 类型 Ckp SCN Ckp 时间 名称
---- -- ---- ---------- ---------- ----
4 Full 1743421 06-10月-12 /u01/app/oracle/oradata/orcl/users01.dbf