我们在用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 later
Information 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
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
sys@testdb> @?/rdbms/admin/dbmsrmansys.sql sys@testdb> Rem sys@testdb> Rem Copyright (c) 2013, 2014, Oracle and/or its affiliates. sys@testdb> Rem All rights reserved. sys@testdb> Rem sys@testdb> Rem BEGIN SQL_FILE_METADATA sys@testdb> Rem SQL_SOURCE_FILE: rdbms/admin/dbmsrmansys.sql sys@testdb> Rem SQL_SHIPPED_FILE: rdbms/admin/dbmsrmansys.sql sys@testdb> Rem SQL_PHASE: DBMSRMANSYS sys@testdb> Rem SQL_STARTUP_MODE: NORMAL sys@testdb> Rem SQL_IGNORABLE_ERRORS: NONE sys@testdb> Rem SQL_CALLING_FILE: NONE sys@testdb> Rem END SQL_FILE_METADATA sys@testdb> Rem sys@testdb> Rem MODIFIED (MM/DD/YY) sys@testdb> Rem surman 02/11/14 - 13922626: Update SQL metadata sys@testdb> Rem vbegun 10/29/13 - Created sys@testdb> Rem sys@testdb> sys@testdb> @@?/rdbms/admin/sqlsessstart.sql sys@testdb> Rem sys@testdb> Rem $Header: rdbms/admin/sqlsessstart.sql /main/1 2013/03/13 13:08:33 surman Exp $ sys@testdb> Rem sys@testdb> Rem sqlsessstart.sql sys@testdb> Rem sys@testdb> Rem Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. sys@testdb> Rem sys@testdb> Rem NAME sys@testdb> Rem sqlsessstart.sql - SQL session start sys@testdb> Rem sys@testdb> Rem DESCRIPTION sys@testdb> Rem Any commands which should be run at the start of all oracle sys@testdb> Rem supplied scripts. sys@testdb> Rem sys@testdb> Rem NOTES sys@testdb> Rem See sqlsessend.sql for the corresponding end script. sys@testdb> Rem sys@testdb> Rem MODIFIED (MM/DD/YY) sys@testdb> Rem surman 03/08/13 - 16462837: Common start and end scripts sys@testdb> Rem surman 03/08/13 - Created sys@testdb> Rem sys@testdb> 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
sys@testdb> sys@testdb> -- Do not drop this role recovery_catalog_owner. sys@testdb> -- Drop this role will revoke this role from all rman users. sys@testdb> -- If this role exists, ORA-1921 is expected. sys@testdb> declare
2 role_exists exception;
3 pragma exception_init(role_exists, -1921);
4 begin
5 execute immediate 'create role recovery_catalog_owner';
6 exception
7 when role_exists then
8 null;
9 end;
10 /
PL/SQL procedure successfully completed.
sys@testdb> declare
2 role_exists exception;
3 pragma exception_init(role_exists, -1921);
4 begin
5 execute immediate 'create role recovery_catalog_user';
6 exception
7 when role_exists then
8 null;
9 end;
10 /
PL/SQL procedure successfully completed.
sys@testdb> sys@testdb> grant create session,alter session,create synonym,create view,
2 create database link,create table,create cluster,create sequence,
3 create trigger,create procedure, create type to recovery_catalog_owner;
Grant succeeded.
sys@testdb> sys@testdb> -- Following are added for VPD support sys@testdb> grant execute on dbms_rls to recovery_catalog_owner;
Grant succeeded.
sys@testdb> grant create any trigger to recovery_catalog_owner;
Grant succeeded.
sys@testdb> grant create any synonym to recovery_catalog_owner;
Grant succeeded.
sys@testdb> grant create public synonym to recovery_catalog_owner;
Grant succeeded.
sys@testdb> grant drop any synonym to recovery_catalog_owner;
Grant succeeded.
sys@testdb> grant administer database trigger to recovery_catalog_owner;
Grant succeeded.
sys@testdb> grant recovery_catalog_user to recovery_catalog_owner with admin option;
Grant succeeded.
sys@testdb> sys@testdb> @?/rdbms/admin/sqlsessend.sql sys@testdb> Rem sys@testdb> Rem $Header: rdbms/admin/sqlsessend.sql /main/1 2013/03/13 13:08:33 surman Exp $ sys@testdb> Rem sys@testdb> Rem sqlsessend.sql sys@testdb> Rem sys@testdb> Rem Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. sys@testdb> Rem sys@testdb> Rem NAME sys@testdb> Rem sqlsessend.sql - SQL session end sys@testdb> Rem sys@testdb> Rem DESCRIPTION sys@testdb> Rem Any commands which should be run at the end of all oracle sys@testdb> Rem supplied scripts. sys@testdb> Rem sys@testdb> Rem NOTES sys@testdb> Rem See sqlsessstart.sql for the corresponding start script. sys@testdb> Rem sys@testdb> Rem MODIFIED (MM/DD/YY) sys@testdb> Rem surman 03/08/13 - 16462837: Common start and end scripts sys@testdb> Rem surman 03/08/13 - Created sys@testdb> Rem sys@testdb> 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.