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

溫馨提示×

溫馨提示×

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

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

11G 新增 Physical standby 并通過 DGBroker 進行主備切換

發布時間:2020-06-01 14:50:36 來源:網絡 閱讀:296 作者:背向天堂 欄目:關系型數據庫

1.PRIMARY

????原來的主庫,新增新備庫的配置信息。


SQL> alter system set log_archive_dest_state_3=defer;

SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORA11G_PRIM,ORA11G_STBY,ORA11G_STBY2)';

SQL> alter system set LOG_ARCHIVE_DEST_3='SERVICE=ORA11G_STBY2 ASYNC DELAY=60 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORA11G_STBY2';


2.FIRST STANDBY

????第一套備庫調整配置信息。


SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORA11G_PRIM,ORA11G_STBY,ORA11G_STBY2)';


3.SECOND STANDBY

????配置第二套備庫。由于第一套備庫和第二套備庫在同一臺物理機上,因此需要注意目錄隔離,避免新備庫破壞就備庫的文件。


3.1 參數文件

[oracle@oradb2 ~]$ export ORACLE_SID=ora11g

SQL> create pfile='/home/oracle/11g2.pfile' from spfile;


[oracle@oradb2 ~]$ vi 11g2.pfile

*.audit_file_dest='/oracle/app/oracle/admin/ora11g2/adump'

*.control_files='/oradata/database/11g/ora11g2/control01.ctl','/oradata/database/11g/ora11g2/control02.ctl'

*.DB_UNIQUE_NAME='ORA11G_STBY2'

*.fal_server='ORA11G_PRIM'

*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORA11G_PRIM,ORA11G_STBY,ORA11G_STBY2)'

*.LOG_ARCHIVE_DEST_1='LOCATION=/oradata/archive/11g2 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ORA11G_STBY2'

*.LOG_ARCHIVE_DEST_2='SERVICE=ORA11G_PRIM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORA11G_PRIM'

*.dg_broker_start=false

*.db_file_name_convert='/oradata/database/11g/ora11g/','/oradata/database/11g/ora11g2/'

*.log_file_name_convert='/oradata/database/11g/ora11g/','/oradata/database/11g/ora11g2/'


????通過參數文件啟動新備庫到nomount狀態

[oracle@oradb2 ~]$ export ORACLE_SID=ora11g2

SQL> startup nomount pfile='/home/oracle/11g2.pfile';

SQL> create spfile from pfile='/home/oracle/11g2.pfile';

SQL> startup force nomount;


3.2 口令文件

[oracle@oradb2 ~]$ cd $ORACLE_HOME/dbs

[oracle@oradb2 dbs]$ cp orapwora11g orapwora11g2


3.3 網絡配置

[oracle@oradb2 dbs]$ cd $ORACLE_HOME/network/admin


[oracle@oradb2 admin]$ vi listener.ora?

????新增新備庫的配置信息,注冊到靜態監聽中。


? ? (SID_DESC =

? ? ? (GLOBAL_DBNAME = ORA11G_STBY2)

? ? ? (ORACLE_HOME = /oracle/app/oracle/product/database/11g)

? ? ? (SID_NAME = ora11g2)

? ? )?

? ? (SID_DESC =

? ? ? (GLOBAL_DBNAME = ORA11G_STBY2_DGMGRL)

? ? ? (ORACLE_HOME = /oracle/app/oracle/product/database/11g)

? ? ? (SID_NAME = ora11g2)

? ? )?


????重啟監聽,使配置生效,檢查所有配置的靜態監聽生效

[oracle@oradb2 ~]$ lsnrctl stop

[oracle@oradb2 ~]$ lsnrctl start


[oracle@oradb2 ~]$ lsnrctl status

Services Summary...

Service "ORA11G_STBY" has 2 instance(s).

? Instance "ora11g", status UNKNOWN, has 1 handler(s) for this service...

Service "ORA11G_STBY2" has 2 instance(s).

? Instance "ora11g2", status UNKNOWN, has 1 handler(s) for this service...

Service "ORA11G_STBY2_DGMGRL" has 1 instance(s).

? Instance "ora11g2", status UNKNOWN, has 1 handler(s) for this service...

Service "ORA11G_STBY_DGMGRL" has 1 instance(s).

? Instance "ora11g", status UNKNOWN, has 1 handler(s) for this service...


????新增新備庫tns配置信息。

[oracle@oradb2 admin]$ vi tnsnames.ora [主庫也需要新增該配置]

ORA11G_STBY2 =

? (DESCRIPTION =

? ? (ADDRESS_LIST =

? ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2)(PORT = 1521))

? ? )

? ? (CONNECT_DATA =

? ? ? (SERVER = DEDICATED)

? ? ? (SERVICE_NAME = ORA11G_STBY2)

? ? )

? )


3.4 測試數據庫連接 [主庫和新備庫都需要進行測試]

[oracle@oradb2 ~]$ sqlplus sys/oracle@ORA11G_STBY2 as sysdba

[oracle@oradb2 ~]$ sqlplus sys/oracle@ORA11G_PRIM as sysdba? ??


3.5 新備庫進行復制主庫操作

????注意此處連接到新的備庫。

[oracle@oradb2 ~]$ export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';

[oracle@oradb2 ~]$ rman target sys/oracle@ORA11G_PRIM auxiliary sys/oracle@ORA11G_STBY2


RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;

RMAN> DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE DORECOVER NOFILENAMECHECK;


3.6 啟動新備庫數據庫并啟動實時恢復

[oracle@oradb2 ~]$ export ORACLE_SID=ora11g2

SQL> alter database open;

SQL> alter database recover managed standby database using current logfile disconnect from session;


4.將新備庫添加到dg broker中

[oracle@oradb2 ~]$ export ORACLE_SID=ora11g2

SQL> alter system set dg_broker_start=true;


[oracle@oradb2 ~]$ dgmgrl /

DGMGRL> show configuration;

DGMGRL> ADD DATABASE 'ORA11G_STBY2' AS CONNECT IDENTIFIER IS 'ORA11G_STBY2' MAINTAINED AS PHYSICAL;

DGMGRL> ENABLE DATABASE 'ORA11G_STBY2';


5. 進行主備切換操作


????通過DG Broker管理的DG環境,在進行主備切換過程中,參數會自動進行維護,例如fal_server,log_archive_dest_2,log_archive_dest_3等。


DGMGRL> show configuration;

Configuration - ora11g_dg


? Protection Mode: MaxPerformance

? Databases:

? ? ORA11G_PRIM? - Primary database

? ? ORA11G_STBY? - Physical standby database

? ? ORA11G_STBY2 - Physical standby database


DGMGRL> connect sys/oracle@ORA11G_STBY

DGMGRL> SWITCHOVER TO 'ORA11G_STBY';


????切記在switchover時,使用用戶名和口令連接到dgmgrl,否則會造成切換后,無法啟動遠程數據庫,導致切換失敗。


向AI問一下細節

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

AI

屏东市| 东乡族自治县| 唐海县| 贵阳市| 缙云县| 桂东县| 中方县| 泰兴市| 门头沟区| 阿克苏市| 治县。| 阳原县| 巨鹿县| 遂溪县| 革吉县| 石景山区| 云和县| 丁青县| 灵寿县| 广丰县| 蓝田县| 化隆| 云安县| 衡南县| 焦作市| 南岸区| 大新县| 长岭县| 宣城市| 山西省| 丹棱县| 金寨县| 砚山县| 洛阳市| 出国| 元阳县| 永丰县| 天峻县| 明光市| 马关县| 大同市|