开发者

Edit the control file in Oracle 10g Release 2

I tried to clone an oracle database server to another oracle database server. After I completed the cloning, when I tried connecting to the database by starting SQL Plus I got the following errors:

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/home/oracle/oradata/ccisv2/system01.dbf'

I found that while cloning the control file of the original database location also got cloned.

Now in the new server I have the data files located at a different location. and that is not affected in the control file, which is the reason for the error.

In short I need to change the above path

/home/oracle/oradata/ccisv开发者_开发百科2/

to a new path

/home2/oracle/oradata/ccisv2/

I am not sure how can I change the control file and edit the path of the data file location.

Changing of the location of datafiles is not possible as I have less space in /home/oracle/oradata/..

Can some one help me with this one...


You'll need to mount the database (not open it) and re-create the controlfile, renaming the data files in the process (see the CREATE CONTROLFILE command):

STARTUP MOUNT;
CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS 
    MAXLOGFILES NN
    MAXLOGMEMBERS N
    MAXDATAFILES 254
    MAXINSTANCES 1
    MAXLOGHISTORY 1815
LOGFILE
  GROUP 1 '/home2/oracle/oradata/ccisv2/REDO01.LOG'  SIZE 56M,
  GROUP 2 '/home2/oracle/oradata/ccisv2/REDO02.LOG'  SIZE 56M,
  GROUP 3 '/home2/oracle/oradata/ccisv2/REDO03.LOG'  SIZE 56M
DATAFILE
  '/home2/oracle/oradata/ccisv2/SYSTEM.DBF',
  '/home2/oracle/oradata/ccisv2/USERS.DBF',
  '/home2/oracle/oradata/ccisv2/sysaux.DBF',
  '/home2/oracle/oradata/ccisv2/TOOLS.DBF',
etc...
CHARACTER SET WE8ISO8859P1;

ALTER DATABASE OPEN RESETLOGS;

QUIT;

All of your database files need to be re-identified in the controlfile with their new location.


Easiest is to just rename the datafiles to the new locations:

startup mount;
alter database rename file '/home/oracle/oradata/ccisv2/system01.dbf' to '/home2/oracle/oradata/ccisv2/system01.dbf';

and do this for all your files. Normally we would use rman duplicate and use the file_name convert to do this for us. re-creating the controlfile is also an option, renaming the files is easier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