Monday 7 December 2015

Creating controlfile fails with ORA-01503, ORA-01161

Creating controlfile fails with ORA-01503, ORA-01161 

Problem Description

While creating cloning database I have modified controlfile contents as below where I like to change my database name to SIT1.

I have backed  up the control file from my production database by using the below query.
ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/temp/debashis.trc';

So when I copy the content from my prod control file and just named the db name to SIT1 with changing the location of the db file as per SIT environment like below..

STARTUP NOMOUNT
CREATE CONTROLFILE RESUE DATABASE "SIT1" RESETLOGS FORCE LOGGING ARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 3
    MAXDATAFILES 500
    MAXINSTANCES 8
    MAXLOGHISTORY 6135
LOGFILE
  GROUP 1 '/u02/oradata/SIT1/redo01.log'  SIZE 1024M BLOCKSIZE 512,
  GROUP 2 '/u02/oradata/SIT1/redo02.log'  SIZE 1024M BLOCKSIZE 512,
  GROUP 3 '/u02/oradata/SIT1/redo03.log'  SIZE 1024M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u06/oradata/SIT1/system01.dbf',
  '/u06/oradata/SIT1/sysaux01.dbf',
  '/u01/oradata/SIT1/undo_ts01.dbf',
  '/u02/oradata/SIT1/users01.dbf',
  '/u05/oradata/SIT1/orabpel.dbf',
  '/u06/oradata/SIT1/retek_index01.dbf',
  '/u01/oradata/SIT1/retek_data01.dbf',
  '/u05/oradata/SIT1/lob_data01.dbf',
  '/u02/oradata/SIT1/retek_part01_d01.dbf',
'/u06/oradata/SIT1/retek_index07.dbf'
CHARACTER SET AL32UTF8
;


And I got below error:


 After googling, I got to find out that 

Cause of The Problem
Control file script has been changed, more specifically database name has been changed.

Solution of the Problem
To create the new controlfile for the new database you must use the word 'SET'
in the CREATE CONTROLFILE COMMAND.
The SET DATABASE command is what enables the
changes to the name of the database. So the script will be like below

 STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "SIT1" RESETLOGS FORCE LOGGING ARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 3
    MAXDATAFILES 500
    MAXINSTANCES 8
    MAXLOGHISTORY 6135
LOGFILE
  GROUP 1 '/u02/oradata/SIT1/redo01.log'  SIZE 1024M BLOCKSIZE 512,
  GROUP 2 '/u02/oradata/SIT1/redo02.log'  SIZE 1024M BLOCKSIZE 512,
  GROUP 3 '/u02/oradata/SIT1/redo03.log'  SIZE 1024M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u06/oradata/SIT1/system01.dbf',
  '/u06/oradata/SIT1/sysaux01.dbf',
  '/u01/oradata/SIT1/undo_ts01.dbf',
  '/u02/oradata/SIT1/users01.dbf',
  '/u05/oradata/SIT1/orabpel.dbf',
  '/u06/oradata/SIT1/retek_index01.dbf',
  '/u01/oradata/SIT1/retek_data01.dbf',
  '/u05/oradata/SIT1/lob_data01.dbf',
  '/u02/oradata/SIT1/retek_part01_d01.dbf'
CHARACTER SET AL32UTF8
;

 SQL> @controlfile.ctl
ORACLE instance started.

Total System Global Area 8551575552 bytes
Fixed Size 2236744 bytes
Variable Size 6006247096 bytes
Database Buffers 2533359616 bytes
Redo Buffers 9732096 bytes

Control file created.