節(jié)點(diǎn) | 主機(jī)版本 | 主機(jī)名 | 實(shí)例名 | Oracle版本 | IP地址 |
---|---|---|---|---|---|
rac01 | rhel7.9 | rac01 | cdb19c | 19.3.0(補(bǔ)丁 29585399) | 10.211.55.100 |
rac02 | rhel7.9 | rac02 | orcl+cdb19c | 19.3.0(補(bǔ)丁 29585399) | 10.211.55.101 |
備庫(kù) | rhel7.9 | dbca_stby | 不創(chuàng)建實(shí)例 | 19.3.0(補(bǔ)丁 29585399) | 10.211.55.110 |
注意:
1、db_unique_name主備庫(kù)不能相同。
2、db_name主備庫(kù)需保持一致。
3、主備庫(kù)DB版本需保持一致。
Oracle測(cè)試環(huán)境安裝:
可參考:DBA運(yùn)維福音:10分鐘,Linux一行命令安裝Oracle數(shù)據(jù)庫(kù)
主庫(kù)RAC環(huán)境一鍵安裝:
./OracleShellInstall.sh -i 10.211.55.100 `#Public ip`\ -n rac `# hostname`\ -c TRUE `# cdb`\ -pb orcl `# pdb`\ -o cdb19c `# oraclesid`\ -rs oracle `# root password`\ -op oracle `# oracle password`\ -gp oracle `# grid password`\ -b /u01/app `# install basedir`\ -s AL32UTF8 `# characterset`\ -pb1 10.211.55.100 -pb2 10.211.55.101 `# node public ip`\ -vi1 10.211.55.102 -vi2 10.211.55.103 `# node virtual ip`\ -pi1 1.1.1.1 -pi2 1.1.1.2 `# node private ip`\ -si 10.211.55.105 `# scan ip`\ -dd /dev/sdc `# asm data disk`\ -od /dev/sdb `# asm ocr disk`\ -or EXTERNAL `# asm ocr redundancy`\ -dr EXTERNAL `# asm data redundancy`\ -on OCR `# asm ocr diskgroupname`\ -dn DATA `# asm data diskgroupname`\ -puf eth0 -prf eth1 `# network fcname`\ -tsi 10.211.55.200 `# timeserver`\ -gpa 32545008 `# Grid PSU NUMBER`
備庫(kù)一鍵安裝:(備庫(kù)僅安裝ORACLE軟件,不建庫(kù))
./OracleShellInstall.sh -i 10.211.55.110 -n dbca_stby -o cdb19c -opa 32545013 -w Y
a.配置hosts文件
主庫(kù):
cat EOF >> /etc/hosts ##FOR DG BEGIN 10.211.55.110 dbca_stby ##FOR DG END EOF
備庫(kù):
cat EOF >> /etc/hosts ##FOR DG BEGIN 10.211.55.100 rac01 10.211.55.101 rac02 10.211.55.105 rac-scan ##FOR DG END EOF
b.配置靜態(tài)監(jiān)聽和TNS
listener.ora增加靜態(tài)監(jiān)聽:
grid用戶執(zhí)行:
rac01
cat EOF >> $TNS_ADMIN/listener.ora ##FOR DG BEGIN SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = cdb19c) (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db) (SID_NAME = cdb19c1) ) ) ##FOR DG END EOF
rac02
cat EOF >> $TNS_ADMIN/listener.ora ##FOR DG BEGIN SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = cdb19c) (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db) (SID_NAME = cdb19c2) ) ) ##FOR DG END EOF
備庫(kù)
cat EOF >>$TNS_ADMIN/listener.ora ##FOR DG BEGIN SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = cdb19c_stby) (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db) (SID_NAME = cdb19c_stby) ) ) ##FOR DG END EOF
重啟監(jiān)聽
#主庫(kù)RAC重啟監(jiān)聽 srvctl stop listener srvctl start listener ##備庫(kù)重啟監(jiān)聽 lsnrctl start
tnsnames.ora增加TNS:
oracle用戶執(zhí)行:
cat EOF >> $TNS_ADMIN/tnsnames.ora ##FOR DG BEGIN CDB19C = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = cdb19c) ) ) CDB19C1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac01)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = cdb19c) ) ) CDB19C2 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac02)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = cdb19c) ) ) CDB19C_STBY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dbca_stby)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = cdb19c_stby) ) ) ##FOR DG BEGIN EOF
tnsping測(cè)試連通性:
tnsping cdb19c tnsping cdb19c1 tnsping cdb19c2 tnsping cdb19c_stby
c.主庫(kù)配置參數(shù)
SQL> select force_logging,log_mode,cdb from gv$database; FORCE_LOGGING LOG_MODE CDB --------------------------------------- YES ARCHIVELOG YES
如果沒(méi)有開啟強(qiáng)制日志:
alter database force logging;
如果沒(méi)有開啟歸檔日志:
shutdown immediate startup mount alter database archivelog; alter database open; alter pluggable database all open;
d.主庫(kù)添加stanby log文件
set line222 col member for a60 select t2.thread#,t1.group#,t1.member,t2.bytes/1024/1024 from v$logfile t1,v$log t2 where t1.group#=t2.group# order by 1,2;
--需要注意: --1.stanby log日志大小至少要和redo log日志一樣大小,不能小于 --2.stanby log數(shù)量: standby logfile=(1+logfile組數(shù))=(1+2)=3組,每個(gè)thread需要加3組standby logfile. --3.thread要與redo log保持一致,如果是rac,需要增加多個(gè)thread對(duì)應(yīng)的standby log ALTER DATABASE ADD STANDBY LOGFILE thread 1 group 5 ('+DATA') SIZE 120M, group 6 ('+DATA') SIZE 120M, group 7 ('+DATA') SIZE 120M; ALTER DATABASE ADD STANDBY LOGFILE thread 2 group 8 ('+DATA') SIZE 120M, group 9 ('+DATA') SIZE 120M, group 10 ('+DATA') SIZE 120M;
select t2.thread#,t1.group#,t1.member,t2.bytes/1024/1024 from v$logfile t1,v$standby_log t2 where t1.group#=t2.group# order by 1,2;
oracle用戶執(zhí)行:
dbca -silent -createDuplicateDB \ -gdbName cdb19c \ -sid cdb19c \ -sysPassword oracle \ -primaryDBConnectionString 10.211.55.105:1521/cdb19c \ -nodelist dbca_stby \ -databaseConfigType SINGLE \ -createAsStandby -dbUniqueName cdb19c_stby \ -datafileDestination '/oradata'
DBCA物理DG創(chuàng)建成功。
--主庫(kù)設(shè)置DG參數(shù) ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(CDB19C,CDB19C_STBY)' sid='*'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CDB19C' sid='*'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=cdb19c_stby ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=CDB19C_STBY' sid='*'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE sid='*'; ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=4 sid='*'; ALTER SYSTEM SET FAL_SERVER=CDB19C_STBY sid='*'; ALTER SYSTEM SET FAL_CLIENT=CDB19C sid='*'; ALTER SYSTEM SET DB_FILE_NAME_CONVERT='+DATA','/oradata/CDB19C_STBY' SCOPE=SPFILE sid='*'; ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='+DATA','/oradata/CDB19C_STBY' SCOPE=SPFILE sid='*'; ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO sid='*';
注意:RAC修改參數(shù)需要加上 sid='*'
,修改多個(gè)實(shí)例。
--備庫(kù)設(shè)置DG參數(shù) ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(CDB19C_STBY,CDB19C)'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CDB19C_STBY'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=CDB19C ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=CDB19C'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE; ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=4; ALTER SYSTEM SET FAL_SERVER=CDB19C; ALTER SYSTEM SET FAL_CLIENT=CDB19C_STBY; ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/oradata/CDB19C_STBY','+DATA' SCOPE=SPFILE; ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/oradata/CDB19C_STBY','+DATA' SCOPE=SPFILE; ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
查看OMF參數(shù)配置:
show parameter db_create_file_dest
注意:如果同時(shí)設(shè)置OMG和DB_FILE_NAME_CONVERT參數(shù),則優(yōu)先OMF參數(shù)。
##備庫(kù)執(zhí)行 alter database recover managed standby database using current logfile disconnect from session; ##主庫(kù)執(zhí)行 alter system set log_archive_dest_state_2=enable sid='*';
主庫(kù)創(chuàng)建測(cè)試數(shù)據(jù):
alter session set container=orcl;
sqlplus lucifer/lucifer@orcl
備庫(kù)查看是否同步:
至此,ADG已搭建完畢。感謝食用~
參考文章:
官方文檔12c:Using DBCA to Create a Data Guard Standby 12C
官方文檔19c:Using DBCA to Create a Data Guard Standby 19C
官方文檔21c:Using DBCA to Create a Data Guard Standby 21C
MOS文檔:Creating a Physical Standby database using DBCA duplicate (Doc ID 2283697.1)
以上就是DBCA搭建Oracle ADG的詳細(xì)內(nèi)容,更多關(guān)于DBCA搭建Oracle ADG的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
標(biāo)簽:雞西 貴港 AXB 張掖 阜陽(yáng) 酒泉 衡水 萍鄉(xiāng)
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《DBCA命令行搭建Oracle ADG的流程》,本文關(guān)鍵詞 DBCA,命令行,搭建,Oracle,ADG,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。