写在前面:联系环境,之前操作换存储备份的时候,所有的文件已经迁移到新的磁盘,并且原目录的文件已经删除,今天再次启动数据库,报错
SQL> startup
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 327158824 bytes
Database Buffers 79691776 bytes
Redo Buffers 4268032 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open RESETLOGS;
alter database open RESETLOGS
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/ooradata/test1/system01.dbf'
这是啥问题呢,启动老是去原位置去找,查看数据文件在哪
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/ooradata/test1/system01.dbf
/ooradata/test1/sysaux01.dbf
/ooradata/test1/undotbs01.dbf
/ooradata/test1/users01.dbf
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/ooradata/test1/control01.ctl
/u01/app/oracle/fast_recovery_area/test1/control02.ctl
数据文件在原位置,控制文件也在原位置,肯定是参数文件的问题,
先生成一个pfile看看控制文件位置。
SQL> create pfile='/home/oracle/cs/qq.txt' from spfile;
create pfile='/home/oracle/cs/qq.txt' from spfile
*
ERROR at line 1:
ORA-01565: error in identifying file '?/dbs/spfile@.ora'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
这说明现在数据库启动不是以新的spfile起的,指定一下spfile
SQL> create pfile='/home/oracle/cs/qq.txt' from spfile='/u01/app/oracle/product/11.2/db_1/dbs/spfiletest1.ora';
File created.
查看qq.txt
vi qq.txt
控制文件已经是新的目录了。于是启动的时候只要制定新的pfile
SQL> shutdown immediate
SQL> create spfile from pfile='/home/oracle/cs/qq.txt';
File created.
SQL> startup
ORACLE instance started.
Total System Global Area 413372416 bytes
Fixed Size 2253784 bytes
Variable Size 327158824 bytes
Database Buffers 79691776 bytes
Redo Buffers 4268032 bytes
Database mounted.
Database opened.
解决