How To Recreate The Control File On 10gR2 RAC With ASM and Data Guard
How To Recreate The Control File On 10gR2 RAC With ASM and Data Guard
How To Recreate The Control File On 10gR2 RAC With ASM and Data Guard
Data Guard
Recently, I had the pleasure of having to rebuild the control file on a three-
node RAC cluster with two, single, stand-alone standby databases on
different servers in different locations and all of them are using ASM. Sound
like a handful? You bet! The most difficult portion was finding the
information on how to do it.
I've done hundreds of control file rebuilds dating back to Oracle7. I've
created standby databases since Oracle8i. I am experienced with Oracle8i's
Oracle Parallel Server (OPS) and Oracle 9i, Oracle 10gR1, and Oracle 10gR2
Real Application Clusters installing, tuning, configuring with and without
ASM. Try finding all of these components in a step-by-step document is
impossible.
In case you are ever experience the need to Recreate a Control file on
Oracle 10gR2 RAC with ASM and have physical standby databases involved,
here are the steps to do it.
Since this is a RAC database, create an initialization file from your current
SPFILE to be used later.
SQL> create pfile='/db/app/oracle/wkdir/init_new.ora' from
spfile;
If you have lost all copies of the control file, a new one will need to be
generated using SQL. The syntax is available in the SQL Reference manual
for all versions.
Database altered.
SQL> exit
cd /db/app/oracle/admin/dgvd/udump
Find the trace file using "ls -ltr" in the user_dump_dest, it will probably be
the last or one of the last files listed as it will be very recent.
/db/app/oracle/admin/dgvd/udump> ls -ltr
Copy, move, or rename the last file to a name you will remember. In my
case, I called it ctrl_dgvd.sql. I also moved it to a working directory I will
use later on.
oracle@rmodbp03:/db/app/oracle/admin/dgvd/udump > mv
dgvd1_ora_18404.trc /db/app/oracle/wkdir/ctrl_dgvd1.sql
Change to the working directory or wherever you placed you new file. I
make a couple of copies of the same file so I can edit one and keep one as
the standard.
First Script Copy: Edit the two lines by including the path of the initialization
file you backed up in the beginning and adding the word "set" before the
word database.
Notice that in the script all of the logfiles are listed together. We will need to
separate these out by thread. This is a great time to start using your backup
copies of your new controlfile script. I use four scripts, one for each step in
the process. I'll keep the original untouched. I'll use the First copy of the
script for these steps. First remove all logfiles listed that are not from the
first instance or Thread 1. In this case, I removed Groups 4, 5, and 6 from
Thread 2 and Groups 7, 8, and 9 from Thread 3. Your first script should look
like this:
Second Script Copy: The second script is one and only one line. It is the most
crucial of all the steps. This script will use the backup controlfile to recover
the database and make sure all the log files, datafiles, and controlfiles will be
in sync.
When this is finished you should get a "Media Recovery Complete" message.
Third Script Copy: Because not all of the logfiles are listed before the
controlfile is created, such as additional threads or standby log files, you will
need to use the RESETLOGS option on the create controlfile statement. With
RAC, this is absolutely necessary. By Opening with the RESETLOGS Option,
all of the SCN's will be reset back to zero. At the same time, I will add the
additional log groups listed by thread#. My third script looks like this:
After the alter database open command, add an "alter database enable
public thread #" command(s). Do this for each additional thread to be
added.
NOTE: It is highly recommended to take a full backup of the database after completing
this procedure.
Final Script Copy: The last step in rebuilding the control file requires rebuilding the
temp tablespace. For example:
First, edit your initialization parameter file with the following setting:
cluster_database=false
Stop all instances and database that need the controlfile built cleanly with
srvctl. DO NOT SHUT DOWN ASM or CRS or other databases.
srvctl -stop database -d dgvd
This is a good point to take cold backups or copying your existing controlfiles
to disk.
SQL> @dgvd1_ctl
If you get the "Statement processed" message, the database will be opened
with a brand new control file.
SQL> startup