ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 我的Rman学习笔记—恢复目录

我的Rman学习笔记—恢复目录

原创 Linux操作系统 作者:shentao19890909 时间:2011-09-10 21:11:38 0 删除 编辑

Rman恢复目录

 

前提说明:

      恢复目录所在的库是windows上的orcl2库,

      目标库是linux(虚拟机)上的orcl1库。

操作都是在linux环境下,linuxtnsnames.ora 有一个网络字符串winorcl2连上windows的库orcl2. Orcl2库的监听开启,linux tnsping winorcl2 OK

另外,使不使用恢复目录完全根据实际情况,好处当然是更安全了,不用担心控制文件出问题到时数据库恢复不了,当然需要一台server来跑恢复目录库,如果N多库的恢复目录都用在这一个上的话,还可以接受了。

 

1.     连上orcl2库,建立tablespace,用户,并且授予。

 [oracle@localhost oracle]$ sqlplus sys/shentao@winorcl2 as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Sep 8 06:29:01 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> select name from v$database;

NAME

---------

ORCL2

 

SQL> create tablespace cata datafile 'D:\oradata\orcl2\cata.dbf' size 100m;

Tablespace created.

 

SQL> create user ct1 identified by ct1 default tablespace cata;

User created.

 

SQL> grant connect,resource,recovery_catalog_owner to ct1;

Grant succeeded.

 

SQL> exit;

例外,通过role_sys_privs数据字典可以查看recovery_cata_owner的系统权限

SQL> select * from role_sys_privs where role='RECOVERY_CATALOG_OWNER';

 

ROLE                           PRIVILEGE                                ADM

------------------------------ ---------------------------------------- ---

RECOVERY_CATALOG_OWNER         CREATE SYNONYM                           NO

RECOVERY_CATALOG_OWNER         CREATE CLUSTER                           NO

RECOVERY_CATALOG_OWNER         ALTER SESSION                            NO

RECOVERY_CATALOG_OWNER         CREATE DATABASE LINK                     NO

RECOVERY_CATALOG_OWNER         CREATE SESSION                           NO

RECOVERY_CATALOG_OWNER         CREATE TABLE                             NO

RECOVERY_CATALOG_OWNER         CREATE SEQUENCE                          NO

RECOVERY_CATALOG_OWNER         CREATE PROCEDURE                         NO

RECOVERY_CATALOG_OWNER         CREATE VIEW                              NO

RECOVERY_CATALOG_OWNER         CREATE TYPE                              NO

RECOVERY_CATALOG_OWNER         CREATE TRIGGER                           NO

 

11 rows selected.

2.     在目录数据库中创恢复目录

[oracle@localhost oracle]$ rman catalog ct1/ct1@winorcl2;

 

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Sep 8 06:36:49 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to recovery catalog database

 

RMAN> create catalog tablespace cata;

recovery catalog created

3.     把目标库注册到恢复目录上,并且注册

[oracle@localhost oracle]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Sep 8 06:38:28 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL1 (DBID=1144435659) //连上目标库

 

RMAN> connect catalog ct1/ct1@winorcl2  //连接到恢复目录数据库

 

connected to recovery catalog database

 

RMAN> register database;        //注册,在恢复目录中写进目标库的信息。

 

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

 

RMAN>

 

//OK,到此为止,完成关于恢复目录的全部操作,可以开始rman备份了。

4.     Others

1.有了恢复目录之后,以后连接rman可以直接连接上恢复目录

 [oracle@localhost oracle]$ rman target / catalog ct1/ct1@winorcl2

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Sep 8 07:07:10 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database: ORCL1 (DBID=1144435659)

connected to recovery catalog database

 

2.如果要想从恢复目录上解除注册

RMAN> unregister database;

database name is "ORCL1" and DBID is 1144435659

Do you really want to unregister the database (enter YES or NO)? y

database unregistered from the recovery catalog

 

RMAN>

PS: 此时你会发现在 恢复目录库下

 

SQL> select object_name,object_type from dba_objects where wner ='CT1';

 

OBJECT_NAME                              OBJECT_TYPE

---------------------------------------- ------------------------------

RC_UNUSABLE_BACKUPFILE_DETAILS             VIEW

RC_RMAN_BACKUP_TYPE                      VIEW

RC_BACKUP_CORRUPTION                     VIEW

RC_PROXY_CONTROLFILE                      VIEW

………………………………..
195 rows selected. (
会有很table view index)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25694091/viewspace-707111/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 对于DML的FlashBack
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2011-09-06

  • 博文量
    3
  • 访问量
    7033