rename datafile时报错ORA-01511,ORA-01121,ORA-01110
rename datafile时报错ORA-01511,ORA-01121,ORA-01110
现象:
实例启动到mount之后,rename datafile时报错ORA-01511,ORA-01121,ORA-01110
SQL>
SQL> ALTER DATABASE RENAME FILE '+DATA/rac/datafile/system.416.833384105' TO '+TESTDG/rac/datafile/system.dbf';
ALTER DATABASE RENAME FILE '+DATA/rac/datafile/system.416.833384105' TO '+TESTDG/rac/datafile/system.dbf'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01121: cannot rename database file 1 - file is in use or recovery
ORA-01110: data file 1: '+DATA/rac/datafile/system.416.833384105'
分析:
只所以出现这种情况因为我的DB是RAC环境,另一个节点是open状态,导致出现上面报错。
解决方案:
关闭另一个节点的实例。
[Oracle@saprac4 ~]$ dba
SQL*Plus: Release 11.1.0.6.0 - Production on Thu Dec 5 16:15:06 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
再在节点1上执行rename datafile。
SQL> ALTER DATABASE RENAME FILE '+DATA/rac/datafile/system.416.833384105' TO '+TESTDG/rac/datafile/system.dbf';
Database altered.
SQL>
SQL>
SQL> ALTER DATABASE RENAME FILE '+DATA/rac/datafile/sysaux.417.833384107' TO '+TESTDG/rac/datafile/sysaux.dbf';
ALTER DATABASE RENAME FILE '+DATA/rac/datafile/undotbs1.418.833384107' TO '+TESTDG/rac/datafile/undotbs1.dbf';
ALTER DATABASE RENAME FILE '+DATA/rac/datafile/users.419.833384109' TO '+TESTDG/rac/datafile/users.dbf';
ALTER DATABASE RENAME FILE '+DATA/rac/datafile/undotbs2.424.833384491' TO '+TESTDG/rac/datafile/undotbs2.dbf';
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
SQL>
SQL>
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '+TESTDG/rac/datafile/system.dbf'
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+TESTDG/rac/datafile/system.dbf
+TESTDG/rac/datafile/sysaux.dbf
+TESTDG/rac/datafile/undotbs1.dbf
+TESTDG/rac/datafile/users.dbf
+TESTDG/rac/datafile/undotbs2.dbf
SQL>