我们再用12c的sqlplus 去连接11g的catalog的时候,会报如下的错误
Recovery Manager: Release 12.1.0.2.0 - Production on Thu Oct 22 05:50:38 2015
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMO (DBID=735078679)
connected to recovery catalog database
PL/SQL package RC_ADMIN.DBMS_RCVCAT version 11.02.00.04 in RCVCAT database is too old
这样的错误,在正常的情况下,upgrade catalog升级catalog就可以了。
但是我们在升级的时候
RMAN> upgrade catalog;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-07539: insufficient privileges to create or upgrade the catalog schema
我们查了MOS 文档 ID 1915561.1
APPLIES TO:
Oracle Database - Enterprise Edition - Version 12.1.0.2 and laterInformation in this document applies to any platform.
SYMPTOMS
The RMAN command 'upgrade catalog' fails with the following error, as shown here.
RMAN-07539: insufficient privileges to create or upgrade the catalog schema
CAUSE
Missing privileges as investigated in
Unpublished Bug 17465689 - RMAN-6443: ERROR UPGRADING RECOVERY CATALOG
SOLUTION
Grant additional privileges to the RECOVERY_CATALOG_OWNER and RECOVERY_CATALOG_USER role using 'dbmsrmansys.sql'
Using
12.1.0.2 ORACLE_HOME and connect to the Catalog database
% sqlplus sys/<passwd@catalog_db> as sysdba
SQL> spool '/tmp/rmanCatUpg.txt'
@ ?/rdbms/admin/dbmsrmansys.sql
exit
and than retry the UPGRADE CATALOG
% rman catalog <un/pw@catalog_db>
RMAN> upgrade catalog; # twice to confirm
% sqlplus sys/<passwd@catalog_db> as sysdba
SQL> spool '/tmp/rmanCatUpg.txt'
@ ?/rdbms/admin/dbmsrmansys.sql
exit
and than retry the UPGRADE CATALOG
% rman catalog <un/pw@catalog_db>
RMAN> upgrade catalog; # twice to confirm
是这么来描述这个BUG的,对于这个BUG,我们需要
拷贝
dbmsrmansys.sql
sqlsessstart.sql
sqlsessend.sql
这三个脚本到11G的数据库上面去执行
[06:14:30 oracle(db)@kiwi admin]$ sqlplus sys/oracle@testdb as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 22 06:14:53 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
06:14:53 sys@testdb> @?/rdbms/admin/dbmsrmansys.sql
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem Copyright (c) 2013, 2014, Oracle and/or its affiliates.
06:15:06 sys@testdb> Rem All rights reserved.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem BEGIN SQL_FILE_METADATA
06:15:06 sys@testdb> Rem SQL_SOURCE_FILE: rdbms/admin/dbmsrmansys.sql
06:15:06 sys@testdb> Rem SQL_SHIPPED_FILE: rdbms/admin/dbmsrmansys.sql
06:15:06 sys@testdb> Rem SQL_PHASE: DBMSRMANSYS
06:15:06 sys@testdb> Rem SQL_STARTUP_MODE: NORMAL
06:15:06 sys@testdb> Rem SQL_IGNORABLE_ERRORS: NONE
06:15:06 sys@testdb> Rem SQL_CALLING_FILE: NONE
06:15:06 sys@testdb> Rem END SQL_FILE_METADATA
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem MODIFIED (MM/DD/YY)
06:15:06 sys@testdb> Rem surman 02/11/14 - 13922626: Update SQL metadata
06:15:06 sys@testdb> Rem vbegun 10/29/13 - Created
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb>
06:15:06 sys@testdb> @@?/rdbms/admin/sqlsessstart.sql
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem $Header: rdbms/admin/sqlsessstart.sql /main/1 2013/03/13 13:08:33 surman Exp $
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem sqlsessstart.sql
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem NAME
06:15:06 sys@testdb> Rem sqlsessstart.sql - SQL session start
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem DESCRIPTION
06:15:06 sys@testdb> Rem Any commands which should be run at the start of all oracle
06:15:06 sys@testdb> Rem supplied scripts.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem NOTES
06:15:06 sys@testdb> Rem See sqlsessend.sql for the corresponding end script.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem MODIFIED (MM/DD/YY)
06:15:06 sys@testdb> Rem surman 03/08/13 - 16462837: Common start and end scripts
06:15:06 sys@testdb> Rem surman 03/08/13 - Created
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb>
06:15:06 sys@testdb> alter session set "_ORACLE_SCRIPT" = true;
alter session set "_ORACLE_SCRIPT" = true
*
ERROR at line 1:
ORA-02248: invalid option for ALTER SESSION
Elapsed: 00:00:00.01
06:15:06 sys@testdb>
06:15:06 sys@testdb> -- Do not drop this role recovery_catalog_owner.
06:15:06 sys@testdb> -- Drop this role will revoke this role from all rman users.
06:15:06 sys@testdb> -- If this role exists, ORA-1921 is expected.
06:15:06 sys@testdb> declare
06:15:06 2 role_exists exception;
06:15:06 3 pragma exception_init(role_exists, -1921);
06:15:06 4 begin
06:15:06 5 execute immediate 'create role recovery_catalog_owner';
06:15:06 6 exception
06:15:06 7 when role_exists then
06:15:06 8 null;
06:15:06 9 end;
06:15:06 10 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.16
06:15:06 sys@testdb> declare
06:15:06 2 role_exists exception;
06:15:06 3 pragma exception_init(role_exists, -1921);
06:15:06 4 begin
06:15:06 5 execute immediate 'create role recovery_catalog_user';
06:15:06 6 exception
06:15:06 7 when role_exists then
06:15:06 8 null;
06:15:06 9 end;
06:15:06 10 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.06
06:15:06 sys@testdb>
06:15:06 sys@testdb> grant create session,alter session,create synonym,create view,
06:15:06 2 create database link,create table,create cluster,create sequence,
06:15:06 3 create trigger,create procedure, create type to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.02
06:15:06 sys@testdb>
06:15:06 sys@testdb> -- Following are added for VPD support
06:15:06 sys@testdb> grant execute on dbms_rls to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.02
06:15:06 sys@testdb> grant create any trigger to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.06
06:15:06 sys@testdb> grant create any synonym to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.01
06:15:06 sys@testdb> grant create public synonym to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.01
06:15:06 sys@testdb> grant drop any synonym to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.01
06:15:06 sys@testdb> grant administer database trigger to recovery_catalog_owner;
Grant succeeded.
Elapsed: 00:00:00.02
06:15:06 sys@testdb> grant recovery_catalog_user to recovery_catalog_owner with admin option;
Grant succeeded.
Elapsed: 00:00:00.03
06:15:06 sys@testdb>
06:15:06 sys@testdb> @?/rdbms/admin/sqlsessend.sql
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem $Header: rdbms/admin/sqlsessend.sql /main/1 2013/03/13 13:08:33 surman Exp $
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem sqlsessend.sql
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem NAME
06:15:06 sys@testdb> Rem sqlsessend.sql - SQL session end
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem DESCRIPTION
06:15:06 sys@testdb> Rem Any commands which should be run at the end of all oracle
06:15:06 sys@testdb> Rem supplied scripts.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem NOTES
06:15:06 sys@testdb> Rem See sqlsessstart.sql for the corresponding start script.
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb> Rem MODIFIED (MM/DD/YY)
06:15:06 sys@testdb> Rem surman 03/08/13 - 16462837: Common start and end scripts
06:15:06 sys@testdb> Rem surman 03/08/13 - Created
06:15:06 sys@testdb> Rem
06:15:06 sys@testdb>
06:15:06 sys@testdb> alter session set "_ORACLE_SCRIPT" = false;
alter session set "_ORACLE_SCRIPT" = false
*
ERROR at line 1:
ORA-02248: invalid option for ALTER SESSION
忽略掉报错,然后在执行upgrade catalog就可以了
RMAN> upgrade catalog;
recovery catalog owner is RC_ADMIN
enter UPGRADE CATALOG command again to confirm catalog upgrade
RMAN> upgrade catalog;
recovery catalog upgraded to version 12.01.00.02
DBMS_RCVMAN package upgraded to version 12.01.00.02
DBMS_RCVCAT package upgraded to version 12.01.00.02.