中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle 11g physical dataguard之快照備用

發布時間:2020-05-27 12:15:51 來源:網絡 閱讀:2142 作者:snowhill 欄目:關系型數據庫

在oracle 10g要準備一個讀寫備用的數據庫還是很繁瑣的,準備好dataguard后得手動創建還原點,手動停日志傳送,手動激活并強制打開,測試完了,如果主備的SCN差太多,你還得做增量備份追,統計了下需15步,和搭一個physical standby的步驟差不多了,所以用的極少。到11g里終于解放了,啟用快照備庫只需3步(當然中間重啟的次數不算),恢復到實時應用備用也只需2步,日志還是繼續傳,需要鏡像庫測試的朋友,可以放心用了(用dataguard borker更簡單)。當然轉換成Snapshot Standby,是有些附加條件的(沒有的參照前文去搭建一個):
1 數據庫閃回得打開;
2 db_recovery_file_dest_size還是要有足夠的空間的;
3 如果使用的保護模式是Maximum Protection模式,必須有其他的Standby與之相匹配,否則小心主庫宕機。
手動做的步驟如下:
1檢查閃回

 SQL> select flashback_on,database_role,open_mode from v$database;  
FLASHBACK_ON       DATABASE_ROLE    OPEN_MODE
------------------ ---------------- --------------------
NO                 PHYSICAL STANDBY READ ONLY WITH APPLY

當前Standby狀態是只讀Apply狀態,這個時候需要終止Apply過程,并且切換回mount狀態。否則是不允許進行convert動作的。

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
ORA-38709: Recovery Area is not enabled.

報錯了,這個錯誤好解決:

 SQL> show parameter db_recovery_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string
db_recovery_file_dest_size           big integer 51000M
SQL> alter system set db_recovery_file_dest='/data';
SQL> alter database flashback on;
SQL> select flashback_on from v$database; 
FLASHBACK_ON
------------------
YES

2 轉換

SQL> alter database convert to snapshot standby;
SQL> alter  database open; 

有興趣的可以看下alert_sid.log
End: Standby Redo Logfile archival
RESETLOGS after incomplete recovery UNTIL CHANGE 1974538
Resetting resetlogs activation ID 1662850232 (0x631d14b8)
Online log /data/db/onlinelog/group_1.261.899048765: Thread 1 Group 1 was previously cleared
Online log /data/db/onlinelog/group_2.260.899048765: Thread 1 Group 2 was previously cleared
Online log /data/db/onlinelog/group_3.277.899049819: Thread 2 Group 3 was previously cleared
Online log /data/db/onlinelog/group_4.278.899049819: Thread 2 Group 4 was previously cleared
Online log /data/db/onlinelog/group_5.280.908381663: Thread 1 Group 5 was previously cleared
Online log /data/db/onlinelog/group_6.281.908381749: Thread 1 Group 6 was previously cleared
Online log /data/db/onlinelog/group_7.282.908381877: Thread 1 Group 7 was previously cleared
檢查下當前數據庫狀態:

 SQL> select open_mode, database_role, protection_mode from v$database;

OPEN_MODE            DATABASE_ROLE    PROTECTION_MODE
-------------------- ---------------- --------------------
READ WRITE           SNAPSHOT STANDBY MAXIMUM AVAILABILITY

已經變成可寫狀態,查詢flash_back開始的SCN:

 SQL> select oldest_flashback_scn, oldest_flashback_time from v$flashback_database_log;

OLDEST_FLASHBACK_SCN OLDEST_FLASH
-------------------- ------------
             1974537 17-MAY-17

從這里開始可以對備庫進行任何操作:

SQL> create table  test  as select * from all_objects; 
Table created. 
SQL> select count(*) from test; 
  COUNT(*)
----------
     14629 
SQL> drop table STAGE_TERADATA_OFFLINE_PKEYS purge; 
Table dropped.

切回:
1 關庫,切換

 SQL>shutdown immediate
SQL>startup mount;
SQL> alter database convert to physical standby;

這里查看alert_sid.log可以看到
Flashback Restore Start
Flashback Restore Complete
Drop guaranteed restore point
刪除了還原點
2 關庫,關閃回,啟用real time apply

SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database flashback off;
SQL>alter database open; 
SQL>RECOVER  managed standby database using current logfile disconnect from session  
SQL>select open_mode, database_role, protection_mode,current_SCN from v$database;
OPEN_MODE            DATABASE_ROLE    PROTECTION_MODE      CURRENT_SCN
-------------------- ---------------- -------------------- -----------
READ ONLY WITH APPLY PHYSICAL STANDBY MAXIMUM AVAILABILITY     1977350

檢查下剛才測試的數據:

 [oracle@ora9-2 data]$ sqlplus scott/test 
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 17 08:42:08 2017 
Copyright (c) 1982, 2013, Oracle.  All rights reserved. 
ERROR:
ORA-28002: the password will expire within 18446744073709551614 days  
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select count(*) from test; 
select count(*) from test
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select * from STAGE_TERADATA_OFFLINE_PKEYS; 
no rows selected

該有的還在,不該有的也沒有了,挺好。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

通辽市| 塘沽区| 襄樊市| 招远市| 华坪县| 陵水| 武隆县| 滁州市| 金山区| 望都县| 车险| 邵东县| 黄浦区| 囊谦县| 樟树市| 梁河县| 平邑县| 双牌县| 奉节县| 博乐市| 航空| 巴彦县| 道孚县| 塔城市| 普洱| 遵化市| 南和县| 鄂尔多斯市| 南平市| 泰州市| 酉阳| 冷水江市| 南丹县| 东丰县| 铜川市| 绥阳县| 汤阴县| 新闻| 望城县| 安达市| 绥江县|