rman之创建恢复目录笔记

[复制链接]
查看11 | 回复5 | 2011-1-4 10:36:17 | 显示全部楼层 |阅读模式
晚上做了一下创建恢复目录的实验,整理了一下,供自己以后参考
环境:
源库:oracle10gr2 源OS:rhelas4源sid=ora10源库ip=192.168.1.200
目标库: oracle10gr2 目地OS:rhelas4 目的sid=ora10hha目的库ip=192.168.1.10
实验目的:
要将源库192.168.1.200 上的数据文件、控制文件以及日志文件备份到 目的库192.168.1.10上,以便源库出现问题时,可以通过
备份目录恢复。
实验准备:
1:在虚拟机上安装好两个redhat系统,源库ip=192.168.1.200,目的库ip=192.168.1.10
并分别创建好两个库,一个ora10库 , 一个orahha库
同时关闭两个redhat系统上的防火墙,确保这两个OS都可以相互ping通
2:在目的库(192.168.1.10)上通过图形化界面执行netca命令,配置好监听,配置好的listener.ora 如下
ora10hha =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
3:在源库(192.168.1.200)上通过图形化界面执行netca命令,配置好tnsname.ora ,配置好的内容如下:
ORA10HHA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ora10hha)
)
)
4:在源库(192.168.1.200)上执行客户端到服务器端的连接是不是正常:
[oracle@sphost admin]$ tnsping ORA10HHA
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 03-MAY-2011 23:22:19
Copyright (c) 1997, 2005, Oracle.All rights reserved.
Used parameter files:
/home/oracle/10.2.0/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ora10hha)))
OK (80 msec)
[oracle@sphost admin]$
ok,这样就可以通过网络连接到目的库上了。
5:在源库(192.168.1.200)上执行
[oracle@sphost admin]$ sqlplus sys/sysdba@ORA10HHA as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 3 23:26:18 2011
Copyright (c) 1982, 2005, Oracle.All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
6:在源库(192.168.1.200)上创建表空间,用于存放恢复目录数据,
并创建用户,该用户是恢复目录的拥有者;同时给用户授予查询、维护恢复目录的权限
SQL> create tablespace tbs_catalog datafile '/home/oracle/oradata/catalog.dbf' size 1G;
Tablespace created.

SQL> create user rman identified by rman temporary tablespace temp default tablespace tbs_catalog quota unlimited on tbs_catalog;
User created.

SQL> grant connect,resource,recovery_catalog_owner to rman;
Grant succeeded.
SQL>

7:启动rman
oracle@sphost admin]$rman
一定要注意:如果此处输入rman后,一直没有反应,那么就执行如下命令:
[oracle@sphost admin]$ export PATH=$ORACLE_HOME/binPATH:.
[oracle@sphost admin]$ rman
Recovery Manager: Release 10.2.0.1.0 - Production on Tue May 3 23:38:10 2011
Copyright (c) 1982, 2005, Oracle.All rights reserved.
RMAN>
8:以用户rman身份连接到恢复目录所在的数据库中
RMAN> connect catalog rman@ORA10HHA
recovery catalog database Password:
connected to recovery catalog database
RMAN>
当然,在这里我的恢复目录是已经创建好了的,如果还没有创建的话,在执行这条命令后,显示如下:
recovery catalog database Password:
connected to recovery catalog database
recovery catalog is not installed
9:因此要创建恢复目录
在这里一定要注意,创建的恢复目录名一定要和刚创建的表空间名字一直,否则无效。如下:
RMAN> connect catalog rman@ORA10HHA
recovery catalog database Password:
connected to recovery catalog database
RMAN> create catalog tablespace tt;
ORACLE error from recovery catalog database: ORA-00959: tablespace 'TT' does not exist
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06433: error installing recovery catalog
RMAN> create catalog tablespace tbs_catalog;
recovery catalog created
RMAN> exit
10:测试恢复目录是否创建成功。
[oracle@sphost ~]$ sqlplus sys/sysdba@ORA10HHA as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 3 22:48:23 2011
Copyright (c) 1982, 2005, Oracle.All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> connect rman@ORA10HHA
Enter password:
Connected.
SQL> set linesize 2000;
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------------------------------------
DB
NODE
CONF
DBINC
CKP
TS
TSATT
DF
DFATT
TF
TFATT
TABLE_NAME
------------------------------------------------------------
OFFR
RR
RT
ORL
RLH
AL
BS
BP
BCF
CCF
XCF
TABLE_NAME
------------------------------------------------------------
BSF
BDF
CDF
XDF
BRL
BCB
CCB
SCR
SCRL
CONFIG
XAL
TABLE_NAME
------------------------------------------------------------
RSR
FB
ROUT
RCVER
37 rows selected.
如果这些表不存在,则表示恢复目录没有创建成功。

