hostnamectl set-hostname DG
vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
為橋西等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及橋西網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為做網(wǎng)站、成都網(wǎng)站建設(shè)、橋西網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
重啟網(wǎng)卡
systemctl restart network
測試:
nslookup www.yunxiaochong.com
重啟生效
(1)執(zhí)行env.sh. 配置環(huán)境,腳本如下:
參考: http://blog.itpub.net/69915315/viewspace-2643785/
(2)執(zhí)行rpm.sh . 安裝依賴包,腳本如下:
參考: http://blog.itpub.net/69915315/viewspace-2643785/
參考: http://blog.itpub.net/69915315/viewspace-2643790
單節(jié)點(diǎn)執(zhí)行即可,對應(yīng)主庫共享磁盤組: DATA, GRIDG. 這里只是為了一致,沒有強(qiáng)制要求一樣。
參考 : http://blog.itpub.net/69915315/viewspace-2643299/
分配配置 oracle grid 兩個(gè)用戶的遠(yuǎn)程桌面。
四、安裝grid
(1)解壓安裝包:
unzip linuxamd64_12102_grid_1of2.zip unzip linuxamd64_12102_grid_2of2.zip
(2) 將解壓后的安裝包拷貝到 /home/grid 目錄下
mv grid /home/grid/
(3) 進(jìn)入grid的遠(yuǎn)程桌面,進(jìn)入安裝....
(4) 相關(guān)問題
swap size 問題:
注釋: 上面少寫了一個(gè)0,空間還是不夠,后面有加了一個(gè)。
修改/etc/fstab文件,在文件最后添加:
/opt/image/swap swap swap defaults 0 0
安裝遺漏包
yum install libaio-devel*
忽略pdksh
圖形界面執(zhí)行腳本報(bào)錯(cuò),通過命令執(zhí)行,依然報(bào)錯(cuò)后,再直接提示的命令。
unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip
mv database /home/oracle/
六、配置共享磁盤組
此處是grid_home下的監(jiān)聽,注意將文件內(nèi)容中的grid_home 修改成 oracle_home路徑
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.150)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) SID_LIST_LISTENER = ( SID_LIST = (SID_DESC = (GLOBAL_DBNAME = yun) #CDB #(ORACLE_HOME = /u01/app/11.2/grid) (ORACLE_HOME = /u01/app/oracle/product/11.2/db_1) (SID_NAME = YUNDG) ) (SID_DESC = (GLOBAL_DBNAME = xiaochong) #PDB #(ORACLE_HOME = /u01/app/11.2/grid) (ORACLE_HOME = /u01/app/oracle/product/11.2/db_1) (SID_NAME = YUNDG) ) )
分別在主庫的rac四個(gè)節(jié)點(diǎn)和從庫的一個(gè)節(jié)點(diǎn)上對 tnsnames.ora 進(jìn)行配置
文件路徑:
/u01/app/oracle/product/11.2/db_1/network/admin/tnsnames.ora
##主庫 YUN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = www.yunxiaochong.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = yun) ) ) ##從庫 YUNDG = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.8)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = yun)
在rac中一個(gè)節(jié)點(diǎn)創(chuàng)建密碼文件:
orapwd password='Oracle' file=orapwyun1 entries=20;
然后,將其拷貝到其它三個(gè)節(jié)點(diǎn)和dg節(jié)點(diǎn),將名稱改成orapw+各節(jié)點(diǎn)的實(shí)例名。 如orapwyun2 orapwYUNDG
scp orapwyun1 oracle@rac02:/u01/app/oracle/product/11.2/db_1/dbs/
注意:不要分別在不同節(jié)點(diǎn)上創(chuàng)建密碼文件,不然會報(bào) 密碼文件不一致問題。
(1)查看主庫的數(shù)據(jù)文件,日志文件,控制文件路徑
(2)從庫,用grid用戶,進(jìn)入asmcmd,建立相關(guān)目錄
控制文件目錄:
同樣,建立 +GRIDDG/YUM/CONTROLFILE 目錄。
建立日志文件目錄:
+DATA/YUN/ONLINELOG
+GRIDDG/YUN/ONLINELOG
建立數(shù)據(jù)文件目錄:
+DATA/YUN/DATAFILE
+DATA/YUN/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE
+DATA/YUN/88E906E617243D8FE0536E38A8C04CBC/DATAFILE
+DATA/YUN/88E906E617243D8FE0536E38A8C04CBC/TEMPFILE
從主庫中創(chuàng)建pfile (create pfile from spfile),修改后,拷貝到從庫
路徑: /u01/app/oracle/product/11.2/db_1/dbs/initYUNDG.ora
內(nèi)容如下:
*.audit_sys_operations=FALSE *.audit_trail='NONE' *.compatible='12.1.0.2.0' *.control_files='/u01/app/oracle/oradate/controlfile/control01.ctl' *.db_block_size=8192 *.db_create_file_dest='+DATA' *.db_name='yun' *.db_unique_name='yundg' #*.db_recovery_file_dest='+DATA/' #*.db_recovery_file_dest_size=5535m *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=yunXDB)' *.enable_pluggable_database=true *.fal_client='YUNDG' *.fal_server='YUN' *.log_archive_config='dg_config=(YUNDG,YUN)' *.log_archive_dest_1='location=+DATA/YUN/ARCHIVELOG valid_for=(all_logfiles,all_roles) db_unique_name=yundg' *.log_archive_dest_2='service=YUN LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=yun' *.open_cursors=1000 *.pga_aggregate_target=681m *.processes=300 *.remote_login_passwordfile='exclusive' *.sga_target=2043m *.standby_file_management='AUTO' ##下面兩個(gè)參數(shù)注釋掉,因?yàn)槲覀冊趶膸炫渲昧烁鲙煲粯拥哪夸浗Y(jié)構(gòu)。 #*.log_file_name_convert='+DATA/YUN/onlinelog','+DATA/YUN/onlinelog' #*.db_file_name_convert='+DATA/YUN/datafile','+DATA/YUN/datafile'
這里主要是修改參數(shù):
alter system set log_archive_dest_2='service=YUNDG LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=yundg' scope=both sid='*'; alter system set log_archive_config='dg_config=(YUN,YUNDG)' scope=both sid='*'; alter system set standby_file_management=auto scope=both sid='*'; alter system set fal_client=YUN scope=both sid='*'; alter system set fal_server=YUNDG scope=both sid='*';
設(shè)置force logging
ALTER DATABASE FORCE LOGGING;
rman target sys/Oracle01@YUN auxiliary sys/Oracle01@YUNDG
duplicate target database for standby from active database nofilenamecheck dorecover;
錯(cuò)誤記錄1:
channel ORA_DISK_1: SID=60 instance=yun1 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/28/2019 13:47:31
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 05/28/2019 13:47:29
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12543: TNS:destination host unreachable
ORA-17629: Cannot connect to the remote database server
_______________________________________________________________________________________
主要是主庫不能通過tnsname,ora連接到從庫,確保 sqlplus sys/Oracle01@YUNDG as sysdba 能夠連接
錯(cuò)誤記錄2:
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service YUN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/28/2019 14:04:07
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-19845: error in backupDatafile while communicating with remote database server
ORA-17628: Oracle error 19602 returned by remote Oracle server
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
ORA-19660: some files in the backup set could not be verified
ORA-19661: datafile 1 could not be verified
ORA-19845: error in backupDatafile while communicating with remote database server
ORA-17628: Oracle error 19602 returned by remote Oracle server
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
_______________________________________________________________________________________
主要是主庫沒有歸檔,開啟歸檔即可
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 26
Current log sequence 27
在從庫上創(chuàng)建standby log
alter database add standby logfile thread 1 group 9 size 50m,group 10 size 50m,group 11 size 50m; alter database add standby logfile thread 2 group 12 size 50m,group 13 size 50m,group 14 size 50m; alter database add standby logfile thread 3 group 15 size 50m,group 16 size 50m,group 17 size 50m; alter database add standby logfile thread 4 group 18 size 50m,group 19 size 50m,group 20 size 50m;
如果是要主從切換,在主庫上也要建立standby red log。
alter database open;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
創(chuàng)建用戶,創(chuàng)建表,插入數(shù)據(jù),從庫同步能查詢到數(shù)據(jù)。