zoukankan      html  css  js  c++  java
  • dataguard从库数据库丢失恢复例子(模拟所有的控制文件)

    1.退出日志应用模式
    [oracle@localhost ~]$ sqlplus /nolog

    SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 14 16:09:16 2019

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

    SQL> connect / as sysdba
    Connected.
    SQL> alter database recover managed standby database cancel;

    Database altered.

    2.停掉数据库
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.

    3.模拟删除掉所有的控制文件
    [oracle@localhost slnngkdg]$ cd /u01/app/oracle/oradata/slnngkdg
    [oracle@localhost slnngkdg]$ mv control01.ctl bak_control01.ctl
    [oracle@localhost slnngkdg]$ cd /u01/app/oracle/fast_recovery_area/slnngkdg
    [oracle@localhost slnngkdg]$ mv control02.ctl bak_control02.ctl

    4.尝试启动数据库
    SQL> connect / as sysdba
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.

    Total System Global Area 3724607488 bytes
    Fixed Size 2258760 bytes
    Variable Size 788531384 bytes
    Database Buffers 2919235584 bytes
    Redo Buffers 14581760 bytes
    ORA-00205: error in identifying control file, check alert log for more info

    发现报错

    5.启动数据库到nonout状态,然后恢复控制文件
    [oracle@localhost ~]$ rman target /
    RMAN> startup nomount;

    database is already started

    RMAN> restore controlfile from '/home/oracle/rman_bakckup/ctl_SLNNGK_36_1_20190114';

    Starting restore at 14-JAN-19
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=133 device type=DISK

    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
    output file name=/u01/app/oracle/oradata/slnngkdg/control01.ctl
    output file name=/u01/app/oracle/fast_recovery_area/slnngkdg/control02.ctl
    Finished restore at 14-JAN-19

    6.启动数据库到mount状态
    RMAN> alter database mount;

    database mounted
    released channel: ORA_DISK_1


    7.做不完全恢复,指定sequence,数据量很大的情况下,该步骤会很消耗时间,可以写个脚本采用nohup执行
    从主库看下当前的日志序号,看到主库当前的日志序号为290,那么我们直接指定该序号,要是没有权限查看,也可以使用系统视图查看(Select Max(t.SEQUENCE#) +1 From v$archived_log t)
    SQL> archive log list;
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination /u01/app/oracle/archive_log
    Oldest online log sequence 288
    Next log sequence to archive 290
    Current log sequence 290


    run{
    set until sequence 290;
    restore database;
    recover database;
    }

    8.打开数据库
    RMAN> alter database open;

    database opened


    9.应用主库日志
    alter database recover managed standby database using current logfile disconnect from session;

  • 相关阅读:
    js四舍五入
    文本框只能输入整数,输入其他的自动不显示
    [转]关于C#程序部署到Android
    ajax在火狐中传中文出现乱码的解决方法
    Vue 记录 Cannot read property '_withTask' of undefined
    vs中 VMDebugger未能加载导致异常
    System.InvalidOperationException: 支持“XXX”上下文的模型已在数据库创建后发生更改。请考虑使用 Code First 迁移更新数据库(http://go.microsoft.com/fwlink/?LinkId=238269)。
    eclipse中将java项目转换成javaweb项目
    Android之SOAP协议与WebService服务器交互,解决超时的问题
    SymmetricDS 快速和灵活的数据库复制
  • 原文地址:https://www.cnblogs.com/hxlasky/p/10267509.html
Copyright © 2011-2022 走看看