zoukankan      html  css  js  c++  java
  • PROD异机全备份恢复验证实施文档

    PROD异机全备份恢复验证实施文档


    ******利用10月25日的全量备份、10月26日当天的归档日志及当前redo日志,恢复数据库到故障前数据库状态******

    准备工作:
    source 源库:
    PROD数据库备份策略:每天全量备份
    0 0 * * 0 /data/rmanfull.sh > /data/logs/rmanfull.log 2>&1

    target 异地机器prod:
    备份目录:/backup/PROD/rman_full20181025
    备份文件如下
    [oracle@prod ~]$ ll /backup/PROD/rman_full20181025
    total 6221124
    -rw-r----- 1 oracle oinstall 574902784 Oct 25 01:08 arc_20181025_lntggqia_1_1.arg
    -rw-r----- 1 oracle oinstall 619688960 Oct 25 01:08 arc_20181025_lotggqia_1_1.arg
    -rw-r----- 1 oracle oinstall 3584 Oct 25 01:08 arc_20181025_lptggqkb_1_1.arg
    -rw-r----- 1 oracle oinstall 16547840 Oct 25 01:07 c-1016818008-20181025-00.ctl
    -rw-r----- 1 oracle oinstall 16547840 Oct 25 01:08 c-1016818008-20181025-01.ctl
    -rw-r----- 1 oracle oinstall 3151675392 Oct 25 01:07 fulllktggq4k_6836_1
    -rw-r----- 1 oracle oinstall 1991057408 Oct 25 01:04 fulllltggq4k_6837_1
    拷贝10月26日当天未备份的归档日志,到prod
    [oracle@prod ~]$ ll /backup/prod/arch/
    total 8651740
    -rw-r----- 1 oracle oinstall 886358016 Oct 25 17:23 1_11540_918555866.dbf
    -rw-r----- 1 oracle oinstall 882925568 Oct 25 17:23 1_11541_918555866.dbf
    -rw-r----- 1 oracle oinstall 887519232 Oct 25 17:24 1_11542_918555866.dbf
    -rw-r----- 1 oracle oinstall 854680064 Oct 25 17:24 1_11543_918555866.dbf
    -rw-r----- 1 oracle oinstall 4065792 Oct 25 17:24 1_11544_918555866.dbf
    -rw-r----- 1 oracle oinstall 1536 Oct 25 17:24 1_11545_918555866.dbf
    -rw-r----- 1 oracle oinstall 889512448 Oct 25 17:24 1_11546_918555866.dbf
    -rw-r----- 1 oracle oinstall 870745088 Oct 26 10:40 1_11547_918555866.dbf
    -rw-r----- 1 oracle oinstall 2560 Oct 26 10:40 1_11548_918555866.dbf
    -rw-r----- 1 oracle oinstall 888808448 Oct 26 10:40 1_11549_918555866.dbf
    -rw-r----- 1 oracle oinstall 861337088 Oct 26 10:40 1_11550_918555866.dbf
    -rw-r----- 1 oracle oinstall 1181696 Oct 26 10:40 1_11551_918555866.dbf
    -rw-r----- 1 oracle oinstall 1024 Oct 26 10:40 1_11552_918555866.dbf
    -rw-r----- 1 oracle oinstall 883601920 Oct 26 10:40 1_11553_918555866.dbf
    -rw-r----- 1 oracle oinstall 910689280 Oct 26 10:41 1_11554_918555866.dbf
    -rw-r----- 1 oracle oinstall 37829120 Oct 26 10:58 1_11555_918555866.dbf
    -rw-r----- 1 oracle oinstall 30208 Oct 26 10:58 1_11556_918555866.dbf
    -rw-r----- 1 oracle oinstall 49664 Oct 26 10:59 1_11557_918555866.dbf
    源库的当前日志;
    SYS@dhdb> select * from v$log;
    GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME CON_ID
    ---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------------ ------------ ------------------ ----------
    1 1 11556 1073741824 512 2 YES INACTIVE 5121113916 26-OCT-18 5121113978 26-OCT-18 0
    2 1 11557 1073741824 512 2 YES INACTIVE 5121113978 26-OCT-18 5121114646 26-OCT-18 0
    3 1 11558 1073741824 512 2 NO CURRENT 5121114646 26-OCT-18 2.8147E+14 0

    拷贝10月26日 当前redo日志sequence 11558至异机恢复机器的目录/backup/prod/currentredolog/

    安装与源库同版本的数据库软件,编辑环境变量$ORACLE_BASE $ORACLE_HOME等

    实施流程:


    1:在10月25日全量备份恢复初始化参数文件spfile
    SQL> startup nomount force

    RMAN>restore spfile from '/backup/PROD/rman_full20181025/c-1016818008-20181025-00.ctl'

    SQL> shutdown immediate
    SQL> startup nomount
    SQL> create pfile from spfile
    SQL> shutdown immediate

    编辑pfile文件,补充源库的文件目录,调整SGA、PGA等内存设置等,用编辑好的pfile文件起库

    SQL>startup nomount from '/data/app/oracle/product/12.1.0/db_1/dbs/initPROD.ora'

    SQL>create spfile from pfile;
    用spfile 起库
    SQL>startup nomount force

    2:恢复控制文件
    RMAN>restore controlfile from '/backup/PROD/rman_full20181025/c-1016818008-20181025-00.ctl';
    RMAN>alter database mount;
    3:转储恢复数据库

    RMAN>restore database;
    RMAN>recover database;恢复数据库,应用归档日志

    Starting recover at 26-OCT-18
    using channel ORA_DISK_1

    starting media recovery

    channel ORA_DISK_1: starting archived log restore to default destination
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=11544
    channel ORA_DISK_1: reading from backup piece /backup/prod/rman_full20181025/arc_20181025_lotggqia_1_1.arg
    channel ORA_DISK_1: piece handle=/backup/prod/rman_full20181025/arc_20181025_lotggqia_1_1.arg tag=TAG20181025T010722
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    archived log file name=/data/app/oracle/arch/1_11544_918555866.dbf thread=1 sequence=11544
    channel ORA_DISK_1: starting archived log restore to default destination
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=11545
    channel ORA_DISK_1: reading from backup piece /backup/prod/rman_full20181025/arc_20181025_lptggqkb_1_1.arg
    channel ORA_DISK_1: piece handle=/backup/prod/rman_full20181025/arc_20181025_lptggqkb_1_1.arg tag=TAG20181025T010722
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    archived log file name=/data/app/oracle/arch/1_11545_918555866.dbf thread=1 sequence=11545
    unable to find archived log
    archived log thread=1 sequence=11546
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 10/26/2018 12:50:28
    RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 11546 and starting SCN of 5115041454


    #提示恢复需要归档日志sequence 11546
    RMAN>list backup of archivelog all;
    #备份中的归档日志,截止到sequence 11545

    RMAN> exit
    注册归档日志目录
    RMAN> catalog start with '/backup/prod/arch/';

    RMAN> recover database; 利用26日当天的归档日志恢复数据库

    Starting recover at 26-OCT-18
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=1393 device type=DISK

    starting media recovery

    archived log for thread 1 with sequence 11546 is already on disk as file /backup/prod/arch/1_11546_918555866.dbf
    archived log for thread 1 with sequence 11547 is already on disk as file /backup/prod/arch/1_11547_918555866.dbf
    archived log for thread 1 with sequence 11548 is already on disk as file /backup/prod/arch/1_11548_918555866.dbf
    archived log for thread 1 with sequence 11549 is already on disk as file /backup/prod/arch/1_11549_918555866.dbf
    archived log for thread 1 with sequence 11550 is already on disk as file /backup/prod/arch/1_11550_918555866.dbf
    archived log for thread 1 with sequence 11551 is already on disk as file /backup/prod/arch/1_11551_918555866.dbf
    archived log for thread 1 with sequence 11552 is already on disk as file /backup/prod/arch/1_11552_918555866.dbf
    archived log for thread 1 with sequence 11553 is already on disk as file /backup/prod/arch/1_11553_918555866.dbf
    archived log for thread 1 with sequence 11554 is already on disk as file /backup/prod/arch/1_11554_918555866.dbf
    archived log for thread 1 with sequence 11555 is already on disk as file /backup/prod/arch/1_11555_918555866.dbf
    archived log for thread 1 with sequence 11556 is already on disk as file /backup/prod/arch/1_11556_918555866.dbf
    archived log for thread 1 with sequence 11557 is already on disk as file /backup/prod/arch/1_11557_918555866.dbf
    archived log file name=/backup/prod/arch/1_11546_918555866.dbf thread=1 sequence=11546
    archived log file name=/backup/prod/arch/1_11547_918555866.dbf thread=1 sequence=11547
    archived log file name=/backup/prod/arch/1_11548_918555866.dbf thread=1 sequence=11548
    archived log file name=/backup/prod/arch/1_11549_918555866.dbf thread=1 sequence=11549
    archived log file name=/backup/prod/arch/1_11550_918555866.dbf thread=1 sequence=11550
    archived log file name=/backup/prod/arch/1_11551_918555866.dbf thread=1 sequence=11551
    archived log file name=/backup/prod/arch/1_11552_918555866.dbf thread=1 sequence=11552
    archived log file name=/backup/prod/arch/1_11553_918555866.dbf thread=1 sequence=11553
    archived log file name=/backup/prod/arch/1_11554_918555866.dbf thread=1 sequence=11554
    archived log file name=/backup/prod/arch/1_11555_918555866.dbf thread=1 sequence=11555
    archived log file name=/backup/prod/arch/1_11556_918555866.dbf thread=1 sequence=11556
    archived log file name=/backup/prod/arch/1_11557_918555866.dbf thread=1 sequence=11557
    unable to find archived log
    archived log thread=1 sequence=11558
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 10/26/2018 12:54:11
    RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 11558 and starting SCN of 5121114646


    #提示恢复需要归档日志sequence 11558,而11558为源库此时的当前日志
    #拷贝源库的当前sequence 11558至备份恢复机的目录/backup/prod/currentredolog/ ,利用当前日志组,恢复数据库

    [oracle@standby05 ~]$ sqlplus / as sysdba

    SQL*Plus: Release 12.1.0.2.0 Production on Fri Oct 26 12:57:41 2018

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


    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

    SQL> recover database using backup controlfile until cancel;
    ORA-00279: change 5121114646 generated at 10/26/2018 10:57:08 needed for thread
    1
    ORA-00289: suggestion : /data/app/oracle/arch/1_11558_918555866.dbf
    ORA-00280: change 5121114646 for thread 1 is in sequence #11558


    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    /backup/prod/currentredolog/redo03.log #从源库拷贝current redolog,到target库的/backup/prod/currentredolog/
    Log applied.
    Media recovery complete.

  • 相关阅读:
    [TJOI2013]单词 AC 自动机
    NOIP 2017 逛公园 记忆化搜索 最短路 好题
    [BJWC2012]冻结 分层图最短路
    dijkstra STL 堆优化
    [POI2002][HAOI2007]反素数 数论 搜索 好题
    bzoj 2456: mode 思维题 好题
    [SDOI2012]Longge的问题 欧拉反演_欧拉函数
    [JLOI2011]飞行路线 分层图最短路
    页面加速优化
    制作html5微信页面的经验总结。
  • 原文地址:https://www.cnblogs.com/elontian/p/9856676.html
Copyright © 2011-2022 走看看