• 脚本恢复控制文件


    脚本恢复数据库控制文件

    STARTUP NOMOUNT

    CREATE CONTROLFILE REUSE DATABASE "VDEDU" NORESETLOGS  ARCHIVELOG

        MAXLOGFILES 16

        MAXLOGMEMBERS 3

        MAXDATAFILES 100

        MAXINSTANCES 8

        MAXLOGHISTORY 292

    LOGFILE

      GROUP 1 '/u01/app/oracle/oradata/VDEDU/redo01.log'  SIZE 50M BLOCKSIZE 512,

      GROUP 2 '/u01/app/oracle/oradata/VDEDU/redo02.log'  SIZE 50M BLOCKSIZE 512,

      GROUP 3 '/u01/app/oracle/oradata/VDEDU/redo03.log'  SIZE 50M BLOCKSIZE 512

    -- STANDBY LOGFILE

    DATAFILE

      '/u01/app/oracle/oradata/VDEDU/system01.dbf',

      '/u01/app/oracle/oradata/VDEDU/sysaux01.dbf',

      '/u01/app/oracle/oradata/VDEDU/undotbs01.dbf',

      '/u01/app/oracle/oradata/VDEDU/users01.dbf',

      '/u01/app/oracle/oradata/VDEDU/example01.dbf'

    CHARACTER SET AL32UTF8

    ;

     

    STARTUP NOMOUNT

    CREATE CONTROLFILE REUSE DATABASE "VDEDU" RESETLOGS  ARCHIVELOG

        MAXLOGFILES 16

        MAXLOGMEMBERS 3

        MAXDATAFILES 100

        MAXINSTANCES 8

        MAXLOGHISTORY 292

    LOGFILE

      GROUP 1 '/u01/app/oracle/oradata/VDEDU/redo01.log'  SIZE 50M BLOCKSIZE 512,

      GROUP 2 '/u01/app/oracle/oradata/VDEDU/redo02.log'  SIZE 50M BLOCKSIZE 512,

      GROUP 3 '/u01/app/oracle/oradata/VDEDU/redo03.log'  SIZE 50M BLOCKSIZE 512

    -- STANDBY LOGFILE

    DATAFILE

      '/u01/app/oracle/oradata/VDEDU/system01.dbf',

      '/u01/app/oracle/oradata/VDEDU/sysaux01.dbf',

      '/u01/app/oracle/oradata/VDEDU/undotbs01.dbf',

      '/u01/app/oracle/oradata/VDEDU/users01.dbf',

      '/u01/app/oracle/oradata/VDEDU/example01.dbf'

    CHARACTER SET AL32UTF8

    ;

     

    使用noresetlogs仅是当前所有的online logs可用时。

    使用resetlogs,将导致online logs里的内容丢失,并且所有的备份失效,仅当online logs损坏的情况下,才使用resetlos模式。

     

     

    SQL> alter database backup controlfile to trace;

     

    Database altered.

     

    SQL> oradebug setmypid

    Statement processed.

    SQL> oradebug tracefile_name

    /u01/app/oracle/diag/rdbms/vdedu/VDEDU/trace/VDEDU_ora_10040.trc

     

    oradebug setmypid  --跟踪当前会话

    oradebug tracefile_name  --查看trace文件名及位置

     

     

    [oracle@lyo1 ~]$ cat /u01/app/oracle/diag/rdbms/vdedu/VDEDU/trace/VDEDU_ora_10040.trc > createcontrol.txt

    [oracle@lyo1 ~]$ vi createcontrol.txt

     

    删除控制文件

    [oracle@lyo1 ~]$ rm -rf /u01/app/oracle/oradata/VDEDU/control01.ctl

    [oracle@lyo1 ~]$ rm -rf /u01/app/oracle/fast_recovery_area/VDEDU/control02.ctl

     

    SQL> shutdown abort

    ORACLE instance shut down.

    SQL> startup

    ORACLE instance started.

     

    Total System Global Area 1503199232 bytes

    Fixed Size     2253424 bytes

    Variable Size   922750352 bytes

    Database Buffers   570425344 bytes

    Redo Buffers     7770112 bytes

    ORA-00205: error in identifying control file, check alert log for more info

     

     

    SQL> shutdown abort

    ORACLE instance shut down.

    SQL> quit

     

    利用脚本重做控制文件,需重做两次

    SQL> @1.sql

    ORACLE instance started.

     

    Total System Global Area 1503199232 bytes

    Fixed Size     2253424 bytes

    Variable Size   922750352 bytes

    Database Buffers   570425344 bytes

    Redo Buffers     7770112 bytes

     

    Control file created.

    恢复数据库

    SQL> RECOVER DATABASE;

    Media recovery complete.

    启用归档模式

    SQL> ALTER SYSTEM ARCHIVE LOG ALL;

     

    System altered.

    打开数据库

    SQL> alter database open;

     

    Database altered.

     

     

    利用resetlogs脚本重做

    [oracle@oracle ~]$ sqlplus / as sysdba

     

    SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 9 19:17:30 2018

     

    Copyright (c) 1982, 2013, Oracle.  All rights reserved.

     

    Connected to an idle instance.

     

    SQL> @2.sql

    ORACLE instance started.

     

    Total System Global Area  839282688 bytes

    Fixed Size     2257880 bytes

    Variable Size   545262632 bytes

    Database Buffers   289406976 bytes

    Redo Buffers     2355200 bytes

     

    Control file created.

     

    SQL> quit

     

     

    SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;

    ORA-00279: change 1111159 generated at 07/09/2018 19:13:58 needed for thread 1

    ORA-00289: suggestion :

    /u01/app/oracle/fast_recovery_area/KINGSQL/archivelog/2018_07_09/o1_mf_1_11_%u_.

    arc

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

     

     

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

    /u01/app/oracle/oradata/kingsql/redo01.log

    ORA-00310: archived log contains sequence 10; sequence 11 required

    ORA-00334: archived log: '/u01/app/oracle/oradata/kingsql/redo01.log'

     

     

    SQL> RECOVER DATABASE USING BACKUP CONTROLFILE;

    ORA-00279: change 1111159 generated at 07/09/2018 19:13:58 needed for thread 1

    ORA-00289: suggestion :

    /u01/app/oracle/fast_recovery_area/KINGSQL/archivelog/2018_07_09/o1_mf_1_11_%u_.

    arc

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

     

     

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

    /u01/app/oracle/oradata/kingsql/redo02.log

    Log applied.

    Media recovery complete.

    SQL> alter database open resetlogs;

     

    Database altered.

  • 相关阅读:
    lampp、xampp安装文档
    tomcat下配置https方式
    1.6:怎么学习Linux
    1.5:linux的应用领域
    1.3:linux的优点和缺点
    1.4:Linux发行版本详解
    1.2:liunx和unix的区别
    1.1:Linux系统简介
    mysql中获取表名&字段名的查询语句
    kettle组件-输出
  • 原文地址:https://www.cnblogs.com/kawashibara/p/9351857.html
Copyright © 2020-2023  润新知