(1)数据库没有备份或备份失效
*****************************************数据库出于归档模式*****************************************
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL> !
[oracle@ora11 ~]$ exit
exit
*****************************************备份控制文件到trace*****************************************
SQL> alter database backup controlfile to trace as '/home/oracle/cre_ctl.sql';
Database altered.
SQL> !
*****************************************可以看出当前数据库没有可用的备份*****************************************
[oracle@ora11 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jan 26 15:37:52 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11 (DBID=715093527)
RMAN> list backup;
using target database control file instead of recovery catalog
specification does not match any backup in the repository
RMAN> exit
Recovery Manager complete.
[oracle@ora11 ~]$ exit
exit
*****************************************查看控制文件的存储位置并删除控制文件*****************************************
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/oracle/oracle11/oradata/o
ra11/control01.ctl, /u01/oracl
e/oracle11/flash_recovery_area
/ora11/control02.ctl
control_management_pack_access string DIAGNOSTIC+TUNING
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> ! rm /u01/oracle/oracle11/oradata/ora11/control01.ctl
SQL> ! rm /u01/oracle/oracle11/flash_recovery_area/ora11/control02.ctl
*****************************************重启报错*****************************************
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 497995776 bytes
Fixed Size 1337464 bytes
Variable Size 360712072 bytes
Database Buffers 130023424 bytes
Redo Buffers 5922816 bytes
ORA-00205: error in identifying control file, check alert log for more info-----------------由于缺失控制文件,故会报错
*****************************************修改创建控制文件的脚本*****************************************
[oracle@ora11 ~]$ more cre_ctl.sql-------------------修改后的trace脚本内容如下
-- Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA11" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oracle11/oradata/ora11/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/oracle/oracle11/oradata/ora11/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/oracle/oracle11/oradata/ora11/redo03.log' SIZE 50M BLOCKSIZE 512
DATAFILE
'/u01/oracle/oracle11/oradata/ora11/system01.dbf',
'/u01/oracle/oracle11/oradata/ora11/sysaux01.dbf',
'/u01/oracle/oracle11/oradata/ora11/undotbs01.dbf',
'/u01/oracle/oracle11/oradata/ora11/users01.dbf',
'/u01/oracle/oracle11/oradata/ora11/example01.dbf'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/oracle/oracle11/flash_recovery_area/ORA11/archivelog/2012_01_26/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/oracle/oracle11/flash_recovery_area/ORA11/archivelog/2012_01_26/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/oracle/oracle11/oradata/ora11/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
*****************************************应用修改后的trace脚本****************************************
[oracle@ora11 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 26 16:15:44 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> @/home/oracle/cre_ctl.sql ---------------------------------->调用修改后的trace脚本
ORACLE instance started.
Total System Global Area 497995776 bytes
Fixed Size 1337464 bytes
Variable Size 360712072 bytes
Database Buffers 130023424 bytes
Redo Buffers 5922816 bytes
Control file created.
Media recovery complete.
System altered.
Database altered.
Tablespace altered.
SQL>
SQL>
SQL>
SQL> select open_mode from v$database;---------------------ok,数据库已工作在读写模式,至此恢复完毕
OPEN_MODE
--------------------
READ WRITE
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28278387/viewspace-746673/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28278387/viewspace-746673/