zoukankan      html  css  js  c++  java
  • 丢失全部控制文件的恢复

    场景:
    完全备份后创建新的表空间之后没有备份,所有的控制文件丢失,但是归档日志和在线重做日志的都是正常的
    环境:
    OS:Centos 7
    DB:11.2.0.4

    1.完全备份
    #!/bin/sh
    backup_date=`date +%Y-%m-%d`

    rman target / log=/home/oracle/scripts/logs/rmanbackup_log_${backup_date}.log<<EOF
    run
    {
    allocate channel ch1 device type disk;
    backup as compressed backupset full filesperset 5 database format '/u01/rman_backup/db_fullbackup_%d_%s_%p_%T';
    sql 'alter system archive log current';
    backup as compressed backupset archivelog all delete input format '/u01/rman_backup/arch_%d_%s_%p_%T';
    backup current controlfile format '/u01/rman_backup/ctl_%d_%s_%p_%T';
    backup spfile format '/u01/rman_backup/spfile_%d_%s_%p_%T';
    release channel ch1;
    crosscheck backup;
    delete noprompt expired backup;
    delete noprompt obsolete;
    }
    EOF

    2.创建表空间
    create tablespace tps_test
    datafile '/u01/app/oracle/oradata/slnngk/tps_test01.dbf'
    size 100M autoextend on next 10m MAXSIZE unlimited;

    3.删除所有的控制文件
    SQL> Select Name From v$controlfile;

    NAME
    --------------------------------------------------------------------------------
    /u01/app/oracle/oradata/slnngk/control01.ctl
    /u01/app/oracle/fast_recovery_area/slnngk/control02.ctl

    rm /u01/app/oracle/oradata/slnngk/control01.ctl
    rm /u01/app/oracle/fast_recovery_area/slnngk/control02.ctl

    4.创建用户和表并写入数据
    Create User hxl Identified By oracle;

    Grant Dba To hxl;

    Create Table tb_test(Id Number,Name Varchar2(32));
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');
    Insert Into tb_test Values(1,'name1');

    5.这个时候数据库报错误
    Errors in file /u01/app/oracle/diag/rdbms/slnngk/slnngk/trace/slnngk_m001_6978.trc:
    ORA-00210: cannot open the specified control file
    ORA-00202: control file: '/u01/app/oracle/oradata/slnngk/control01.ctl'
    ORA-27041: unable to open file
    Linux-x86_64 Error: 2: No such file or directory
    Additional information: 3



    6.关闭数据库启动到nomount
    SQL> connect / as sysdba
    Connected.
    SQL> shutdown immediate
    ORA-00210: cannot open the specified control file
    ORA-00202: control file: '/u01/app/oracle/oradata/slnngk/control01.ctl'
    ORA-27041: unable to open file
    Linux-x86_64 Error: 2: No such file or directory
    Additional information: 3

    SQL> shutdown abort
    ORACLE instance shut down.


    7.恢复控制文件
    RMAN> startup nomount
    rman> restore controlfile from '/u01/rman_backup/ctl_SLNNGK_4_1_20200323';
    RMAN> alter database mount;
    RMAN> recover database;

    RMAN> alter database open resetlogs;

    database opened

  • 相关阅读:
    银行数据仓库体系实践(6)--调度系统
    银行数据仓库体系实践(5)--数据转换
    银行数据仓库体系实践(4)--数据抽取和加载
    银行数据仓库体系实践(3)--数据架构
    银行数据仓库体系实践(2)--系统架构
    银行数据仓库体系实践(1)--银行数据仓库简介
    敏捷开发和传统开发区别
    source ~/.bash_profile是什么意思
    oracle里的DBLINK是做什么的
    flex-direction的值及使用效果
  • 原文地址:https://www.cnblogs.com/hxlasky/p/12551142.html
Copyright © 2011-2022 走看看