11.将数据库注册到恢复目录
[oracle@catalog ~]$ rman
Recovery Manager: Release 10.2.0.1.0 - Production on Tue May 3 21:23:52 2011
Copyright (c) 1982, 2005, Oracle.All rights reserved.
RMAN> connect target ora10;////连接到源库
target database Password:
connected to target database: ORA10HHA (DBID=3339398398)
RMAN> connect catalog rman@ORA10HHA ////连接到恢复目录,感觉这边随意输入任何密码都是可以的
recovery catalog database Password:
connected to recovery catalog database
RMAN> register database;
///把源数据库的信息注册到恢复目录中
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> exit
回复

使用道具 举报

千问 | 2011-1-4 10:36:17 | 显示全部楼层
看到文档上顺便记下来
RMAN Repository Data Storage: Comparison of Options (continued)
How to Set Up a Recovery Catalog
1. Create the database to be used as the recovery catalog. Alternatively, identify an already
existing database and use that. Because a single recovery catalog can serve more than
one database, you may choose to create a single recovery catalog that services all your
databases that are being backed up.
2. In the recovery catalog database, create the user that will own the recovery catalog data.
For example, assume that catdb is the name of the catalog database, and rcat_ts is
the name of a tablespace you have created where the catalog data is to be stored.
$ sqlplus sys/password@catdb as sysdba
SQL> CREATE USER rman IDENTIFIED BY cat
2 TEMPORARY TABLESPACE temp
3 DEFAULT TABLESPACE rcat_ts
4 QUOTA UNLIMITED ON rcat_ts;
SQL> GRANT UNLIMITED ON rcat_ts TO rman;
3. Grant the RECOVERY_CATALOG_OWNER role to the catalog owner. This role provides
the user with all privileges required to maintain and query the recovery catalog.
GRANT RECOVERY_CATALOG_OWNER TO rman;
4. Start RMAN and log in as the catalog owner.
$ rman catalog rman/cat@catdb
RMAN> CREATE CATALOG TABLESPACE rcat_ts;
5. Connect to the target database by using RMAN, and register it in the newly created
recovery catalog.
$ rman target sys/oracle@orcl catalog rman/cat@catdb
RMAN> register database;
Note: It is important to back up your recovery catalog database.
回复

使用道具 举报

千问 | 2011-1-4 10:36:17 | 显示全部楼层
原帖由 sxitsxit 于 2011-5-3 23:14 发表
9:因此要创建恢复目录
在这里一定要注意,创建的恢复目录名一定要和刚创建的表空间名字一直,否则无效。如下:
RMAN> connect catalog rman@ORA10HHA
recovery catalog database Password:
connected to recovery catalog database
RMAN> create catalog tablespace tt;
ORACLE error from recovery catalog database: ORA-00959: tablespace 'TT' does not exist
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06433: error installing recovery catalog
RMAN> create catalog tablespace tbs_catalog;
recovery catalog created
RMAN> exit

我觉得这里只是制定了恢复目录要创建在哪个表空间下,而不是回复目录的名称。
回复

使用道具 举报

千问 | 2011-1-4 10:36:17 | 显示全部楼层
leon830216 发表于 2011-7-23 12:55
我觉得这里只是制定了恢复目录要创建在哪个表空间下,而不是回复目录的名称。

是的
在创建恢复目录库时候 可以指定 tablespace ,也可以不指定
比如:create catalog tablespace xx;
前提是你的xx表空间存在。
如果用 create catalog创的话,默认恢复目录库所在表空间就以用户的默认表空间为主。
回复

使用道具 举报

千问 | 2011-1-4 10:36:17 | 显示全部楼层
使用恢复目录,备份文件还是在目标库上,不能备份到恢复目录所在机器吧
回复

使用道具 举报

千问 | 2011-1-4 10:36:17 | 显示全部楼层
楼主好!
请问第六步,创建的表空间,用户,分配权限是在源库上创建的,还是连接到目标库,在目标库上创建的,因为第五步,有一个连接到目标库的动作。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行