现象描述:
从服务器,在未停数据库服务情况下,拍快照还原到另一台服务器,启动数据库报错。
过程记录:
一、启动数据库提示:ORA-01102
报错信息:
ORA-01102: cannot mount database in EXCLUSIVE mode执行操作:
查看用于锁内存的文件lk和sgadef.dbf文件是否被删除
cd $ORACLE_HOME/dbs
ls lk*
lksid文件没有被删除。将它删除掉
rm lk*
二、再次启动数据库提示:ORA-00205
报错信息:
ORA-00205: error in identifying control file, check alert log for more info执行操作:
查看共享内存段
ipcs -map
根据ID号清除共享内存段(仅清理oracle的)
ipcrm -m 32768
ipcrm -m 65537
ipcrm -m 98306
ipcrm -m 393222
ipcrm -m 425991
ipcrm -m 458760查看信号量
ipcs -s根据semid清除信号量
ipcrm -s 229378
ipcrm -s 491523
三、再次启动数据库提示:ORA-01122、ORA-01110、ORA-01207
报错信息:
ORA-01122: 数据库文件 1 验证失败
ORA-01110: 数据文件 1:
'/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/ORCLDW/SYSTEM01.DBF'
ORA-01207: 文件比控制文件更新 - 旧的控制文件执行操作:
1.SQL>alter database backup controlfile to trace as '/apps/dbBAKUP';
数据库已更改。(/apps/dbBAKUP中,dbBACKUP文件只需在此处创建)2.SQL>shutdown immediate;
如果数据库是打开状态,则关闭
ORA-01109: 数据库未打开已经卸载数据库3.SQL>startup nomount;
ORACLE 例程已经启动。
Total System Global Area 105979576 bytes
Fixed Size 454328 bytesVariable Size 79691776 bytes
Database Buffers 25165824 bytesRedo Buffers 667648 bytes4.vi之类的命令打开生成的/apps/dbBAKUP文件;找到STARTUP NOMOUNT字样,然后下面可以看到类似语句CREATE CONTROLFILE REUSE DATABASE "DBF001" NORESETLOGS NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292LOGFILEGROUP 1 '/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/REDO01.LOG' SIZE 50M,GROUP 2 '/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/REDO02.LOG' SIZE 50M,GROUP 3 '/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/ORCLDW/REDO03.LOG' SIZE 50MDATAFILE'F:/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/SYSTEM01.DBF',
'/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/UNDOTBS01.DBF',‘/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/SYSAUX01.DBF','/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/USERS01.DBF','/apps/ORACLE/PRODUCT/10.2.0/DB_1/ORADATA/DBF001/EXAMPLE01.DBF'CHARACTER SET ZHS16GBK;
执行上面这段语句重建控制文件5.SQL>RECOVER DATABASE;
# 恢复指定表空间、数据文件或整个数据库6.SQL>ALTER DATABASE OPEN;
# 打开数据库7.查看库状态
SQL> SELECT NAME,OPEN_MODE FROM V$DATABASE;
NAME OPEN_MODE
--------- --------------------
DBF001 READ WRITE
至此启动完成