日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

oracle取消dataguard,【DataGuard】Oracle DataGuard 数据保护模式切换

發(fā)布時間:2025/3/20 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle取消dataguard,【DataGuard】Oracle DataGuard 数据保护模式切换 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Oracle 11g DataGuard 數(shù)據(jù)保護(hù)模式切換

Data Guard 提供三種數(shù)據(jù)保護(hù)模式:最大保護(hù)(Maximum Protection),最高可用(Maximum Availability)和 最高性能(Maximum Performance)。

如果按照對數(shù)據(jù)的保護(hù)程度或者說主從庫數(shù)據(jù)的同步性 由低到高排序,三種保護(hù)模式的順序應(yīng)該是:最高性能、最高可用、最大保護(hù) 。

本文通過實(shí)驗(yàn)?zāi)M三種數(shù)據(jù)保護(hù)模式進(jìn)行相互切換六個場景,對比保護(hù)模式的升級、切換過程。

【實(shí)驗(yàn)圖例】

【實(shí)驗(yàn)環(huán)境】

操作系統(tǒng):Red Hat Enterprise Linux Server release 5.4

數(shù)據(jù)庫:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

【主庫、物理備庫結(jié)構(gòu)信息】

【實(shí)驗(yàn)過程】

①、最高性能 升級 最高可用

(1)查看數(shù)據(jù)庫當(dāng)前保護(hù)模式:最高性能模式

select

database_role,protection_mode,protection_level from v$database;主庫 Primary :

物理備庫 Physical Standby

查看日志傳輸方式

當(dāng)前在最大性能模式下,日志傳輸方式為ARCH ASYNC,arch進(jìn)程異步傳輸歸檔的方式。

(2)修改主庫日志傳輸模式

要升級為最高通過修改初始化參數(shù)文件中遠(yuǎn)程歸檔參數(shù),講日志傳輸模式改為LGWR SYNC AFIRM,即lgwr進(jìn)程同步傳輸redo日志的方式。

vim $ORACLE_HOME/dbs/initBJ.ora

主庫正常關(guān)庫后開庫。

shutdown immediate;

startup;

(3)備庫添加standby logfilegroup

首先查看當(dāng)前日志組個數(shù)、大小、文件位置

select sequence#,group#,bytes/1024/1024 MB from v$log;

select member from v$logfile;

備庫要添加4個standby 日志組,比普通日志組多一個。

alter database add standby logfile group 4 '/u02/oradata/sh/redo04.std'

size 50m;

alter database add standby logfile group 5

'/u02/oradata/sh/redo05.std' size 50m;

alter database add standby logfile group 6

'/u02/oradata/sh/redo06.std' size 50m;

alter database add standby logfile group 7 '/u02/oradata/sh/redo07.std'

size 50m;

添加完成后查看,standby logfile group 已經(jīng)添加

(4)切換數(shù)據(jù)保護(hù)模式為最高可用

alter database set standby database

to maximize availability;

查看當(dāng)前主、備庫數(shù)據(jù)保護(hù)模式,已經(jīng)是最高可用模式。

select

database_role,protection_mode,protection_level from v$database;

②、最高可用 升級 最大保護(hù)

(1)查看當(dāng)前數(shù)據(jù)庫保護(hù)模式:最高可用模式

select database_role,protection_mode,protection_level from

v$database;

(2)設(shè)置數(shù)據(jù)庫保護(hù)模式為最大保護(hù)

alter database set standby database

to maximize protection;

查看數(shù)據(jù)庫當(dāng)前保護(hù)模式,已經(jīng)升級成功:最大保護(hù)模式

select

database_role,protection_mode,protection_level from v$database;

③、最大保護(hù) 轉(zhuǎn) 最高可用 (降級)

查詢當(dāng)前保護(hù)模式狀態(tài):最大保護(hù)模式

設(shè)置保護(hù)模式為最高可用

再次查詢,protection_level?已成功切換為:最高可用模式。

select

database_role,open_mode,protection_mode,protection_level from v$database;

alter database set standby database to maximize availability;

select

database_role,open_mode,protection_mode,protection_level from v$database;

④、最高可用 轉(zhuǎn) 最高性能 (降級)

查詢當(dāng)前保護(hù)模式狀態(tài):最高可用模式

設(shè)置保護(hù)模式為最高性能

再次查詢,已成功切換為:最高性能模式。

select database_role,protection_mode,protection_level from

v$database;

alter database set standby database to maximize performance;

select database_role,protection_mode,protection_level from

v$database;

⑤、最高性能 升級 最大保護(hù)

查詢當(dāng)前數(shù)據(jù)庫保護(hù)模式:最高性能模式

select

database_role,open_mode,protection_mode,protection_level from v$database;

設(shè)置數(shù)據(jù)保護(hù)模式為最大保護(hù)報(bào)錯,【ORA-01126】:database must be mounted in this instance and not open in any instance;

要求在mounted狀態(tài)操作,且任何實(shí)例都不能處于open狀態(tài)。

alter database set standby database to maximize protection;

正常關(guān)庫,把庫起到mount狀態(tài)

shutdown immediate;

startup mount;

在mount狀態(tài),設(shè)置數(shù)據(jù)庫保護(hù)模式,可以切換,因處于mount狀態(tài),當(dāng)先保護(hù)模式顯示unprotected.

select

database_role,protection_mode,protection_level from v$database;

alter database

open;

open狀態(tài)后再次查看,已成功升級為最大保護(hù)模式

⑥、最大保護(hù) 轉(zhuǎn) 最高性能 (降級)

查看當(dāng)前數(shù)據(jù)庫保護(hù)模式:最大保護(hù)模式

設(shè)置數(shù)據(jù)庫保護(hù)模式為最高性能

查看已經(jīng)設(shè)置成功,protection_level 已變成最高性能模式。

select database_role,protection_mode,protection_level from

v$database;

alter database set standby database to maximize performance;

select database_role,protection_mode,protection_level from

v$database;

【實(shí)驗(yàn)總結(jié)】

1、最高性能模式既可以使用ARCH方式傳遞日志,也可以使用LGWR方式傳遞,在升級到更高級別保護(hù)模式時,需使用LGWR方式,且需要在備庫創(chuàng)建standby日志組。

2、三種保護(hù)模式進(jìn)行切換時,最高性能升級到最大保護(hù)模式(⑤),需先把數(shù)據(jù)庫重啟到mounted狀態(tài)才能操作。其他情況(①②③④⑥)相互切換時,可以直接進(jìn)行。

根據(jù)實(shí)驗(yàn)結(jié)論,在生產(chǎn)環(huán)境下如果需要從最高性能模式升級為最大保護(hù)模式,可先從最高性能模式升級最高可用模式,再由最高可用模式升級為最大保護(hù)模式。

如下圖,通過①②分步升級的方式代替⑤直接升級,避免了重啟到mounted狀態(tài)對生產(chǎn)環(huán)境下業(yè)務(wù)造成的影響。

呂星昊

2014.8.9

總結(jié)

以上是生活随笔為你收集整理的oracle取消dataguard,【DataGuard】Oracle DataGuard 数据保护模式切换的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。