首页 > 代码库 > RMAN-catalog备份及恢复数据库

RMAN-catalog备份及恢复数据库

1、Set Up a Recovery Catalog and Target Database
Setting up a recovery catalog is a very simple process. This can be done through the Enterprise Manager GUI or through some simple commands in SQL*Plus and the RMAN command-line interface. In SQL*Plus, all you need to do is to create a tablespace to store the catalog data in, create an RMAN user, and then grant the recovery_catalog_owner role to the RMAN user. In RMAN, run the  create     catalogstatement:  (以sys连接到rman实例,创建数据表空间,创建rcat用户并授权)                                    

SQL> conn sys/rman@rman as sysdba;--需要创建一个新的实例rman,并使用sys用户连接到rman已连接。SQL> create tablespace rcatts datafile D:\rman\rman_data\rcatts.dbf size 1024M;表空间已创建。SQL> create user rcat identified by rcat temporary tablespace temp  2     default tablespace rcatts quota unlimited on rcatts;用户已创建。SQL> grant connect, resource, recovery_catalog_owner to rcat;授权成功。SQL> exit从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options 断开C:\Users\Administrator>

2、In the RMAN command-line interface, log in and create the catalog:

(使用上一步创建的rcat用户登录并创建恢复目录)

C:\Users\Administrator>rman catalog=rcat/rcat@rman;恢复管理器: Release 11.2.0.1.0 - Production on 星期二 10月 7 23:52:05 2014Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.连接到恢复目录数据库RMAN> create catalog;恢复目录已创建RMAN>

3、把目标数据库注册到恢复目录catalog中

Now you need to register the target database in the catalog. To do this, connect to the target and the catalog database and then register the target database in the catalog. This can be done from either location. The target connection must have a user ID with sysdba privileges, so an Oracle password file must be created using the orapwd utility. As described in Chapter 3, you also need to create the Oracle networking configuration using tnsnames or an equivalent for both the target and recovery catalog instances:

RMAN> connect catalog rcat/rcat@rman;--连接到恢复目录数据库RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-06167: 已经连接RMAN> connect target rusky/rusky@orcl;--连接目标数据库orcl,用户为rusky,密码为rusky连接到目标数据库: ORCL (DBID=1385990360)RMAN> register database;注册在恢复目录中的数据库正在启动全部恢复目录的 resync完成全部 resyncRMAN>

4、It’s now time to back up your entire database

....

RMAN-catalog备份及恢复数据库