Snapshot Standby,此功能可將備庫(kù)置身于"可讀寫(xiě)狀態(tài)"用于不方便在生產(chǎn)環(huán)境主庫(kù)中測(cè)試的內(nèi)容,比如模擬上線測(cè)試等任務(wù)。當(dāng)備庫(kù)讀寫(xiě)狀態(tài)下任務(wù)完成后,可以非常輕松的完成Snapshot Standby數(shù)據(jù)庫(kù)角色切換回備庫(kù)角色,恢復(fù)與主庫(kù)數(shù)據(jù)同步。在Snapshot Standby數(shù)據(jù)庫(kù)狀態(tài)下,備庫(kù)是可以接受主庫(kù)傳過(guò)來(lái)的日志,但是不能夠?qū)⒆兓瘧?yīng)用在備庫(kù)中。
專注于為中小企業(yè)提供網(wǎng)站制作、網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)新沂免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了千余家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
物理備庫(kù)要轉(zhuǎn)換成Snapshot的前提條件
停止備庫(kù)上的日志應(yīng)用。
備庫(kù)開(kāi)啟數(shù)據(jù)庫(kù)閃回功能
下面演示,如果切換成snapshot。
1. 停止備庫(kù)上的日志應(yīng)用。
DGMGRL> edit database 11gdg2 set state=APPLY-OFF; Succeeded. DGMGRL>
2. 開(kāi)啟備庫(kù)數(shù)據(jù)庫(kù)閃回功能
SQL> alter database flashback on; Database altered.
3.將備庫(kù)轉(zhuǎn)為snapshot
DGMGRL> CONVERT DATABASE 11GDG2 TO SNAPSHOT STANDBY; Converting database "11gdg2" to a Snapshot Standby database, please wait... Database "11gdg2" converted successfully
4. 此時(shí),我們?cè)谥鲙?kù)上做些數(shù)據(jù)修改
SQL> select count(*) from t1; COUNT(*) ---------- 56 SQL> insert into t1 select * from t1; 56 rows created. SQL> commit; Commit complete.
5. 在備庫(kù)中修改數(shù)據(jù)
SQL> conn / as sysdba Connected. SQL> select open_mode from v$database; OPEN_MODE ------------------------------------------------------------ READ WRITE SQL> conn scott/tiger Connected. SQL> create table t2 as select * from t1; Table created. SQL> select count(*) from t2; COUNT(*) ---------- 56 SQL>
6. 將snapshot轉(zhuǎn)為physical standby
DGMGRL> CONVERT DATABASE 11GDG2 TO PHYSICAL STANDBY; Converting database "11gdg2" to a Physical Standby database, please wait... Operation requires shutdown of instance "dgtst" on database "11gdg2" Shutting down instance "dgtst"... Database closed. Database dismounted. ORACLE instance shut down. Operation requires startup of instance "dgtst" on database "11gdg2" Starting instance "dgtst"... ORACLE instance started. Database mounted. Continuing to convert database "11gdg2" ... Operation requires shutdown of instance "dgtst" on database "11gdg2" Shutting down instance "dgtst"... ORA-01109: database not open Database dismounted. ORACLE instance shut down. Operation requires startup of instance "dgtst" on database "11gdg2" Starting instance "dgtst"... ORACLE instance started. Database mounted. Database "11gdg2" converted successfully
將備庫(kù)打開(kāi)
SQL> alter database open read only; Database altered.
7. 檢查備庫(kù)中t2表是否還存在
SQL> conn scott/tiger Connected. SQL> select * from t2; select * from t2 * ERROR at line 1: ORA-00942: table or view does not exist SQL>
8.看看轉(zhuǎn)換到snapshot后,對(duì)主庫(kù)做的更改數(shù)據(jù)有沒(méi)有被應(yīng)用。
SQL> select count(*) from t1; COUNT(*) ---------- 112 SQL>
和第4步結(jié)論是一樣的 。
網(wǎng)站題目:Oracle學(xué)習(xí)之DATAGUARD(十一)snapshotdatabase
本文路徑:http://jinyejixie.com/article0/pgeioo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、Google、動(dòng)態(tài)網(wǎng)站、網(wǎng)站設(shè)計(jì)、定制開(kāi)發(fā)、軟件開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)