Home » Server Options » Data Guard » Incorrect database role (11.2.0, Centos 5.5)
Incorrect database role [message #485924] Sat, 11 December 2010 15:18 Go to next message
mateenaslam
Messages: 21
Registered: November 2010
Location: Islamabad, Pakistan
Junior Member
Hi,

I am getting error ORA-16816: incorrect database role. The reason is my switch over to standby become failed and now both primary and standby databases showing 'database_role' as 'Physical Standby'.

My question is how to manually set 'database_role' to 'PRIMARY' on primary database.

--------------------------------------------
DGMGRL> show configuration

Configuration - dgproj

Protection Mode: MaxPerformance
Databases:
repl - Primary database
Error: ORA-16816: incorrect database role

dgrepl - Physical standby database
--------------------------------------------
Re: Incorrect database role [message #485928 is a reply to message #485924] Sat, 11 December 2010 16:41 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
16816, 0000, "incorrect database role"
// *Cause:  The Data Guard broker detected that the specified database 
//          had a different database role than that recorded in the Data
//          Guard broker configuration. This could be the result of a
//          failed switchover or failover operation, or a switchover or
//          failover operation performed with SQL*Plus.
// *Action: Check the Data Guard broker documentation to see how to recover
//          from failed role change operations, or from role changes that
//          were performed using SQL*Plus for databases managed by Data Guard
//          broker.
Re: Incorrect database role [message #485971 is a reply to message #485924] Sun, 12 December 2010 05:59 Go to previous messageGo to next message
John Watson
Messages: 8928
Registered: January 2010
Location: Global Village
Senior Member
I have seen the reverse situation, where Data Guard Broker thought that both databases were primary. I would suggest that the first thing to do is to disable and remove the configuration, and (very important) delete all the config files. Then check reality: connect to both databases with SQL*Plus, and see if they are, in fact, primary or standby.
If you do have a primary and a standby, create a new configuration. Easy.
If both database are in fact standby, you will have to activate one of them as a primary, create a new configuration, and then try to reinstate the other as a standby. That might be a bit harder.
Re: Incorrect database role [message #486001 is a reply to message #485971] Sun, 12 December 2010 12:24 Go to previous messageGo to next message
mateenaslam
Messages: 21
Registered: November 2010
Location: Islamabad, Pakistan
Junior Member
Yes, i have connect to both database by SQL*Plus and got both database_role as 'PHYSICAL STANDBY'. Any guide line how to activate one as a primary ?

--------------------------------------------
SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PHYSICAL STANDBY
--------------------------------------------
Re: Incorrect database role [message #486011 is a reply to message #486001] Sun, 12 December 2010 14:07 Go to previous messageGo to next message
John Watson
Messages: 8928
Registered: January 2010
Location: Global Village
Senior Member
Quote:
Any guide line how to activate one as a primary ?

I can't add anything to the description of the command that you'll find in your Data Guard Concepts and Admin guide.
Re: Incorrect database role [message #486067 is a reply to message #486011] Mon, 13 December 2010 07:12 Go to previous messageGo to next message
mateenaslam
Messages: 21
Registered: November 2010
Location: Islamabad, Pakistan
Junior Member
Thanks for Data Guard Concepts and admin guide reference. This is how i made my database back to Primary

-------------------------------------------------------------
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database recover managed standby database cancel;
SQL> alter database recover managed standby database finish;
SQL> ALTER database commit to switchover to primary with session shutdown;
SQL> alter database open;
SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PRIMARY
-------------------------------------------------------------
Re: Incorrect database role [message #486068 is a reply to message #486067] Mon, 13 December 2010 07:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68637
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Thanks for the feedback, it will be useful.

Regards
Michel
Re: Incorrect database role [message #486069 is a reply to message #486067] Mon, 13 December 2010 07:28 Go to previous messageGo to next message
babuknb
Messages: 1736
Registered: December 2005
Location: NJ
Senior Member

Yes, Your correct, Oracle also suggest manually need to fix this issue.

Quote:

ORA-16816: incorrect database role
Cause: The Data Guard broker detected that this database object had a database role that was different from the recorded database role in the Data Guard Configuration. This could be the result of a failed switchover or failover operation, or an out-of-band switchover or failover operation done to the database.
Action: Manually fix the database to convert it to the appropriate database role, then issue an ENABLE DATABASE command to reenable the database object.

[Updated on: Mon, 13 December 2010 10:43] by Moderator

Report message to a moderator

Re: Incorrect database role [message #574904 is a reply to message #486069] Wed, 16 January 2013 13:05 Go to previous messageGo to next message
bakuman
Messages: 1
Registered: January 2013
Junior Member
My DG Broker giving wrong information when I do "show configuration". It appears that after previous switchover activity, in DG Broker, my primary db is being reported as standby. My standby is being reported as primary. It also reports ORA-16816: incorrect database role.
I double-check the actual database role using SQL Plus and all info were correct.

To correct this issue, I rebuilt the DG Broker configuration again as below:

-Disable configuration broker on primary and standby
DGMGRL> disable configuration;
Disabled.
DGMGRL> disable configuration;
Disabled.
SQL> alter system set dg_broker_start=FALSE;

-drop exisiting broker configuration files on primary and standby (from the +ASM folders or regular file system)
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string +ASMDATA_DG/dbname/dgconfig/dr1xxxxx.dat
dg_broker_config_file2 string +ASMRECV_DG/dbname/dgconfig/dr2xxxxx.dat
dg_broker_start boolean TRUE


-ensure the value of DG_BROKER_CONFIG_FILE1 and DG_BROKER_CONFIG_FILE2 correctly in primary and standby

-enable broker in primary and standby
alter system set dg_broker_start=TRUE;

-create broker configuration again (do it from primary)
DGMGRL> create configuration 'XXXXXX' as primary database is 'XXXXXX' connect identifier is 'XXXXXX';
Configuration "XXXXXX" created with primary database "XXXXXX"

-add standby in configuration (do it from primary)
DGMGRL> ADD DATABASE 'XXXXXX' AS CONNECT IDENTIFIER IS 'XXXXXX' MAINTAINED AS PHYSICAL;
Database "XXXXXX" added

-enable configuration
DGMGRL> enable configuration;
Enabled.



Re: Incorrect database role [message #605831 is a reply to message #574904] Wed, 15 January 2014 03:25 Go to previous message
shubha.dalvi
Messages: 1
Registered: March 2012
Location: Mumbai
Junior Member
Hi

I am facing the same problem but after reconfiguration of broker still it is showing below error after reinstation of failed primary db

DGMGRL> show database racdb statusreport
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
* ERROR ORA-16816: incorrect database role
racdb2 ERROR ORA-16782: instance not open for read and write access

Previous Topic: log applying is taking long time
Next Topic: Changing SID after switchover
Goto Forum:
  


Current Time: Tue Apr 16 18:03:06 CDT 2024