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

  • 相关阅读:
    iphone数据存储之-- Core Data的使用
    Object-c 中的数据类型
    Object-C 中各数据类型转换 NSData转NSString,Byte,UIImage
    iOS开发系列--Objective-C之KVC、KVO
    【C语言】-返回指针的函数与指向函数的指针
    【C语言】-指向一维数组元素的指针
    【C语言】-指针和字符串
    【C语言】-指针
    OC总结 【OC基础语法相关知识】
    swift与OC混编之调用函数
  • 原文地址:https://www.cnblogs.com/hxlasky/p/12551142.html
Copyright © 2011-2022 走看看