Thursday 6 June 2013

How to Mirror control files/redolog files in oracle.


How to Mirror control files/redolog files in oracle.
Mirror control files in oracle 

In this document we will mirror control file 01, thus keeping two
                 copies of this files in two different locations.

When using spfile:

1) create pfile from spfile so you have the latest version of the spfile.
create pfile from spfile;
2) graceful shutdown the database (immediate, startup restrict open, shutdown normal)
3) copy the controlfiles to new location
cp /u01/oradata/emrep/control01.ctl /u02/oradata/emrep/control01.ctl
4) make changes in the pfile updating the control_files parameter.
5) startup the database.
startup pfile=’/u01/app/oracle/product/9.0.1/dbs/initEMREP.ora’
6) recreate the spfile using the command create spfile from pfile
create spfile from pfile
shutdown immediate
7) startup the database.
show parameter spfile and make sure it used the spfile
 show parameter control to verify control file location.

When not using spfile:

1) graceful shutdown the database (immediate, startup restrict open, shutdown normal)
2) copy the controlfiles to new location
cp /u01/oradata/emrep/control01.ctl /u02/oradata/emrep/control01.ctl
3) make changes in the pfile (initSID.ora) updating the control_files parameter.
4) startup the database.
startup





 Mirror Oracle database redo logs files.

Assuming that you currently have redo logs group 1, 2 and 3. Verify by using the following
query:
set linesize 130
select * from v$log;
1) alter database backup controlfile to trace;
=================================
2) Create new groups:
=====================
alter database add logfile group 4
(‘/u01/oradata/emrep/redo04.log’, ‘/u02/oradata/emrep/redo04.log’) size 100M;
alter system switch logfile;
–>until you get to group 4.
set linesize 130
select * from v$log;
–> Make sutre group 1,2 and 3 are not active before you drop them
3)Drop current redo:
====================
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
Go to OS and delete corresponding files to log group 1, 2 and 3. Be extremely carful not to
delete the wrong files.
4) Add mirrored groups:
====================
alter database add logfile group 1
(‘/u01/oradata/emrep/redo01.log’,'/u02/oradata/emrep/redo01.log’) size 100 M;
alter database add logfile group 2
(‘/u01/oradata/emrep/redo02.log’,'/u02/oradata/emrep/redo02.log’) size 100 M;
alter database add logfile group 3
(‘/u01/oradata/emrep/redo03.log’,'/u02/oradata/emrep/redo03.log’) size 100 M;

alter system switch logfile;
select * from v$log;
–>Make sure all groups are there and mirrored.

No comments:

Post a Comment