您好,登錄后才能下訂單哦!
hostnamectl set-hostname DG
vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
重啟網卡
systemctl restart network
測試:
nslookup www.yunxiaochong.com
重啟生效
(1)執行env.sh. 配置環境,腳本如下:
參考: http://blog.itpub.net/69915315/viewspace-2643785/
(2)執行rpm.sh . 安裝依賴包,腳本如下:
參考: http://blog.itpub.net/69915315/viewspace-2643785/
參考: http://blog.itpub.net/69915315/viewspace-2643790
單節點執行即可,對應主庫共享磁盤組: DATA, GRIDG. 這里只是為了一致,沒有強制要求一樣。
參考 : http://blog.itpub.net/69915315/viewspace-2643299/
分配配置 oracle grid 兩個用戶的遠程桌面。
四、安裝grid
(1)解壓安裝包:
unzip linuxamd64_12102_grid_1of2.zip unzip linuxamd64_12102_grid_2of2.zip
(2) 將解壓后的安裝包拷貝到 /home/grid 目錄下
mv grid /home/grid/
(3) 進入grid的遠程桌面,進入安裝....
(4) 相關問題
swap size 問題:
注釋: 上面少寫了一個0,空間還是不夠,后面有加了一個。
修改/etc/fstab文件,在文件最后添加:
/opt/image/swap swap swap defaults 0 0
安裝遺漏包
yum install libaio-devel*
忽略pdksh
圖形界面執行腳本報錯,通過命令執行,依然報錯后,再直接提示的命令。
unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip
mv database /home/oracle/
六、配置共享磁盤組
此處是grid_home下的監聽,注意將文件內容中的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四個節點和從庫的一個節點上對 tnsnames.ora 進行配置
文件路徑:
/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中一個節點創建密碼文件:
orapwd password='Oracle' file=orapwyun1 entries=20;
然后,將其拷貝到其它三個節點和dg節點,將名稱改成orapw+各節點的實例名。 如orapwyun2 orapwYUNDG
scp orapwyun1 oracle@rac02:/u01/app/oracle/product/11.2/db_1/dbs/
注意:不要分別在不同節點上創建密碼文件,不然會報 密碼文件不一致問題。
(1)查看主庫的數據文件,日志文件,控制文件路徑
(2)從庫,用grid用戶,進入asmcmd,建立相關目錄
控制文件目錄:
同樣,建立 +GRIDDG/YUM/CONTROLFILE 目錄。
建立日志文件目錄:
+DATA/YUN/ONLINELOG
+GRIDDG/YUN/ONLINELOG
建立數據文件目錄:
+DATA/YUN/DATAFILE
+DATA/YUN/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE
+DATA/YUN/88E906E617243D8FE0536E38A8C04CBC/DATAFILE
+DATA/YUN/88E906E617243D8FE0536E38A8C04CBC/TEMPFILE
從主庫中創建pfile (create pfile from spfile),修改后,拷貝到從庫
路徑: /u01/app/oracle/product/11.2/db_1/dbs/initYUNDG.ora
內容如下:
*.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' ##下面兩個參數注釋掉,因為我們在從庫配置了跟主庫一樣的目錄結構。 #*.log_file_name_convert='+DATA/YUN/onlinelog','+DATA/YUN/onlinelog' #*.db_file_name_convert='+DATA/YUN/datafile','+DATA/YUN/datafile'
這里主要是修改參數:
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='*';
設置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;
錯誤記錄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 能夠連接
錯誤記錄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
在從庫上創建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;
創建用戶,創建表,插入數據,從庫同步能查詢到數據。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。