首页 > 代码库 > 利用trace重建控制文件

利用trace重建控制文件

 

以下步骤,内容都在ora11g_ora_.trc文件中

 

CREATE CONTROLFILE REUSE DATABASE "ORA11G" NORESETLOGS  ARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 (

    ‘+DATA/ora11g/onlinelog/group_1.262.833721677‘,

    ‘+DATA/ora11g/onlinelog/group_1.263.833721679‘

  ) SIZE 50M BLOCKSIZE 512,

  GROUP 2 (

    ‘+DATA/ora11g/onlinelog/group_2.264.833721681‘,

    ‘+DATA/ora11g/onlinelog/group_2.265.833721683‘

  ) SIZE 50M BLOCKSIZE 512,

  GROUP 3 (

    ‘+DATA/ora11g/onlinelog/group_3.266.833721683‘,

    ‘+DATA/ora11g/onlinelog/group_3.267.833721685‘

  ) SIZE 50M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  ‘+DATA/ora11g/datafile/system.256.833721555‘,

  ‘+DATA/ora11g/datafile/sysaux.257.833721555‘,

  ‘+DATA/ora11g/datafile/undotbs1.258.833721555‘,

  ‘+DATA/ora11g/datafile/users.259.833721555‘,

  ‘+DATA/ora11g/datafile/example.269.833721711‘

CHARACTER SET WE8MSWIN1252

;

Control file created.

 

select group#,status from v$log;

select group#,member from v$logfile;

select group#,thread#,sequence# from v$archive;

 

recover database using backup controlfile until cancel;

 

ALTER DATABASE OPEN resetlogs;

 

ALTER TABLESPACE TEMP ADD TEMPFILE ‘+DATA/ora11g/tempfile/temp.268.833721699‘

SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

---------------------------------------------------------------------------------------------------------------------------

示例

SYS@ora11g>alter database backup controlfile to trace as ‘/u02/app/oracle/ctl.ctl‘;

Database altered.

 

SYS@ora11g>CREATE CONTROLFILE REUSE DATABASE "ORA11G" NORESETLOGS  ARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 (

    ‘+DATA/ora11g/onlinelog/group_1.262.833721677‘,

    ‘+DATA/ora11g/onlinelog/group_1.263.833721679‘

  ) SIZE 50M BLOCKSIZE 512,

  GROUP 2 (

    ‘+DATA/ora11g/onlinelog/group_2.264.833721681‘,

    ‘+DATA/ora11g/onlinelog/group_2.265.833721683‘

  ) SIZE 50M BLOCKSIZE 512,

  GROUP 3 (

    ‘+DATA/ora11g/onlinelog/group_3.266.833721683‘,

    ‘+DATA/ora11g/onlinelog/group_3.267.833721685‘

  ) SIZE 50M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  ‘+DATA/ora11g/datafile/system.256.833721555‘,

  ‘+DATA/ora11g/datafile/sysaux.257.833721555‘,

  ‘+DATA/ora11g/datafile/undotbs1.258.833721555‘,

  ‘+DATA/ora11g/datafile/users.259.833721555‘,

  ‘+DATA/ora11g/datafile/example.269.833721711‘

CHARACTER SET WE8MSWIN1252

;  2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28 

Control file created.

 

SYS@ora11g>alter database mount;

ERROR at line 1:

ORA-01100: database already mounted

 

SYS@ora11g>select group#,status from v$log;

    GROUP# STATUS

---------- ----------------

         1 CURRENT

         3 UNUSED

         2 UNUSED

 

SYS@ora11g>select group#,member from v$logfile;

    GROUP# MEMBER

---------- ---------------------------------------------

         1 +DATA/ora11g/onlinelog/group_1.262.833721677

         1 +DATA/ora11g/onlinelog/group_1.263.833721679

         3 +DATA/ora11g/onlinelog/group_3.266.833721683

         3 +DATA/ora11g/onlinelog/group_3.267.833721685

         2 +DATA/ora11g/onlinelog/group_2.264.833721681

         2 +DATA/ora11g/onlinelog/group_2.265.833721683

 

SYS@ora11g>recover database using backup controlfile until cancel;

ORA-00279: change 1109018 generated at 12/19/2013 12:11:13 needed for thread 1

ORA-00289: suggestion : +DATA

ORA-00280: change 1109018 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

+DATA/ora11g/onlinelog/group_1.262.833721677

Log applied.

Media recovery complete.

 

SYS@ora11g>recover database using backup controlfile until cancel;

ORA-00279: change 1109019 generated at 12/19/2013 12:11:13 needed for thread 1

ORA-00289: suggestion : +DATA

ORA-00280: change 1109019 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

+DATA/ora11g/onlinelog/group_1.263.833721679

Log applied.

Media recovery complete.

 

SYS@ora11g>ALTER DATABASE OPEN resetlogs;

Database altered.

 

SYS@ora11g>ALTER TABLESPACE TEMP ADD TEMPFILE ‘+DATA/ora11g/tempfile/temp.268.833721699‘

SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

Tablespace altered.

利用trace重建控制文件