1. 啟動 flashback database功能
1.1 檢查 Cold Standby DB 是否開始 archive log mode 注意紅字
SQL>
archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/archivelog
Oldest online log sequence 45
Next log sequence to archive 47
Current log sequence 47
SQL>
1.2 設定 flashback 相關參數
注意 資料夾要存在,不然要先建立
這邊要求的空間,不一定要有,反正只是測試一下而以,不用擔心
[oracle]$ mkdir -p /data/flash_recovery_area
[oracle]$ SS
SQL>
alter system set db_recovery_file_dest_size=100g;
alter system set db_recovery_file_dest='/data/flash_recovery_area';
alter system set db_flashback_retention_target=1440;
1.3 先暫停 Cold Standby apply,並確認 Standby database in mount mode
SQL>
alter database recover managed standby database cancel;
select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
如果出現 READ ONLY 也沒關系
1.4 開啟 flashback database 功能
SQL>
alter database flashback on;
Database altered.
1.5 重啟 Cold Standby apply
SQL>
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
Database altered.
Prod Alter log 會產生以下的字眼
***************************************************
LGWR: Setting 'active' archival for destination LOG
***************************************************
2. Active Cold Standby 前準備 on Standby database
2.1 停止 cold standby db apply
SQL>
alter database recover managed standby database cancel;
Database altered.
2.2 建立還原點
SQL>
create restore point before_open_standby guarantee flashback database;
Restore point created.
2.3 確認所建立的還原點 有Select 到即可
SQL>
select scn, storage_size, time, name from v$restore_point;
SCN STORAGE_SIZE TIME
---------- ------------ ---------------------------------------------------------------------------
NAME
--------------------------------------------------------------------------------------------------------------------------------
1481019 52428800 08-APR-17 08.23.39.000000000 PM
BEFORE_OPEN_STANDBY
SQL>
3. Active Cold Standby 前準備 on Primary database
3.1 switch log file
SQL>
alter system switch logfile;
System altered.
3.2 暫停 archive log 歸檔至standby database
SQL>
alter system set log_archive_dest_state_2=defer ;
System altered.
沒有留言:
張貼留言