oracle用户管理的完全恢复5:控制文件损坏(控制文件前后内容未改变)

场景描述:控制文件损坏(控制文件内容没有变化)

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.log

10 -rw-r-----   1 oracle   oinstall 10493952 Jan 23 03:01 sun01_1.dbf

11 -rw-r-----   1 oracle   oinstall 10493952 Jan 23 03:01 sun02_1.dbf

12 -rw-r-----   1 oracle   oinstall 251666432 Jan 23 03:07 sysaux01.dbf

13 -rw-r-----   1 oracle   oinstall 503324672 Jan 23 03:10 system01.dbf

14 -rw-r-----   1 oracle   oinstall 20979712 Jan 22 23:24 temp01.dbf

15 -rw-r-----   1 oracle   oinstall 31465472 Jan 23 03:10 undotbs01.dbf

16 -rw-r-----   1 oracle   oinstall 5251072 Jan 23 03:01 users01.dbf

17 -bash-3.00$ rm -f control01.*

18 -bash-3.00$ 

3.关机

1 SQL> shutdown abort

2 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 NOMOUNT

10 CREATE CONTROLFILE REUSE DATABASE "SUN" NORESETLOGS  ARCHIVELOG

11     MAXLOGFILES 16

12     MAXLOGMEMBERS 3

13     MAXDATAFILES 100

14     MAXINSTANCES 8

15     MAXLOGHISTORY 292

16 LOGFILE

17   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 50M

20 DATAFILE

21   '/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 AL32UTF8

29 ;

30 

31 RECOVER DATABASE

32 

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 bytes

12 Fixed Size                  1279820 bytes

13 Variable Size              92276916 bytes

14 Database Buffers          192937984 bytes

15 Redo Buffers                2912256 bytes

16 

17 Control file created.

18 

19 Media recovery complete.

20 

21 System altered.

22 

23 Database altered.

24 

25 Tablespace altered.

26 

27 SQL> 

 

你可能感兴趣的:(oracle)