【DG】同一臺主機實現物理Data Guard配置安裝(精簡版)
一.Primary資料庫配置
1.確認primary庫處於歸檔模式
export ORACLE_SID=ocmdb
[oracle@ocmdb1 ~]$ sqlplus / as sysdba
sys@ocmdb> archive log list;
2.將primary庫置為FORCE LOGGING 模式
sys@ocmdb> alter database force logging;
3.在primary庫建立standby資料庫控制檔案
sys@ocmdb> !mkdir -p /home/oracle/backup
sys@ocmdb> alter database create standby controlfile as '/home/oracle/backup/ocmdg.ctl';
4.建立primary庫客戶端初始化引數檔案
1).建立主庫中的pfile
sys@ocmdb> create pfile from spfile;
2).備份到backup目錄,用於建立備庫的pfile
sys@ocmdb> ! cp /u01/app/oracle/product/10.2.0/db_1/dbs/initocmdb.ora /home/oracle/backup/initocmdg.ora
3).修改後主庫pfile中內容如下:
[oracle@ocmdb1 ~]$ mkdir /home/oracle/ocmdb_arch
vi $ORACLE_HOME/dbs/initocmdb.ora
以下內容追加到pfile的尾部
#################################################################
#Parameters for Primary Database.
#################################################################
*.DB_NAME='ocmdb'
*.DB_UNIQUE_NAME=ocmdb
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(ocmdb,ocmdg)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/ocmdb VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ocmdb'
*.LOG_ARCHIVE_DEST_2='SERVICE=ocmdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ocmdg'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
#################################################################
#Parameters which using for switch over from Primary to Standby.
#################################################################
*.FAL_SERVER=ocmdg
*.FAL_CLIENT=ocmdb
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdg','/u01/app/oracle/oradata/ocmdb'
*.LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdg','/u01/app/oracle/oradata/ocmdb'
*.STANDBY_FILE_MANAGEMENT=AUTO
*.STANDBY_ARCHIVE_DEST='/home/oracle/ocmdb_arch'
4).透過pfile 重建spfile
sys@ocmdb> shutdown immediate;
NotConnected@> create spfile from pfile='initocmdb.ora';
5.配置listener
vi $ORACLE_HOME/network/admin/tnsnames.ora
OCMDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocmdb1.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ocmdb)
)
)
OCMDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocmdb1.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ocmdg)
)
)
驗證監聽
tnsping ocmdb
tnsping ocmdg
二.Standby資料庫配置
1.建立密碼檔案,注意保持sys 密碼與primary 資料庫一致
cd $ORACLE_HOME/dbs
orapwd file=orapwocmdg password=oracle1 entries=20
2.建立所需目錄(注意OMF管理的檔案)
cd $ORACLE_BASE/admin
mkdir -p ocmdg/adump
mkdir -p ocmdg/bdump
mkdir -p ocmdg/cdump
mkdir -p ocmdg/dpdump
mkdir -p ocmdg/udump
mkdir -p ocmdg/pfile
mkdir -p oradata/ocmdg
mkdir -p oradata/ocmdg
mkdir -p oradata/ocmdg
3.複製資料檔案到standby庫對應的目錄(datafile,log,controlfiles)
關閉主庫
export ORACLE_SID=ocmdb
sqlplus / as sysdba
shutdown immediate;
1).複製資料檔案
cp /u01/app/oracle/oradata/ocmdb/* /u01/app/oracle/oradata/ocmdg
2).複製生成的standby控制檔案
cp /home/oracle/backup/ocmdg.ctl /u01/app/oracle/oradata/ocmdg/control01.ctl
cp /home/oracle/backup/ocmdg.ctl /u01/app/oracle/oradata/ocmdg/control02.ctl
cp /home/oracle/backup/ocmdg.ctl /u01/app/oracle/oradata/ocmdg/control03.ctl
4.修改standby初始化引數檔案
[oracle@ocmdb1 ~]$ mkdir /home/oracle/ocmdg_arch
1).standby的初始化引數如下
cp /home/oracle/backup/initocmdg.ora /u01/app/oracle/product/10.2.0/db_1/dbs/initocmdg.ora
注意需要將所有與路徑相關的引數調整正確
vi $ORACLE_HOME/dbs/initocmdg.ora
ocmdb.__db_cache_size=125829120
ocmdb.__java_pool_size=4194304
ocmdb.__large_pool_size=4194304
ocmdb.__shared_pool_size=96468992
ocmdb.__streams_pool_size=8388608
*.audit_file_dest='/u01/app/oracle/admin/ocmdg/adump'
*.background_dump_dest='/u01/app/oracle/admin/ocmdg/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/ocmdg/control01.ctl','/u01/app/oracle/oradata/ocmdg/control02.ctl','/u01/app/oracle/oradata/ocmdg/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/ocmdg/cdump'
*.db_16k_cache_size=33554432
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata/ocmdg/'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_keep_cache_size=33554432
*.db_name='ocmdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=21474836480
*.dispatchers='(protocol=TCP)(serv=ocmdg)(list=ocmdg)(poo=on)(disp=6)(con=36)(sess=100)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.max_dispatchers=0
*.max_shared_servers=0
*.open_cursors=300
*.pga_aggregate_target=62914560
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
ocmdg.resource_manager_plan='WEEKDAYS'
*.sga_target=314572800
*.shared_servers=0
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/ocmdg/udump'
#################################################################
#Parameters for Standby Database.
#################################################################
*.DB_NAME='ocmdb'
*.DB_UNIQUE_NAME=ocmdg
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(ocmdb,ocmdg)'
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdb','/u01/app/oracle/oradata/ocmdg'
*.LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdb','/u01/app/oracle/oradata/ocmdg'
*.STANDBY_ARCHIVE_DEST='/home/oracle/ocmdg_arch'
*.FAL_SERVER=ocmdb
*.FAL_CLIENT=ocmdg
*.STANDBY_FILE_MANAGEMENT=AUTO
#################################################################
#Parameters which using for switch over from Standby to Primary.
#################################################################
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/ocmdg VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ocmdg'
*.LOG_ARCHIVE_DEST_2='SERVICE=ocmdb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ocmdb'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
2).透過該pfile 建立spfile
export ORACLE_SID=ocmdg
create spfile from pfile
5.啟動主庫例項
export ORACLE_SID=ocmdb
sqlplus / as sysdba
startup;
6.啟動standby到mount
export ORACLE_SID=ocmdg
sqlplus / as sysdba
NotConnected@> startup mount;
7.啟動redo應用
NotConnected@> alter database recover managed standby database disconnect from session;
到此,在同一臺主機上建立物理standby的任務就完成了。
關於測試DG的有效性測試請參考《【DG】同一臺主機實現物理Data Guard配置安裝》(http://space.itpub.net/?uid-519536-action-viewspace-itemid-578181)。
三.小結
本文描述的非OMF管理方式下GD的配置方法,因為檔案目錄相對比較固定,配置大同小異。
Good luck.
secooler
10.07.19
-- The End --
1.確認primary庫處於歸檔模式
export ORACLE_SID=ocmdb
[oracle@ocmdb1 ~]$ sqlplus / as sysdba
sys@ocmdb> archive log list;
2.將primary庫置為FORCE LOGGING 模式
sys@ocmdb> alter database force logging;
3.在primary庫建立standby資料庫控制檔案
sys@ocmdb> !mkdir -p /home/oracle/backup
sys@ocmdb> alter database create standby controlfile as '/home/oracle/backup/ocmdg.ctl';
4.建立primary庫客戶端初始化引數檔案
1).建立主庫中的pfile
sys@ocmdb> create pfile from spfile;
2).備份到backup目錄,用於建立備庫的pfile
sys@ocmdb> ! cp /u01/app/oracle/product/10.2.0/db_1/dbs/initocmdb.ora /home/oracle/backup/initocmdg.ora
3).修改後主庫pfile中內容如下:
[oracle@ocmdb1 ~]$ mkdir /home/oracle/ocmdb_arch
vi $ORACLE_HOME/dbs/initocmdb.ora
以下內容追加到pfile的尾部
#################################################################
#Parameters for Primary Database.
#################################################################
*.DB_NAME='ocmdb'
*.DB_UNIQUE_NAME=ocmdb
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(ocmdb,ocmdg)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/ocmdb VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ocmdb'
*.LOG_ARCHIVE_DEST_2='SERVICE=ocmdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ocmdg'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
#################################################################
#Parameters which using for switch over from Primary to Standby.
#################################################################
*.FAL_SERVER=ocmdg
*.FAL_CLIENT=ocmdb
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdg','/u01/app/oracle/oradata/ocmdb'
*.LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdg','/u01/app/oracle/oradata/ocmdb'
*.STANDBY_FILE_MANAGEMENT=AUTO
*.STANDBY_ARCHIVE_DEST='/home/oracle/ocmdb_arch'
4).透過pfile 重建spfile
sys@ocmdb> shutdown immediate;
NotConnected@> create spfile from pfile='initocmdb.ora';
5.配置listener
vi $ORACLE_HOME/network/admin/tnsnames.ora
OCMDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocmdb1.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ocmdb)
)
)
OCMDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocmdb1.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ocmdg)
)
)
驗證監聽
tnsping ocmdb
tnsping ocmdg
二.Standby資料庫配置
1.建立密碼檔案,注意保持sys 密碼與primary 資料庫一致
cd $ORACLE_HOME/dbs
orapwd file=orapwocmdg password=oracle1 entries=20
2.建立所需目錄(注意OMF管理的檔案)
cd $ORACLE_BASE/admin
mkdir -p ocmdg/adump
mkdir -p ocmdg/bdump
mkdir -p ocmdg/cdump
mkdir -p ocmdg/dpdump
mkdir -p ocmdg/udump
mkdir -p ocmdg/pfile
mkdir -p oradata/ocmdg
mkdir -p oradata/ocmdg
mkdir -p oradata/ocmdg
3.複製資料檔案到standby庫對應的目錄(datafile,log,controlfiles)
關閉主庫
export ORACLE_SID=ocmdb
sqlplus / as sysdba
shutdown immediate;
1).複製資料檔案
cp /u01/app/oracle/oradata/ocmdb/* /u01/app/oracle/oradata/ocmdg
2).複製生成的standby控制檔案
cp /home/oracle/backup/ocmdg.ctl /u01/app/oracle/oradata/ocmdg/control01.ctl
cp /home/oracle/backup/ocmdg.ctl /u01/app/oracle/oradata/ocmdg/control02.ctl
cp /home/oracle/backup/ocmdg.ctl /u01/app/oracle/oradata/ocmdg/control03.ctl
4.修改standby初始化引數檔案
[oracle@ocmdb1 ~]$ mkdir /home/oracle/ocmdg_arch
1).standby的初始化引數如下
cp /home/oracle/backup/initocmdg.ora /u01/app/oracle/product/10.2.0/db_1/dbs/initocmdg.ora
注意需要將所有與路徑相關的引數調整正確
vi $ORACLE_HOME/dbs/initocmdg.ora
ocmdb.__db_cache_size=125829120
ocmdb.__java_pool_size=4194304
ocmdb.__large_pool_size=4194304
ocmdb.__shared_pool_size=96468992
ocmdb.__streams_pool_size=8388608
*.audit_file_dest='/u01/app/oracle/admin/ocmdg/adump'
*.background_dump_dest='/u01/app/oracle/admin/ocmdg/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/ocmdg/control01.ctl','/u01/app/oracle/oradata/ocmdg/control02.ctl','/u01/app/oracle/oradata/ocmdg/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/ocmdg/cdump'
*.db_16k_cache_size=33554432
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata/ocmdg/'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_keep_cache_size=33554432
*.db_name='ocmdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=21474836480
*.dispatchers='(protocol=TCP)(serv=ocmdg)(list=ocmdg)(poo=on)(disp=6)(con=36)(sess=100)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.max_dispatchers=0
*.max_shared_servers=0
*.open_cursors=300
*.pga_aggregate_target=62914560
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
ocmdg.resource_manager_plan='WEEKDAYS'
*.sga_target=314572800
*.shared_servers=0
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/ocmdg/udump'
#################################################################
#Parameters for Standby Database.
#################################################################
*.DB_NAME='ocmdb'
*.DB_UNIQUE_NAME=ocmdg
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(ocmdb,ocmdg)'
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdb','/u01/app/oracle/oradata/ocmdg'
*.LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ocmdb','/u01/app/oracle/oradata/ocmdg'
*.STANDBY_ARCHIVE_DEST='/home/oracle/ocmdg_arch'
*.FAL_SERVER=ocmdb
*.FAL_CLIENT=ocmdg
*.STANDBY_FILE_MANAGEMENT=AUTO
#################################################################
#Parameters which using for switch over from Standby to Primary.
#################################################################
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/oradata/ocmdg VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ocmdg'
*.LOG_ARCHIVE_DEST_2='SERVICE=ocmdb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ocmdb'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
2).透過該pfile 建立spfile
export ORACLE_SID=ocmdg
create spfile from pfile
5.啟動主庫例項
export ORACLE_SID=ocmdb
sqlplus / as sysdba
startup;
6.啟動standby到mount
export ORACLE_SID=ocmdg
sqlplus / as sysdba
NotConnected@> startup mount;
7.啟動redo應用
NotConnected@> alter database recover managed standby database disconnect from session;
到此,在同一臺主機上建立物理standby的任務就完成了。
關於測試DG的有效性測試請參考《【DG】同一臺主機實現物理Data Guard配置安裝》(http://space.itpub.net/?uid-519536-action-viewspace-itemid-578181)。
三.小結
本文描述的非OMF管理方式下GD的配置方法,因為檔案目錄相對比較固定,配置大同小異。
Good luck.
secooler
10.07.19
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28853590/viewspace-2149929/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【DG】Data Guard主備庫Failove切換AI
- 【DG】Data Guard主備庫Switchover切換
- 【DG】Data Guard搭建(physical standby)
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- 2 Oracle Data Guard 安裝Oracle
- Oracle 19C Data Guard基礎運維-01安裝物理standbyOracle運維
- 同一臺手機安裝同一個應用的測試版,正式版
- 【ASK_ORACLE】Oracle Data Guard(一)DG架構Oracle架構
- Oracle Data Guard簡介Oracle
- 實現多臺EXSI主機集中管理——安裝VMware vCenter
- 單機搭建Data Guard
- 精簡版 koa 簡單實現
- 實戰-使用 Cobbler 安裝一臺 CentOS 主機CentOS
- Linux系統安裝並配置nginx實現多服務同一埠LinuxNginx
- 12c DG新特性 - Active Data Guard Far Sync (Doc ID 2179719.1)
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML RedirectionOracle
- Oracle 19C Data Guard基礎運維-02 Switchovers(物理)Oracle運維
- Oracle 19C Data Guard基礎運維-03 Failovers(物理)Oracle運維AI
- Oracle 11g單主搭建物理DGOracle
- 物理機安裝centos7和簡單設定CentOS
- 12c data guard 使用 sqlplus 主備切換最佳實踐SQL
- CentOS 7安裝etcd和flannel實現docker跨物理機通訊CentOSDocker
- 使用 Cobbler 安裝一臺 CentOS 主機CentOS
- 物理裸機配置如何轉換為天翼云云主機配置
- 3 建立物理DG
- 【DG】Oracle 19c使用dbca來搭建物理DG--主rac備racOracle
- 2 開始實用 Oracle Data GuardOracle
- 【ASK_ORACLE】Oracle Data Guard(二)物理備庫的概念和優勢Oracle
- 【DG】Oracle11g異構平臺之Linux To Windows DataGuard安裝配置--duplicateOracleLinuxWindows
- 【DG】dg中如何配置多個後臺observerServer
- Flink安裝極簡教程-單機版
- [20221111]19c配置Data Guard Broker問題.txt
- win10裝不了迅雷精簡版怎麼解決_win10無法安裝迅雷精簡版如何處理Win10
- Oracle Data Guard Broker元件Oracle元件
- mysql免安裝版的實際配置方法MySql
- 記錄下物理機bond配置及物理機多路徑配置
- 容器雲平臺物理叢集配置實踐
- webpack(簡單安裝配置)Web
- 物理DG、邏輯DG和快照DG的搭建(視訊講解)