• 丢失全部控制文件的恢复


    场景:
    完全备份后创建新的表空间之后没有备份,所有的控制文件丢失,但是归档日志和在线重做日志的都是正常的
    环境:
    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

  • 相关阅读:
    数据持久化
    在职场久了,才知道这样安排工作日程,方能实现真正的高效
    HIS系统-如何设置单病种结算方式
    HIS系统-你给我制作一个二级库吧!
    开机的一篇英文是怎么回事呢?
    系统故障之-冲动360
    每天看一遍你潦倒至今的原因
    如何配置给自己配置一台适合自己的台式机
    如何配置给自己配置一台电脑
    单网卡、双网卡如何实现同时上内网和外网
  • 原文地址:https://www.cnblogs.com/hxlasky/p/12551142.html
Copyright © 2020-2023  润新知