创建和使用虚拟专用目录

http://www.cnblogs.com/rusking/p/4010341.html
--->>>接上篇文章
注意恢复目录所有者是指创建恢复目录的用户,如上篇中的rcat用户。
专用目录所有者是指由某一用户,只能使用RMAN来备份还原rcat授权的数据库实例。
设置虚拟专用目录的作用就是控制不同的用户对RMAN的操作权限。
以下测试案例使用RMAN所在的数据库实例sys用户创建rcat2用户,并授权其使用虚拟专用目录。
1、创建虚拟专用目录所有者
C:\Users\Administrator>sqlplus sys/rusky@orcl as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 8 00:04:54 2015

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


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create user rcat2 identified by rcat2 temporary tablespace temp
2 default tablespace rcatts quota unlimited on rcatts;

用户已创建。

2、为虚拟专用目录所有者授权
SQL> grant connect,resource,recovery_catalog_owner to rcat2;

授权成功。

RMAN> grant catalog for database orcl to rcat2; ---基本目录所有者为rcat2授于orcl数据库的权限

授权成功。

RMAN> grant register database to rcat2; --允许rcat2用户可注册自己的数据库

授权成功。

3、用户rcat2创建虚拟专用目录
C:\Users\Administrator>rman target sys/rusky@orcl catalog rcat2/rcat2@orcl;

恢复管理器: Release 11.2.0.1.0 - Production on 星期日 3月 8 00:30:39 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

连接到目标数据库: ORCL (DBID=1399092762)
连接到恢复目录数据库

RMAN> create virtual catalog;

找到 RCAT 所拥有的符合条件的基础目录
已针对 RCAT 所拥有的基础目录创建了虚拟目录
---------------------
说明:如果RMAN客户端早于ORACLE 11G,必须使用SQL提示符执行存储过程创建虚拟目录,如下:
SQL> exec rman.dbms_rcvat.create_virtual_catalog;

4、使用虚拟专用目录
用户rcat2可以像rcat用户那样注册新的实例。

C:\Users\Administrator>rman target sys/rusky@orcl2 catalog=rcat2/rcat2@orcl; ---恢复目录所在实例为orcl,新实例为orcl2。

恢复管理器: Release 11.2.0.1.0 - Production on 星期日 3月 8 00:48:18 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

连接到目标数据库: ORCL2 (DBID=854394515)
连接到恢复目录数据库

RMAN> register database;

注册在恢复目录中的数据库
正在启动全部恢复目录的 resync
完成全部 resync

RMAN>

5、查看vcat2用户可用RMAN虚拟专用目录管理哪些数据库实例
rcat2用户连接到恢复目录数据库并查看dbinc视图。

SQL> select distinct db_name from dbinc;

DB_NAME
--------
ORCL
ORCL2

SQL>

6、删除虚拟专用目录???????????????????????

posted on 2015-03-08 00:44  遠離塵世の方舟  阅读(357)  评论(0编辑  收藏  举报

导航