Friday, January 16, 2009

Creating controlfile fails with ORA-01503, ORA-01161

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

STARTUP NOMOUNT PFILE='F:\PFILE.ORA'
CREATE CONTROLFILE REUSE DATABASE "shaikcl" RESETLOGS ARCHIVELOG
.
.
.

'F:\ORACLE\SHAIKCL\SYSTEM01.DBF',
.
.
.
CHARACTER SET WE8MSWIN1252
;

Now I ran this script to create controlfile and it fails
SQL> @f:\controlfile.ctl
ORACLE instance started.

Total System Global Area 104857600 bytes
Fixed Size 1247516 bytes
Variable Size 71304932 bytes
Database Buffers 25165824 bytes
Redo Buffers 7139328 bytes
CREATE CONTROLFILE REUSE DATABASE "shaikcl" NORESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01161: database name SHAIK file header does not match given name of
SHAIKCL
ORA-01110: data file 1: 'F:\ORACLE\SHAIKCL\SYSTEM01.DBF'
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 PFILE='F:\PFILE.ORA'
CREATE CONTROLFILE REUSE SET DATABASE "shaikcl" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'F:\ORACLE\SHAIKCL\REDO01.LOG' SIZE 50M,
GROUP 2 'F:\ORACLE\SHAIKCL\REDO02.LOG' SIZE 50M,
GROUP 3 'F:\ORACLE\SHAIKCL\REDO03.LOG' SIZE 50M
DATAFILE
'F:\ORACLE\SHAIKCL\SYSTEM01.DBF',
'F:\ORACLE\SHAIKCL\UNDOTBS01.DBF',
'F:\ORACLE\SHAIKCL\SYSAUX01.DBF',
'F:\ORACLE\SHAIKCL\USERS01.DBF',
'F:\ORACLE\SHAIKCL\EXAMPLE01.DBF',
'F:\ORACLE\SHAIKCL\TEST_TBS01.DBF'
CHARACTER SET WE8MSWIN1252
;
Now run this will successfully run,
SQL> @f:\controlfile.ctl
ORACLE instance started.

Total System Global Area 104857600 bytes
Fixed Size 1247516 bytes
Variable Size 71304932 bytes
Database Buffers 25165824 bytes
Redo Buffers 7139328 bytes

Control file created.

No comments:

Post a Comment