在logical standby环境中,在primary 端对用户授予sysdba权限,备库会出现ORA-01031 错误,并中断apply进程。

SYMPTOMS

ORA-01031 Error with SQL Apply of Logical Standby:

Thu Jul 31 16:47:46 2008
LOGSTDBY stmt: grant sysdba to scott
LOGSTDBY status: ORA-01031: insufficient privileges
LOGSTDBY id: XID 0x000a.022.000002bb, hSCN 0x0000.0025d31d, lSCN 0x0000.0025d31d, Thread 1, RBA
0x00c4.00007a40.10, txnCscn 0x0000.0025d320, PID 9491, oracle@aulnx9.au.oracle.com (P004)

CHANGES

Executed
SQL> grant sysdba to xxxx;
on the Primary Database

CAUSE

Bug 3013741: ORA-1031: INSUFFICIENT PRIVILEGES ERROR ON LOGICAL DB IN DATA GUARD MANAGER

A Background Process, e.g., a Logcial Apply Slave, never runs with SYSDBA Privileges. This would be needed to perform the grant of the SYSDBA privileges.


.

SOLUTION

At standby side, grant sysdba to xxxx manually
SQL> alter session disable guard;
SQL> grant sysdba to xxxx;
SQL> alter session enable guard;

2. Skip the Transaction of the grant using DBMS_LOGSTDBY.SKIP_TRANSACTION

2.1 Check xid with the grant.

  -> it may have the following in alert log or location of the trace file containing the information below

Thu Jul 31 16:47:46 2008
LOGSTDBY stmt: grant sysdba to scott
LOGSTDBY status: ORA-01031: insufficient privileges
LOGSTDBY id: XID 0x000a.022.000002bb, hSCN 0x0000.0025d31d, lSCN 0x0000.0025d31d, Thread 1, RBA
0x00c4.00007a40.10, txnCscn 0x0000.0025d320, PID 9491, oracle@aulnx9.au.oracle.com (P004)

XID 0x000a.022.000002bb ==> Undo segment # . Slot # . sequence # in hex

==> usn 10, slot 34, sequence 699 in decimal

2.2 Skip the Transaction
SQL> exec dbms_logstdby.skip_transaction(10,34,699)


2.3 Start the Logical Apply again.
SQL> alter database start logical standby apply;