ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle11新特性——备份恢复功能增强(六)

Oracle11新特性——备份恢复功能增强(六)

原创 Linux操作系统 作者:yangtingkun 时间:2007-12-01 00:00:00 0 删除 编辑

打算写一系列的文章介绍11g的新特性和变化。

Oracle11g在备份和恢复方面新增了很多的功能,无论是性能、功能性、安全性和可操作性方面都有了不同程度的提高。

这一篇介绍虚拟CATALOG

Oracle11新特性——备份恢复功能增强(一):http://yangtingkun.itpub.net/post/468/412991

Oracle11新特性——备份恢复功能增强(二):http://yangtingkun.itpub.net/post/468/414647

Oracle11新特性——备份恢复功能增强(三):http://yangtingkun.itpub.net/post/468/414834

Oracle11新特性——备份恢复功能增强(四):http://yangtingkun.itpub.net/post/468/414941

Oracle11新特性——备份恢复功能增强(五):http://yangtingkun.itpub.net/post/468/416015


Oracle11g新增了虚拟CATALOG的功能。可以将CATALOG中的不同数据库的信息授权给不同的用户。

这样一套CATALOG可以支持多个数据库备份,同时保证多个数据库不会访问到不属于自己数据库的信息,提高了系统的安全性。

先看看10g中注册多个数据库的情况:

SQL> CONN YANGTK/YANGTK@YTK102已连接。
SQL> CREATE USER CATA_LOG IDENTIFIED BY CATA_LOG DEFAULT TABLESPACE YANGTK;

用户已创建。

SQL> GRANT CONNECT, RESOURCE TO CATA_LOG;

授权成功。

SQL> GRANT RECOVERY_CATALOG_OWNER TO CATA_LOG;

授权成功。

下面创建CATALOG并注册第一个数据库:

E:>rman target / catalog cata_log/cata_log

恢复管理器: Release 10.2.0.1.0 - Production on 星期日 12 2 00:41:16 2007

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

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

RMAN> CREATE CATALOG;

恢复目录已创建

RMAN> REGISTER DATABASE;

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

下面注册第二个:

E:>%ORACLE_HOME%/BIN/RMAN TARGET / CATALOG CATA_LOG/CATA_LOG@YTK102

恢复管理器: 版本9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

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

RMAN> REGISTER DATABASE;

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

所有注册数据库都是通过CATALOGOWNER CATA_LOG用户执行的,因此通过CATA_LOG用户访问CATALOG可以看到所有注册的数据库信息,这就存在的安全隐患。

SQL> CONN CATA_LOG/CATA_LOG@YTK102已连接。
SQL> SELECT * FROM RC_DATABASE;

DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS_TIME
---------- ---------- ---------- -------- ----------------- --------------
94 95 1285986946 YTK92 1 09-8
-07
1 2 3695768905 YTK102 547780 09-8
-07

而11g中的虚拟CATALOG则解决了这个问题。每个数据库都可以使用自己的虚拟CATALOG帐号连接CATALOG,且这个帐号只能看到自己数据库的信息:

SQL> CONN YANGTK/yangtk@ORA11G已连接。
SQL> CREATE USER CATA_LOG IDENTIFIED BY CATA_LOG DEFAULT TABLESPACE YANGTK;

用户已创建。

SQL> GRANT CONNECT, RESOURCE TO CATA_LOG;

授权成功。

SQL> GRANT RECOVERY_CATALOG_OWNER TO CATA_LOG;

授权成功。

首先仍然是创建CATALOGOWNER用户,然后创建两个虚拟CATALOG帐号:

SQL> CREATE USER CATALOG_11G IDENTIFIED BY CATALOG_11G DEFAULT TABLESPACE YANGTK;

用户已创建。

SQL> GRANT CONNECT, RESOURCE TO CATALOG_11G;

授权成功。

SQL> GRANT RECOVERY_CATALOG_OWNER TO CATALOG_11G;

授权成功。

SQL> CREATE USER CATALOG_10G IDENTIFIED BY CATALOG_10G DEFAULT TABLESPACE YANGTK;

