在 Oracle 10g 第 2 版中编辑控制文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5339984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Edit the control file in Oracle 10g Release 2
提问by Sangeet Menon
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:
我试图将一个 oracle 数据库服务器克隆到另一个 oracle 数据库服务器。完成克隆后,当我尝试通过启动 SQL Plus 连接到数据库时,出现以下错误:
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/ccisv2/
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/..
更改数据文件的位置是不可能的,因为我的空间较少
/home/oracle/oradata/..
Can some one help me with this one...
有人可以帮我解决这个问题吗...
回答by DCookie
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 CONTROLFILEcommand):
您需要挂载数据库(而不是打开它)并重新创建控制文件,重命名进程中的数据文件(请参阅CREATE CONTROLFILE命令):
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.
您的所有数据库文件都需要在控制文件中使用它们的新位置重新标识。
回答by ik_zelf
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.
并对所有文件执行此操作。通常我们会使用 rman duplicate 并使用 file_name 转换来为我们做这件事。重新创建控制文件也是一种选择,重命名文件更容易。