问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

怎么利用闪回数据库特性恢复failover 后的dataguard 环境

发布网友 发布时间:2022-04-28 20:08

我来回答

2个回答

懂视网 时间:2022-04-08 06:27

*db_recovery_file_dest参数为0时,不能设定flash_recovery_area参数*
  • SQL> alter system set db_recovery_file_dest_size=2147483648 scope=spfile;
  • SQL> alter system set db_recovery_file_dest=‘/u01/app/oracle/flash_recovery_area‘ scope=spfile;
  • SQL> alter system set DB_FLASHBACK_RETENTION_TARGET=2880; (2 days) |
  • 2. Turn flashback on:
    1. SQL> Startup mount exclusive;
    2. SQL> alter database archivelog;
    3. SQL> Alter database flashback on;
    4. SQL> Alter database open; |
  • 3. Check status
    1. SQL> SELECT flashback_on, log_mode FROM gv$database;
    2.     SQL> SELECT estimated_flashback_size FROM gv$flashback_database_log;
    3. $ ps -eaf | grep rvwr |
  • 禁用Flashback Database

    1. Alter database flashback on;

    Flashback Database Using SQL or RMAN Commands

    1.使用SQLPLUS

  • Use an SCN or a time stamp in the SQL version
  • Example: Flash back the database to a day before using SQL
    1. SQL> shutdown immediate;
    2. SQL> startup mount exclusive;
    3. SQL> flashback database to timestamp(sysdate-1);
    4. SQL> alter database open resetlogs;
  • 2.使用 RMAN

  • Using RMAN, you can flash back to a time stamp, SCN, or log sequence number (SEQUENCE) and thread number (THREAD).
  • Example:
    1. RMAN> FLASHBACK DATABASE TO TIME = TO_DATE(‘2002-12-10 16:00:00‘,‘YYYY-MM-DD HH24:MI:SS‘);
    2. RMAN> FLASHBACK DATABASE TO SCN=23565;
    3. RMAN> FLASHBACK DATABASE TO SEQUENCE=223 THREAD=1;
  • 视图

  • **VFLASHBACKDATABASELOG???monitortheestimatedandactualsizeoftheflashbacklogsintheflashrecovery?Checkflashrecoveryareadiskquota:‘‘‘SQL>selectretentiontarget,flashbacksize,estimatedflashbacksizeFROMVFLASHBACK_DATABASE_LOG;
    1. - Determine the current flashback window:
    SQL> SELECT oldest_flashback_scn,oldest_flashback_time FROM VFLASHBACKDATABASELOG;‘‘‘???VFLASHBACK_DATABASE_STAT -** monitors the overhead of logging flashback data in the flashback logs. It contains at most 24 rows, with one row for each of the last 24 hours.
  • The flashback generation for the last hour:
    1. SQL> select to_char(end_time,‘yyyy-mm-dd hh:miAM‘) end_timestamp, flashback_data, db_data, redo_data from v$flashback_database_stat where rownum=1;
  • 从Flashback Database中排除表空间

    1. SQL> ALTER TABLESPACE <ts_name> FLASHBACK {ON|OFF}
    2. SQL> SELECT name, flashback_on 2 FROM v$tablespace;


    Note

  • Take the tablespace offline before you perform the database flashback operation.
  • After performing Flashback Database, drop the tablespace or recover the offline files with traditional point-in-time recovery.
  • Flash back a RESETLOGS operation

    可以闪回到resetlogs之前的一个时间点

    1. SQL> FLASHBACK DATABASE TO BEFORE RESETLOGS;

    Limitations

  • You cannot use Flashback Database in the following situations:

  • The control file has been restored or re-created.

  • A tablespace has been dropped.
  • A data file has been shrunk
  • 需要开启FRA特性

  • 闪回数据库的一些命令:

    1. **闪回到指定的日期**
    2. FLASHBACK DATABASE TO TIMESTAMP(to_data(‘2015.07.11 20:03:00‘,‘YYYY.MM.DD HH24:MI:SS‘));
    3. **闪回到5分钟之前**
    4. FLASHBACK DATABASE TO TIMESTAMP SYSDATE-(1/24/12);
    5. FLASHBACK DATABASE TO BEFORE TIMESTAMP my_date;
    6. **回退到过去的某个SCN点**
    7. FLASHBACK DATABASE TO SCN my_scn;
    8. FLASHBACK DATABASE TO BEFORE SCN my_scn;
    9. **回退到某个Log Sequence号*
    10. flashback database to sequence=223 thread=1;
    11. **回退完成之后以resetlogs的方式打开数据库*
    12. alter database open resetlogs;

    1. **也可以创建一个恢复点*
    2. CREATE RESTORE POINT before_changes;
    3. FLASHBACK DATABASE TO RESTORE POINT before_changes;



    来自为知笔记(Wiz)

    闪回数据库

    标签:

    热心网友 时间:2022-04-08 03:35

    -----主库defer 日志传输
    alter system set log_archive_dest_2=defer;

    ---enable 日志传输:
    alter system set log_archive_dest_2=enable;

    -----备库(mount)配置 flashback database:
    STANDBY DATABASE: Stop redo apply, configure flashback retention,
    start flashback database, open the database and start redo apply (Is active DG).

    ---检查备库是否启用flashback database:
    select flashback_on from v$database;

    注意这里需要确认下备库打开模式: mount?readonly with apply?
    在11g 环境下备库可能启用了 ADG 特性 备库日志处于实时应用,数据库模式为 readonly with apply
    这时需要重启数据库到mount状态修改flashback database 模式;

    如果备库处于mount 状态,可以先取消日志apply ,直接打开闪回数据库特性;

    ---取消备库日志应用:
    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

    ---需要配置一下两个参数来打开flashback database 特性:
    ALTER SYSTEM SET db_recover_file_dest='/lixora/lixora/lixora/';
    ALTER SYSTEM SET db_recover_file_dest_size=100G;

    ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=240; ---4hours
    ALTER DATABASE FLASHBACK ON;

    --手工创建还原点(该步骤没有测试过):
    Creating Restore point in Physical Standby:
    CREATE RESTORE POINT before_damage GUARANTEE FLASHBACK DATABASE

    -------备库failover to primary db 应急切换步骤:
    (注:模拟主库由于故障无法正常switchover,需要执行failover,强制备库->pridb并接管业务)

    1.备库:
    由于是failover,所以理解主库这时候已经无法正常使用,只需备库切换至pridb

    【前提主库还是可用的:可选】查询没有应用的日志:
    SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

    select distinct thread#,max(sequence#) over(partition by thread#) a from v$archived_log;
    该语句取得当前数据库各线程已归档文件最大序号,如果primary 与standby 最大序号不相同,
    必须将多出的序号对应的归档文件复制到待转换的standby服务器。

    Cp过来并register
    ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1'

    停止应用恢复模式
    alter database recover managed standby database finish;
    or
    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE;

    转换standbydb为primary db
    alter database commit to switchover to primary;

    重启数据库,恢复正常业务
    alter database open;

    数据库角色查看:
    select open_mode,database_role from v$database;
    OPEN_MODE DATABASE_ROLE
    ---------- ----------------
    OPEN PRIMARY

    ------恢复failover 的备库:
    C. Using SQL*PLUS
    Step 1 Determine the Standby Became Primary SCN.
    Step 2 Flashback the Failed Primary Database.
    Step 3 Convert to physical standby database.
    Step 4 Restart Redo Transport.
    Step 5 Start Redo Apply.

    Step 1 Determine the SCN at which the old standby database became the primary database.
    SQL> SELECT TO_CHAR(STANDBY_BECAME_PRIMARY_SCN) FROM V$DATABASE;

    Step 2 Flashback the Failed Primary Database to SCN standby_became_primary_scn.
    SQL> SHUTDOWN IMMEDIATE;
    SQL> startup mount
    SQL> FLASHBACK DATABASE TO SCN ;

    Step 3 Convert the database to a physical standby database and Restart database in mount stage.
    SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
    SQL> SHUTDOWN IMMEDIATE;
    SQL> STARTUP MOUNT;

    Step 4 Restart Redo Transport to the New Physical Standby Database.
    1. If you have not set the remote archive destination on current primary then set remote archive destination:
    SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 = 'SERVICE=lixora VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=lixora' SCOPE=BOTH;

    2. Enable the destination
    SQL>ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;

    3. Perform a log switch to ensure that standby database begins receiving redo data from the new primary database
    SQL> ALTER SYSTEM SWITCH LOGFILE;
    SQL> SELECT DEST_ID, STATUS, ERROR FROM V$ARCHIVE_DEST WHERE DEST_ID=2;
    声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
    手机导航地图语音怎么下载 如何分别真金和仿金首饰 怎样区分真金和仿金首饰呢 小学生新年晚会主持人的串词!!(不要太多)急 大大后天就需要了!!!_百度... 周年晚会策划公司 奥格瑞玛传送门大厅在哪 奥格瑞玛传送门大厅怎么走 锻炼颈椎的几个动作 水多久能结冰 冰能在多长时间内形成 请问水低于0度会结冰吗? 如何防止脱发严重 闪回查询~A为什么不要? kettle工具对oracle数据库使用闪回查询方式进行增量抽取,如何设计,有... oracle 系统表能闪回查询吗 oracle 闪回查询问题 如何在多租户环境下使用数据库的闪回功能 oracle高级数据库应用,实验报告:数据闪回 使用flashback实现对表、模式... 如何执行Oracle数据库闪回查询 穿越火线中的FPS是什么意思 fps是什么意思?怎么换算? 在视频文件里FPS是什么意思? 工作模拟器手机版要怎么进入? 怎样在电脑上玩vr枪械模拟器? 听说有VR驾驶模拟器学车,有没有人用过,学的效果好吗? 日本哪种洗衣液好 在哪里可以买到ps4vr工作模拟器游戏光盘 日本洗衣注意标志 普乐蛙的VR驾驶模拟器靠谱吗? 日本伊玛牌洗衣机怎么样 暴风魔镜是否能描述为vr模拟器,用手机代替显示器模拟vr的工作 日本首台洗衣机东芝制造是哪一年? oracle 10g 中执行了 delete from emp; 请问怎样将数据表内容恢复... rman怎样删除15天前的归档 SQL实验:嵌套查询和连接查询 Oracle 10g Application Express数据表操作 刺激战场:玩游戏手机发热发烫怎么办 128G玩刺激战场,为什么手机很烫.有时候 手机玩《绝地求生:刺激战场》发热非常厉害怎么办?怕烧坏手机 怎么玩刺激战场手机发烫的不行呀? 玩刺激战场手机发烫是怎么回事? 刺激战场:手机变卡变烫一定是这三个设置没有 上次手机玩刺激战场连续玩了半天,温度已经有40度。 玩绝地求生刺激战场手机发热严重,会不会对电池有害? 你们有没有玩刺激战场呀,怎么手机会发烫呀 玩刺激战场手机发热怎么办? 刺激战场:手机发热掉帧怎么办 刺激战场为什么手机发热? 玩刺激战场为什么会卡,手机还会发热 荣耀10玩刺激战场发烫?为何玩游戏会发烫 手机玩游戏发热 用u盘拷文件时 磁盘里的文件夹不断抖动 是怎么回事?