In a previous posting I wrote about password file maintenance in a clustered ASM and RAC environment.
This article raised another question: Is there anything specific about password file maintenance in a Data Guard environment?
Yes, updating a password file in a Data Guard environment isn’t as straight forward as one might think. In this posting I will shed some light on this subject and show you how to properly update a password file in a Data Guard environment.
Let’s get started by taking a look at my Data Guard setup before diving into password file maintenance procedures.
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
This output shows that I have a primary database called peppi, a physical standby database called kokki and that the overall status of my Data Guard configuration is healthy.
Note: peppi runs on host prutser and kokki runs on host el5.
Revealing the problem
The first question is: Are updates to the password file on the primary database propagated to the standby database(s)? We can easily figure this out by triggering an update to the password file on peppi followed by querying the password file on kokki.
SQL> connect sys/oracle@peppi as sysdba Connected. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE
Currently there is only one entry in the password file on peppi. By granting SYSDBA to SYSTEM we can trigger an update to the password file as shown below:
SQL> grant sysdba to system; Grant succeeded. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE SYSTEM TRUE FALSE FALSE
There are now two entries in the password file on the primary database. How many entries are there on the standby database?
SQL> connect sys/oracle@kokki as sysdba Connected. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE
The output above makes clear that updates to the password file on the primary database are not propagated to the standby database.
Before continuing, we take away SYSDBA from SYSTEM because we don’t want SYSTEM to become too powerful, do we?
SQL> connect sys/oracle@peppi as sysdba Connected. SQL> revoke sysdba from system; Revoke succeeded.
Does this affect Data Guard?
The next question is: Does this affect Data Guard? The primary database sends its redo to its standby database(s) and this redo transport is authenticated by the password of the SYS user, or another user if configured, of the primary database. That is, the primary database logs into a standby database by using the password stored in the password file for the user who ships the redo, which is most likely SYS. If the (encrypted) passwords of the primary database and the standby database(s) don’t match redo transport will (eventually) be in trouble.
To demonstrate this behavior we will change the SYS password on peppi and see if or how it affects kokki.
SQL> alter user sys identified by prutser; User altered. SQL> connect sys/prutser@peppi as sysdba Connected. SQL> connect sys/prutser@kokki as sysdba ERROR: ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE.
The above output shows (again) that an update to the password file on the primary database is not automatically propagated to the standby database(s).
SQL> connect sys/oracle@kokki as sysdba Connected.
As a matter of fact, we can still connect to kokki using the old SYS password as shown above.
The next question is: Is redo transport still possible now that the passwords are no longer the same? Let’s switch a few logs on the primary database and see what happens.
SQL> connect sys/prutser@peppi as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
According to the above output everything is still fine. Apparently the password change didn’t affect the redo transport. This is because the primary database was already logged into the standby database and as long as this connection remains open there is no need for the standby database to re-authenticate the incoming redo. However if we disable and re-enable redo transport it becomes clear that we indeed have a problem as shown below.
DGMGRL> edit database kokki set property LogShipping=off;
Property "logshipping" updated
DGMGRL> edit database kokki set property LogShipping=on;
Property "logshipping" updated
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
Error: ORA-16778: redo transport error for one or more databases
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
It is pretty clear that redo transport ceased indicated by the ORA-16778. It is important to realize that a problem caused by updating the password file on the primary database doesn’t necessarily show up immediately but may show up much later in time.
What is an ORA-16778 anyway?
$ oerr ora 16778 16778, 00000, "redo transport error for one or more databases" // *Cause: The redo transport service was unable to send redo data to one // or more standby databases. // *Action: Check the Data Guard broker log and Oracle alert log for // more details. Query the LogXptStatus property to see the // errors.
Because we just changed the SYS password on the primary database we already know what caused the ORA-16778. So the question is: How do we fix this?
In search of a solution
Maybe we can simply re-create the password file on kokki with the new SYS password? Let’s give it a try:
el5$ rm $ORACLE_HOME/dbs/orapwv1120 el5$ orapwd file=$ORACLE_HOME/dbs/orapwv1120 password=prutser SQL> connect sys/prutser@kokki as sysdba Connected.
That seems to work! The question is of course: Does Data Guard agree with my optimism?
SQL> connect sys/prutser@peppi as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
Error: ORA-16778: redo transport error for one or more databases
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
Hmmm, this doesn’t look too good, does it? Maybe we need to disable and re-enable redo shipment?
DGMGRL> edit database kokki set property LogShipping=off;
Property "logshipping" updated
DGMGRL> edit database kokki set property LogShipping=on;
Property "logshipping" updated
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
Error: ORA-16778: redo transport error for one or more databases
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
No, this didn’t help either. Re-creating the password file on the standby database is not the solution. The reason for this is the way the passwords are encrypted in the password file. Even if the passwords are the same, the result of the encryption is not.
How about copying the password file from the primary database to the standby database?
The solution
We will copy the password file from peppi to kokki and see if it works:
$ scp $ORACLE_HOME/dbs/orapwv1120 el5:$ORACLE_HOME/dbs/orapwv1120 orapwv1120 100% 1536 1.5KB/s 00:00 SQL> connect sys/prutser@kokki as sysdba Connected.
Again we can connect to kokki with the updated SYS password, but is Data Guard happy now?
SQL> connect sys/prutser@peppi as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
Error: ORA-16778: redo transport error for one or more databases
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
Hmmm, again Data Guard doesn’t look like a happy camper. But things are not what they seem. If we wait long enough Data Guard will re-open its archive destinations and redo will automatically flow again. We can trigger this by disabling and re-enabling redo shipment:
DGMGRL> edit database kokki set property LogShipping=off;
Property "logshipping" updated
DGMGRL> edit database kokki set property LogShipping=on;
Property "logshipping" updated
DGMGRL> show configuration;
Configuration - PeppiEnKokki
Protection Mode: MaxPerformance
Databases:
peppi - Primary database
kokki - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
Finally Data Guard is back in business again because the primary database is able to login on its standby database(s) and thereby successfully ship redo to them.
In summary
In order to keep Data Guard going, we must copy the password file from the primary database to the standby database(s) after an update is made to the password file on the primary database. Happy Data Guarding ;-)
-Harald