Saturday, November 5, 2011

ORA-01620 When mounting a standby database

Hi,

Recently we had task to setup a DG for a RAC database.
The primary and the DG were 11g.

After copying the primary database to the DG server, we tried to mount the database on the
DG server before starting the recovery. But we got the below error

SQL> alter database mount standby database;
alter database mount standby database
*
ERROR at line 1:
ORA-01620: no public threads are available for mounting

The alert log had only the below entry and also no trace file was generated for the error.
ORA-1620 signalled during: alter database mount

From the error it was clear that it was issue with the redo log threads. But for building a DG we need not add redo threads at the standby database and also as we were not going to do a DG
Broker setup hence standby redo log file addition was also not necessary. Hence it became sure to us that the issue was not on the standby database side but on the primary database

TROUBLESHOOTING:

On the Primary Database when we ran the below query we found that the threads were
enabled for the RAC instances in PRIVATE mode and not in PUBLIC mode which is needed for the DG to work.

SQL> select thread#,status,enabled from v$thread;

THREAD# STATUS ENABLED
---------- ------ --------
1 OPEN PRIVATE
2 OPEN PRIVATE
3 OPEN PRIVATE
4 OPEN PRIVATE

In the RAC system, each instance has to have its own redo log groups. The redo log file groups of an instance are collectively called a thread, or more appropriately, a redo log thread. The redo threads can be private or public. If the redo thread is public then any instance
can acquire it and if it is private then only a specific instance can acquire it as mentioned in the
initialization file.

SOLUTION:

Inorder to get the DG running, we must convert all the redo threads to PUBLIC in primary
database, create the standby control file, and mount the standby database with this standby
control file.
Below are the steps followed by us, but there are can be deviations.

Note: To enable or disable threads the database has to be in open mode

1. Shut down all instances other than the instance 1

2. Disable the threads as you cannot change the mode from PRIVATE to PUBLIC directly.

SQL> alter database enable public thread 1;
alter database enable public thread 1
*
ERROR at line 1:
ORA-01612: instance TSEP (thread 1) is already enabled

Hence we have disable it and then enable in PUBLIC mode

alter database disable thread 2;
alter database disable thread 3;
alter database disable thread 4;

Also you cannot disable thread 1 at this point, as the instance 1 will be using it
SQL> alter database disable thread 1;
alter database disable thread 1
*
ERROR at line 1:
ORA-01615: instance TSEP (thread 1) is mounted - cannot disable

3. Enable the threads in PUBLIC mode

alter database enable public thread 2;
alter database enable public thread 3;
alter database enable public thread 4;

4. Shut down instance 1 and open the database in instance 2.
Repeat the disable thread and enable thread in PUBLIC mode for instance 1

alter database disable thread 2;
alter database enable public thread 2;

5. Start all the other instances of the RAC including instance 1

6. Create the standby control file again on the primary database

7. Copy the standby control file to the standby database and mount the database
SQL> alter database mount standby database;
Database mounted

8. Start the recovery process

-- Tanveer Madan



No comments: