Steps to create Control File during System Refresh:
Creating control file is not difficult task but sometime small mistake can leads to major issues while recovering Database during System Refresh.
Below are the steps and measures should be taken while creating control file on Target system:
1. In system Refresh, once the Online/Offline backup of Source System completed, immediately.create a trace file from the control file on the Source system and move that Trace file to the Target System.
In one of the refresh we faced issues while recovering Database, it was asking for log which does not exist in the back<SID>.log this is due to someone added 6 Datafiles after backup completion and trace file created after 2 days.
On source system as ora<sid>:
sqlplus “/ as sysdba”
SQL> alter database backup controlfile to trace;
SQL> exit;
File <sid>_ora_nnnnn.trc is created in /oracle/<SID>/saptrace/diag/rdbms/<sid>/<SID>/trace.
Copy
this file to CONTROL.SQL.
2.One more precaution, mostly people use Vi editor to edit and prepare control file.
I will suggest rather emphasis on Notepad. copy all the contents of the trace file and paste it on the local notepad file.
Most of the time in VI editor, small space or accidentally some punctuation mark goes wrong and control file we prepared is not right.even some are not used to VI editor commands, so Notepad is the safe and easy option.
orasid>cat <sid>_ora_nnnnn.trc
select all and copy paste it in the Notepad.
3. On Target System, save number of Online Redolog files:
SQL> select group#, sequence#, archived, status, bytes from v$log;
GROUP#
SEQUENCE# ARC STATUS
BYTES
----------
---------- --- ---------------- ----------
11
1041 YES INACTIVE
1073741824
12
1042 YES INACTIVE
1073741824
13
1043 YES INACTIVE
1073741824
14
1044 YES INACTIVE
1073741824
15
1045 YES INACTIVE
1073741824
16
1046 YES INACTIVE
1073741824
17
1047 NO CURRENT 1073741824
18 1040 YES INACTIVE 1073741824
8
rows selected.
We have taken screen-shots (before Refresh) of this Target Redolog group sequence and size because after refresh also we want to set it as it is not like source system Redolog Group Sequence and size which we will maintain in control file.
Calculate Size of one Redolog Group in MB:
1073741824/1024/1024=1024M
4. Open Controlfile Notepad to edit.
There will be 2 sets starting from Startup to UTF8.
Remove all lines after first occurrence of CHARACTER
SET UTF8 ;
5. At the end of
the tracefile you will find some comments about the TEMP files (used for
PSAPTEMP). Save these entries in a TEMP.SQL in same location as CONTROL.SQL.
Entries can later be used for setting up (after changing contents of TEMP.SQL)
to setup TEMP files.
Example:
ALTER TABLESPACE PSAPTEMP ADD TEMPFILE
'/oracle/SID/sapdata11/temp_1/temp.data1'
SIZE 6192M REUSE AUTOEXTEND OFF;
7. Change
CREATE CONTROLFILE REUSE
DATABASE "<sourceSID>"
NORESETLOGS ARCHIVELOG
into
CREATE CONTROLFILE SET
DATABASE "<targetSID>"
RESETLOGS NOARCHIVELOG
select Match case option.
9. Check the value for MAXLOGFILES (best to set to 255
10. Change the number and size of the online redologs to the original value (see step 4.19).
Example:
source system GROUP 11-20, target system GROUP 11-18
source system = SIZE 2048M,
target system = SIZE 1024M
When
deleting obsolete groups be aware to have no , (comma) after last GROUP
11. Cross check edited controlfile notepad once again whether all changes has been done or not.
12.select all content of controlfile notepad and copy.
go to target system path: /oracle/SID/saptrace/diag/rdbms/sid/SID/trace/
create CONTROL.SQL file using vi command.
orasid> vi CONTROL.SQL
press escape key then press key i
press keys Shift+insert (it will paste all the copied content of the controlfile saved in notepad to the CONTROL.SQL)
once done press escape then :wq! to save the file.
Edited Control file will look like
below:
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE
"ED2" RESETLOGS FORCE LOGGING NOARCHIVELOG
MAXLOGFILES 255
MAXLOGMEMBERS 3
MAXDATAFILES 508
MAXINSTANCES 50
MAXLOGHISTORY 19948
LOGFILE
GROUP 11 (
'/oracle/ED2/origlogC/log_g11m1.dbf',
'/oracle/ED2/mirrlogC/log_g11m2.dbf'
) SIZE 1024M BLOCKSIZE 512,
GROUP 12 (
'/oracle/ED2/origlogD/log_g12m1.dbf',
'/oracle/ED2/mirrlogD/log_g12m2.dbf'
) SIZE 1024M BLOCKSIZE 512,
GROUP 13 (
'/oracle/ED2/origlogC/log_g13m1.dbf',
'/oracle/ED2/mirrlogC/log_g13m2.dbf'
) SIZE 1024M BLOCKSIZE 512,
GROUP 14 (
'/oracle/ED2/origlogD/log_g14m1.dbf',
'/oracle/ED2/mirrlogD/log_g14m2.dbf'
) SIZE 1024M BLOCKSIZE 512,
GROUP 15 (
'/oracle/ED2/origlogC/log_g15m1.dbf',
'/oracle/ED2/mirrlogC/log_g15m2.dbf'
) SIZE 1024M BLOCKSIZE 512,
GROUP 16 (
'/oracle/ED2/origlogD/log_g16m1.dbf',
'/oracle/ED2/mirrlogD/log_g16m2.dbf'
) SIZE 1024M BLOCKSIZE 512,
GROUP 17 (
'/oracle/ED2/origlogC/log_g17m1.dbf',
'/oracle/ED2/mirrlogC/log_g17m2.dbf'
) SIZE 1024M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/oracle/ED2/sapdata1/system_1/system.data1',
'/oracle/ED2/sapdata1/sysaux_1/sysaux.data1',
'/oracle/ED2/sapdata1/undo_1/undo.data1',
'/oracle/ED2/sapdata2/sr3_1/sr3.data1',
'/oracle/ED2/sapdata54/undo_18/undo.data18',
'/oracle/ED2/sapdata1/sr3usr_1/sr3usr.data1',
'/oracle/ED2/sapdata4/sr3_2/sr3.data2',
'/oracle/ED2/sapdata5/sr3_3/sr3.data3',
'/oracle/ED2/sapdata6/sr3_4/sr3.data4',
'/oracle/ED2/sapdata7/sr3_5/sr3.data5',
'/oracle/ED2/sapdata8/sr3_6/sr3.data6',
'/oracle/ED2/sapdata9/sr3_7/sr3.data7',
'/oracle/ED2/sapdata10/sr3_8/sr3.data8',
'/oracle/ED2/sapdata11/sr3_9/sr3.data9',
'/oracle/ED2/sapdata12/sr3_10/sr3.data10',
'/oracle/ED2/sapdata13/sr3_11/sr3.data11',
'/oracle/ED2/sapdata14/sr3_12/sr3.data12',
'/oracle/ED2/sapdata15/sr3_13/sr3.data13',
'/oracle/ED2/sapdata16/sr3_14/sr3.data14',
'/oracle/ED2/sapdata17/sr3_15/sr3.data15',
'/oracle/ED2/sapdata18/sr3_16/sr3.data16',
'/oracle/ED2/sapdata19/sr3_17/sr3.data17',
'/oracle/ED2/sapdata20/sr3_18/sr3.data18',
'/oracle/ED2/sapdata21/sr3_19/sr3.data19',
'/oracle/ED2/sapdata22/sr3_20/sr3.data20',
'/oracle/ED2/sapdata2/undo_2/undo.data2',
'/oracle/ED2/sapdata3/undo_3/undo.data3',
'/oracle/ED2/sapdata5/undo_5/undo.data5',
'/oracle/ED2/sapdata4/undo_4/undo.data4',
'/oracle/ED2/sapdata6/undo_6/undo.data6',
'/oracle/ED2/sapdata26/undo_7/undo.data7',
'/oracle/ED2/sapdata27/undo_8/undo.data8',
'/oracle/ED2/sapdata28/undo_9/undo.data9',
'/oracle/ED2/sapdata29/undo_10/undo.data10',
'/oracle/ED2/sapdata10/sr3usr_4/sr3usr.data4'
CHARACTER SET UTF8
;
13. Create control file at the Target system:
sqlplus
"/as sysdba"
SQL*Plus:
Release 11.2.0.2.0 Production on Wed Dec 12 19:30:38 2012
Copyright
(c) 1982, 2010, Oracle. All rights
reserved.
Connected
to an idle instance.
SQL>
@/oracle/ED2/saptrace/diag/rdbms/ed2/ED2/trace/CONTROL.SQL
ORA-32004:
obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE
instance started.
Total
System Global Area 3206836224 bytes
Fixed
Size 2223904 bytes
Variable
Size 1174405344 bytes
Database
Buffers 2013265920 bytes
Redo
Buffers 16941056 bytes
Control
file created.