同一臺(tái)主機(jī)如何實(shí)現(xiàn)物理Data Guard配置安裝,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。
創(chuàng)新互聯(lián)建站是專業(yè)的阿拉善盟網(wǎng)站建設(shè)公司,阿拉善盟接單;提供網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行阿拉善盟網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
一.Primary數(shù)據(jù)庫配置
1.確認(rèn)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庫創(chuàng)建standby數(shù)據(jù)庫控制文件
sys@ocmdb> !mkdir -p /home/oracle/backup
sys@ocmdb> alter database create standby controlfile as '/home/oracle/backup/ocmdg.ctl';
4.創(chuàng)建primary庫客戶端初始化參數(shù)文件
1).創(chuàng)建主庫中的pfile
sys@ocmdb> create pfile from spfile;
2).備份到backup目錄,用于創(chuàng)建備庫的pfile
sys@ocmdb> ! cp /u01/app/oracle/product/10.2.0/db_1/dbs/initocmdb.ora /home/oracle/backup/initocmdg.ora
3).修改后主庫pfile中內(nèi)容如下:
[oracle@ocmdb1 ~]$ mkdir /home/oracle/ocmdb_arch
vi $ORACLE_HOME/dbs/initocmdb.ora
以下內(nèi)容追加到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)
)
)
驗(yàn)證監(jiān)聽
tnsping ocmdb
tnsping ocmdg
二.Standby數(shù)據(jù)庫配置
1.創(chuàng)建密碼文件,注意保持sys 密碼與primary 數(shù)據(jù)庫一致
cd $ORACLE_HOME/dbs
orapwd file=orapwocmdg password=oracle1 entries=20
2.創(chuàng)建所需目錄(注意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.復(fù)制數(shù)據(jù)文件到standby庫對(duì)應(yīng)的目錄(datafile,log,controlfiles)
關(guān)閉主庫
export ORACLE_SID=ocmdb
sqlplus / as sysdba
shutdown immediate;
1).拷貝數(shù)據(jù)文件
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初始化參數(shù)文件
[oracle@ocmdb1 ~]$ mkdir /home/oracle/ocmdg_arch
1).standby的初始化參數(shù)如下
cp /home/oracle/backup/initocmdg.ora /u01/app/oracle/product/10.2.0/db_1/dbs/initocmdg.ora
注意需要將所有與路徑相關(guān)的參數(shù)調(diào)整正確
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 創(chuàng)建spfile
export ORACLE_SID=ocmdg
create spfile from pfile
5.啟動(dòng)主庫實(shí)例
export ORACLE_SID=ocmdb
sqlplus / as sysdba
startup;
6.啟動(dòng)standby到mount
export ORACLE_SID=ocmdg
sqlplus / as sysdba
NotConnected@> startup mount;
7.啟動(dòng)redo應(yīng)用
NotConnected@> alter database recover managed standby database disconnect from session;
到此,在同一臺(tái)主機(jī)上創(chuàng)建物理standby的任務(wù)就完成了。
關(guān)于測(cè)試DG的有效性測(cè)試請(qǐng)參考《【DG】同一臺(tái)主機(jī)實(shí)現(xiàn)物理Data Guard配置安裝》(http://space.itpub.net/?uid-519536-action-viewspace-itemid-578181)。
這里描述的非OMF管理方式下GD的配置方法,因?yàn)槲募夸浵鄬?duì)比較固定,配置大同小異。
看完上述內(nèi)容,你們掌握同一臺(tái)主機(jī)如何實(shí)現(xiàn)物理Data Guard配置安裝的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!