SQL>
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2.3 orcale 11.2g的控制文件的备份目录为
/u01/app/oracle/diag/rdbms/ORCL/test/trace ###告警日志里面 ,注意rdbms后面应该是ORCL,因为数据库名字还没有改变。
[oracle@localhost trace]$ ls -lrt
总计 80
-rw-r----- 1 oracle oinstall 256 10-01 17:03 test_ora_5286.trm
-rw-r----- 1 oracle oinstall 14393 10-01 17:03 test_ora_5286.trc
-rw-r----- 1 oracle oinstall 68 10-01 17:03 test_mman_5334.trm
-rw-r----- 1 oracle oinstall 852 10-01 17:03 test_mman_5334.trc
-rw-r----- 1 oracle oinstall 61 10-01 17:03 test_cjq0_5437.trm
-rw-r----- 1 oracle oinstall 993 10-01 17:03 test_cjq0_5437.trc
-rw-r----- 1 oracle oinstall 82 10-01 17:04 test_dbrm_5328.trm
-rw-r----- 1 oracle oinstall 1172 10-01 17:04 test_dbrm_5328.trc
-rw-r----- 1 oracle oinstall 90 10-01 17:05 test_vktm_5320.trm
-rw-r----- 1 oracle oinstall 1233 10-01 17:05 test_vktm_5320.trc
-rw-r----- 1 oracle oinstall 72 10-01 17:05 test_vkrm_5439.trm
-rw-r----- 1 oracle oinstall 996 10-01 17:05 test_vkrm_5439.trc
-rw-r----- 1 oracle oinstall 174 10-01 17:05 test_ora_5419.trm
-rw-r----- 1 oracle oinstall 5894 10-01 17:05 test_ora_5419.trc
-rw-r----- 1 oracle oinstall 5969 10-01 17:05 alert_test.log
[oracle@localhost trace]$ vim alert_test.log
可以在 alter_test.log里找到contolfile的备份trc,<em>sid_</em>ora_nnnn.trc 最新的一个就是。
alter_test.log里面有这样一行字样,告诉你哪个是控制备份文件
Backup controlfile written to trace file /u01/app/oracle/diag/rdbms/orcl/test/trace/test_ora_5419.trc
2.5复制一份
[oracle@localhost trace]$ cp test_ora_5419.trc test.sql
2.6编辑 test.sql,也就是test_ora_5419.trc的复制品。
1)查找STARTUP NOMOUNT语句,将这一行上面的所有行都删除
2)查找所有以--开始的行,把这些行删除
3)查找所有的orcl修改为test,所有的ORCL修改为test ###这个步骤不做也可以,做的目的就是为了符合规矩,实际上控制文件数据文件的目录是可以随便起的。
4)找到CREATE CONTROLFILE REUSE DATABASE...语句,将其中的REUSE修改为SET
5)找到RECOVER DATABASE USING BACKUP CONTROLFILE语句,将其用双横线(--)注释掉
结果如下:
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "test" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/test/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/test/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/test/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/test/system01.dbf',
'/u01/app/oracle/oradata/test/sysaux01.dbf',
'/u01/app/oracle/oradata/test/undotbs01.dbf',
'/u01/app/oracle/oradata/test/users01.dbf',
'/u01/app/oracle/oradata/test/example01.dbf'
CHARACTER SET ZHS16GBK
;
--RECOVER DATABASE USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/test/temp01.dbf'
SIZE 30408704 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
2.7生成配置文件
[oracle@localhost trace]$ sqlplus /as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 1 17:12:48 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile;
File created.
SQL> exit
Disconnected
2.8目录更改,这里和oracle 10g不一样,要注意。