rman高级管理之创建恢复目录示例:
(1)作为system用户使用sql*plus连接到目录数据库
C:\Documents and Settings\Administrator>sqlplus system/oracle@ORCL
SQL*Plus: Release 11.2.0.1.0 Production on 星期二 8月 6 17:33:16 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
(2)使用如下命令在目录数据库中创建表空间
SQL> create tablespace rman datafile 'd:\data\rman01.dbf' size 20m;
表空间已创建。
(3)使用新的表空间作为默认表空间来创建一个保存目录的模式:
SQL> create user rman identified by rman default tablespace rman;
(4)为新模式授予权限
SQL> grant recovery_catalog_owner to rman;
授权成功。
SQL> alter user rman quota unlimited on rman;
用户已更改。
(5)在操作系统提示符中,启动RMAN可执行文件并作为新用户连接到目录数据库:
C:\Documents and Settings\Administrator>rman catalog rman/rman@ORCL
恢复管理器: Release 11.2.0.1.0 - Production on 星期二 8月 6 17:42:06 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
连接到恢复目录数据库
(6)创建目录
RMAN> create catalog;
(7)退出RMAN,然后从操作系统提示符中同时连接到目录和目标数据库:
C:\Documents and Settings\Administrator>rman catalog rman/rman@ORCL target /
恢复管理器: Release 11.2.0.1.0 - Production on 星期二 8月 6 17:44:29 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
连接到目标数据库: ORCL (DBID=1324535298)
连接到恢复目录数据库
(8)注册目标数据库并查看是否已创建任何RMAN备份:
RMAN> register database;
RMAN> list backup of database;
(9)退出RMAN,并使用sql*plus来查询一些视图以便确认已注册了目标数据库并且已执行了备份:
C:\Documents and Settings\Administrator>sqlplus rman/rman@ORCL
SQL*Plus: Release 11.2.0.1.0 Production on 星期二 8月 6 17:47:24 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select dbid,name from rc_database;
DBID NAME
---------- --------
1324535298 ORCL
SQL> select db_id,bs_key,backup_type from rc_backup_set;
DB_ID BS_KEY B
---------- ---------- -
1324535298 154 D
1324535298 155 D
1324535298 156 D
1324535298 157 D
1324535298 158 D
1324535298 159 D
1324535298 160 D
1324535298 161 D
1324535298 162 D
1324535298 163 D
已选择10行。