用户已创建。

SQL> GRANT CONNECT, RESOURCE TO CATALOG_10G;

授权成功。

SQL> GRANT RECOVERY_CATALOG_OWNER TO CATALOG_10G;

授权成功。

下面首先注册两个数据库:

[oracle@yangtk ~]$ rman target / catalog cata_log/CATA_LOG

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Nov 5 08:57:22 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> exit


Recovery Manager complete.

下面注册第二个数据库:

E:>RMAN TARGET / CATALOG CATA_LOG/CATA_LOG@ORA11G

恢复管理器: Release 10.2.0.1.0 - Production on 星期日 12 2 10:21:27 2007

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

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

RMAN> REGISTER DATABASE;

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

RMAN> EXIT

恢复管理器完成。

下面给两个虚拟帐号授权:

[oracle@yangtk ~]$ rman catalog cata_log/CATA_LOG

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Nov 5 03:49:46 2007

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

connected to recovery catalog database

RMAN> create catalog;

recovery catalog created

RMAN> grant catalog for database 4026820313 to catalog_11g;

Grant succeeded.

RMAN> grant register database to catalog_11g;

Grant succeeded.

RMAN> grant catalog for database 3695768905 to catalog_10g;

Grant succeeded.

对于已经存在的CATALOG,可以通过GRANT CATALOG的方式给虚拟CATALOG用户授权,这里可以使用DBID也可以使用DBNAME

也可以将REGISTER DATABASE的权限授权给虚拟用户。

[oracle@yangtk ~]$ rman target / catalog catalog_11g/CATALOG_11G

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Nov 5 03:58:02 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> create virtual catalog;

found eligible base catalog owned by CATA_LOG
created virtual catalog against base catalog owned by CATA_LOG

RMAN> exit


Recovery Manager complete.
[oracle@yangtk ~]$ rman catalog catalog_10g/CATALOG_10G

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Nov 5 09:03:25 2007

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

connected to recovery catalog database

RMAN> create virtual catalog;

found eligible base catalog owned by CATA_LOG
created virtual catalog against base catalog owned by CATA_LOG

RMAN> exit


Recovery Manager complete.

登陆两个虚拟CATALOG帐号,可以看到各自的数据库信息:

SQL> CONN CATALOG_11G/CATALOG_11G@ORA11G已连接。
SQL> SELECT * FROM RC_DATABASE;

DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS_TIME
---------- ---------- ---------- -------- ----------------- --------------
1 2 4026820313 ORA11G 1 14-8
-07

SQL> CONN CATALOG_10G/CATALOG_10G@ORA11G已连接。
SQL> SELECT * FROM RC_DATABASE;

DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS_TIME
---------- ---------- ---------- -------- ----------------- --------------
377 378 3695768905 YTK102 547780 09-8
-07

11grman可以直接使用建立好的虚拟CATALOG

[oracle@yangtk ~]$ rman target / catalog catalog_11g/CATALOG_11G

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Nov 5 09:23:02 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> backup tablespace system;

Starting backup at 05-NOV-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/ora11g/ORA11G/datafile/o1_mf_system_3d3795py_.dbf
channel ORA_DISK_1: starting piece 1 at 05-NOV-07
channel ORA_DISK_1: finished piece 1 at 05-NOV-07
piece handle=/data1/backup/0uj0997v_1_1 tag=TAG20071105T092311 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 05-NOV-07
channel ORA_DISK_1: finished piece 1 at 05-NOV-07
piece handle=/data1/backup/0vj099aj_1_1 tag=TAG20071105T092311 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 05-NOV-07

而10g不能直接使用,即使根据文档的描述,使用虚拟CATALOG执行下面的步骤:

SQL> CONN CATALOG_10G/CATALOG_10G@ORA11G已连接。
SQL> EXEC CATA_LOG.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG

PL/SQL 过程已成功完成。

使用虚拟CATALOG执行备份仍然报错。

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

上一篇: ORA-7445(prscoldrp)
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10488004