情境描述:控制檔案損壞(控制檔案內容沒有變化)
1.備份
1 SQL> alter database backup controlfile to trace as '/u01/admin/sun/udump/c.trc';2 3 Database altered.4 5 SQL>
2.刪除備份檔案
1 -bash-3.00$ ls -l 2 total 2183024 3 -rw-r----- 1 oracle oinstall 7061504 Jan 23 03:12 control01.ctl 4 -rw-r----- 1 oracle oinstall 7061504 Jan 23 03:12 control02.ctl 5 -rw-r----- 1 oracle oinstall 7061504 Jan 23 03:12 control03.ctl 6 -rw-r----- 1 oracle oinstall 104865792 Jan 23 03:01 example01.dbf 7 -rw-r----- 1 oracle oinstall 52429312 Jan 23 03:01 redo01.log 8 -rw-r----- 1 oracle oinstall 52429312 Jan 23 03:11 redo02.log 9 -rw-r----- 1 oracle oinstall 52429312 Jan 23 03:01 redo03.log10 -rw-r----- 1 oracle oinstall 10493952 Jan 23 03:01 sun01_1.dbf11 -rw-r----- 1 oracle oinstall 10493952 Jan 23 03:01 sun02_1.dbf12 -rw-r----- 1 oracle oinstall 251666432 Jan 23 03:07 sysaux01.dbf13 -rw-r----- 1 oracle oinstall 503324672 Jan 23 03:10 system01.dbf14 -rw-r----- 1 oracle oinstall 20979712 Jan 22 23:24 temp01.dbf15 -rw-r----- 1 oracle oinstall 31465472 Jan 23 03:10 undotbs01.dbf16 -rw-r----- 1 oracle oinstall 5251072 Jan 23 03:01 users01.dbf17 -bash-3.00$ rm -f control01.*18 -bash-3.00$
3.關機
1 SQL> shutdown abort2 ORACLE instance shut down.3 SQL>
4.更改備份的控制檔案
1 -bash-3.00$ pwd 2 /u01/admin/sun/udump 3 -bash-3.00$ cp c.trc c.sql 4 6 將注釋和多餘的資訊從控制檔案中刪除 7 -bash-3.00$ vi c.sql 8 9 STARTUP NOMOUNT10 CREATE CONTROLFILE REUSE DATABASE "SUN" NORESETLOGS ARCHIVELOG11 MAXLOGFILES 1612 MAXLOGMEMBERS 313 MAXDATAFILES 10014 MAXINSTANCES 815 MAXLOGHISTORY 29216 LOGFILE17 GROUP 1 '/u01/oradata/sunbak/redo01.log' SIZE 50M,18 GROUP 2 '/u01/oradata/sunbak/redo02.log' SIZE 50M,19 GROUP 3 '/u01/oradata/sunbak/redo03.log' SIZE 50M20 DATAFILE21 '/u01/oradata/sunbak/system01.dbf',22 '/u01/oradata/sunbak/undotbs01.dbf',23 '/u01/oradata/sunbak/sysaux01.dbf',24 '/u01/oradata/sunbak/users01.dbf',25 '/u01/oradata/sunbak/example01.dbf',26 '/u01/oradata/sunbak/sun01_1.dbf',27 '/u01/oradata/sunbak/sun02_1.dbf'28 CHARACTER SET AL32UTF829 ;30 31 RECOVER DATABASE32 33 ALTER SYSTEM ARCHIVE LOG ALL;34 35 ALTER DATABASE OPEN;36 37 ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/oradata/sunbak/temp01.dbf'38 SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;39 --40 -bash-3.00$
5.利用c.sql產生控制檔案
1 -bash-3.00$ sqlplus /nolog 2 3 SQL*Plus: Release 10.2.0.2.0 - Production on Wed Jan 23 03:56:32 2013 4 5 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. 6 SQL> conn /as sysdba 7 Connected to an idle instance. 8 SQL> @/u01/admin/sun/udump/c.sql 9 ORACLE instance started.10 11 Total System Global Area 289406976 bytes12 Fixed Size 1279820 bytes13 Variable Size 92276916 bytes14 Database Buffers 192937984 bytes15 Redo Buffers 2912256 bytes16 17 Control file created.18 19 Media recovery complete.20 21 System altered.22 23 Database altered.24 25 Tablespace altered.26 27 SQL>