親愛滴伙伴們,又見面了。今天我們講講Linux7平臺下Oracle19C RAC安裝的一些必要配置。
環境: 操作系統:Redhat 7.6 數據庫版本:19.7 是否RAC:是 |
為啥要關閉防火墻?
之前發生過由于防火墻的存在,RAC安裝過程中第二個節點運行root.sh失敗,顯示信息為:OracleCRS堆棧的最終檢查失敗,也存在其他潛在的性能和穩定性問題。例如:節點被錯誤驅逐,IPC發送/接收超時等,所以Oracle強烈建議在數據服務器上關閉防火墻。
關閉防火墻:
--查看防火墻狀態
systemctlstatus firewalld
--查看開機是否啟動防火墻服務
systemctlis-enabled firewalld
--關閉防火墻
systemctlstop firewalld
systemctlstatus firewalld
--禁用防火墻(系統啟動時不啟動防火墻服務)
systemctldisable firewalld
systemctlis-enabled firewalld
SELINUX具體定義這里不再多說,其主要作用就是最大限度地減小系統中服務進程可訪問的資源(最小權限原則)。由于可能會觸發數據庫BUG(例如11GR2版本中BUG9746474),所以建議關閉SELINUX。
SELINUX關閉方法:
修改/etc/selinux/config文件,將SELINUX設置為disabled。
為防止Linux7systemd服務刪除/var/tmp/.oracle導致CRS停止工作。因此需要在/usr/lib/tmpfiles.d/tmp.conf中添加以下內容(若已存在請忽略),文檔ID28650460.8有詳細介紹:
x /tmp/.oracle* x /var/tmp/.oracle* x /usr/tmp/.oracle* x /var/tmp/.oracle x /tmp/.oracle x /var/tmp/.oracle x /usr/tmp/.oracle |
在ASMLib及DM不能滿足要求的情況下使用udev來確定ASM磁盤,如果直接使用/dev/sdd的方式可能導致磁盤權限不穩定,配置磁盤后主機務必要進行一次重啟。
文件命名規則為:
/etc/udev/rules.d/99-oracle-asmdevices.rules
內容如下(使用SCSI_ID):
/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdd KERNEL=="sd*",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="369835ed100b92182002322d90000000e", SYMLINK+="asmdiskdata40",OWNER="grid", GROUP="asmadmin",MODE="0660" KERNEL=="sd*",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="369835ed100b9218200251cdc0000002c", SYMLINK+="asmdiskarch01",OWNER="grid", GROUP="asmadmin",MODE="0660" KERNEL=="sd*",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="369835ed100b9218200252c800000002d", SYMLINK+="asmdiskarch02",OWNER="grid", GROUP="asmadmin",MODE="0660" start_udev |
使用路徑:
需要固定/dev/sdd,不能用*代替 KERNEL=="sdd", SUBSYSTEM=="block", NAME="asmdsk1", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sde", SUBSYSTEM=="block", NAME="asmdsk2", OWNER="grid", GROUP="asmadmin", MODE="0660" start_udev |
使用Multipath:
multipath –ll disk04 (360060e8005bf7b000000bf7b00004209) dm-5 HP,OPEN-V size=123G features=1 queue_if_no_path hwhandler=0 wp=rw |-+- policy=round-robin 0 prio=1 status=active | `- 4:0:0:4 sdg 8:96 active ready running |-+- policy=round-robin 0 prio=1 status=enabled | `- 4:0:1:4 sdt 65:48 active ready running |-+- policy=round-robin 0 prio=1 status=enabled | `- 5:0:0:4 sdag 66:0 active ready running `-+- policy=round-robin 0 prio=1 status=enabled `- 5:0:1:4 sdat 66:208 active ready running vi /etc/udev/rules.d/99-oracle-asmdevices.rules KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="360060e8005bf7b000000bf7b00004206", OWNER:="grid", GROUP:=" asmadmin ", MODE="0660" KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="360060e8005bf7b000000bf7b00004207", OWNER:=" grid ", GROUP:=" asmadmin ", MODE="0660" KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="360060e8005bf7b000000bf7b00004208", OWNER:=" grid ", GROUP:=" asmadmin ", MODE="0660" 需要確認/dev/mapper/mpathb對應的wwid號是一致的。 service multipathd restart |
hugepage是在linux2.6內核被引入的,主要提供4k的page和比較大的page的選擇,當我們訪問內存時,首先訪問”pagetable“,然后linux在通過“pagetable”的mapping來訪問真實物理內存(ram+swap)。為了提升性能,linux在cpu中申請固定大小的buffer,被稱為TLB,TLB中保存有“pagetable”的部分內容,這也遵循了讓數據盡可能的靠近cpu原則。在TLB中通過hugetlb來指向hugepage。這些被分配的hugepage作為內存文件系統hugetlbfs(類似tmpfs)提供給進程使用。
系統啟動后,hugepage就被分配并保留,不會pagein/pageout,除非人為干預,如改變hugepage的配置等;根據linux內核的版本和HW的架構,hugepage的大小自定義,具體根據數據庫SGA的大小進行配置。因為采用大page,所以也減少TLB和pagetable的管理壓力。在內存較大的情況下推薦使用HugePage,但是需禁用AMM及RHEL7/SESL11的THP。
計算并設置hugepage參數
腳本hugepages_settings.sh內容如下:
#!/bin/bash
#
#hugepages_settings.sh
#
#Linux bash script to compute values for the
#recommended HugePages/HugeTLB configuration
#on Oracle Linux
#
#Note: This script does calculation for all shared memory
#segments available when the script is run, no matter it
#is an Oracle RDBMS shared memory segment or not.
#
#This script is provided by Doc ID 401749.1 from My Oracle Support
#http://support.oracle.com
#Welcome text
echo"
Thisscript is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com)where it is intended to compute values for
therecommended HugePages/HugeTLB configuration for the current shared
memorysegments on Oracle Linux. Before proceeding with the execution pleasenote following:
*For ASM instance, it needs to configure ASMM instead of AMM.
*The pga_aggregate_target is outside the SGA and
youshould accommodate this while calculating the overall size.
*In case you changes the DB SGA size,
asthe new SGA will not fit in the previous HugePages configuration,
ithad better disable the whole HugePages,
startthe DB with new SGA size and run the script again.
Andmake sure that:
*Oracle Database instance(s) are up and running
*Oracle Database 11g Automatic Memory Management (AMM) is not setup
(SeeDoc ID 749851.1)
*The shared memory segments can be listed by command:
#ipcs -m
PressEnter to proceed..."
read
#Check for the kernel version
KERN=`uname-r | awk -F. { printf("%d.%d ",$1,$2); }`
#Find out the HugePage size
HPG_SZ=`grepHugepagesize /proc/meminfo | awk {print $2}`
if[ -z "$HPG_SZ" ];then
echo"The hugepages may not be supported in the system where thescript is being executed."
exit1
fi
#Initialize the counter
NUM_PG=0
#Cumulative number of pages required to handle the running sharedmemory segments
forSEG_BYTES in `ipcs -m | cut -c44-300 | awk {print $1} | grep"[0-9][0-9]*"`
do
MIN_PG=`echo"$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if[ $MIN_PG -gt 0 ]; then
NUM_PG=`echo"$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
RES_BYTES=`echo"$NUM_PG * $HPG_SZ * 1024" | bc -q`
#An SGA less than 100MB does not make sense
#Bail out if that is the case
if[ $RES_BYTES -lt 100000000 ]; then
echo"***********"
echo"** ERROR **"
echo"***********"
echo"Sorry! There are not enough total of shared memory segmentsallocated for
HugePagesconfiguration. HugePages can only be used for shared memory segments
thatyou can list by command:
#ipcs -m
ofa size that can match an Oracle Database SGA. Please make sure that:
*Oracle Database instance is up and running
*Oracle Database 11g Automatic Memory Management (AMM) is notconfigured"
exit1
fi
#Finish with results
case$KERN in
2.4)HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo"Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
2.6)echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
3.8)echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
3.10)echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
4.1)echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
4.14)echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*)echo "Kernel version $KERN is not supported by this script(yet). Exiting." ;;
esac
#End
腳本來自MOS文章401749.1,運行腳本是需要啟動所有數據庫實例,并禁用AMM,即設置memory_target=0。
運行腳本計算:
./hugepages_settings.sh
...
Recommendedsetting: vm.nr_hugepages = 1496
設置參數:
vi/etc/sysctl.conf
vm.nr_hugepages= 1496
重起驗證
調整數據庫參數:
use_large_pages=only
重起主機shutdown-ry 0 (使禁用THP及nr_hugepages參數生效)
啟動數據庫,驗證是否使用:
#grep HugePages /proc/meminfo
AnonHugePages: 0 kB
HugePages_Total: 1496
HugePages_Free: 485
HugePages_Rsvd: 446
HugePages_Surp: 0
從RedHat6,OL6,SLES11和UEK2內核開始,實現并啟用了透明大頁,以嘗試改善內存管理。透明大頁與早期Linux版本中可用的HugePages類似。主要區別在于,透明大頁是在運行時由內核中的khugepaged線程動態設置的,而常規HugePages必須在啟動時進行預分配。
但是由于透明大頁會導致意外的節點重啟和RAC性能問題,所以Oracle強烈建議禁用透明大頁。此外,即使在單實例數據庫環境中,透明大頁也可能會導致意外的性能問題或延遲。因此,Oracle建議在所有運行Oracle的數據庫服務器上禁用透明大頁。
RHEL7為例:
編輯/etc/default/grub,將transparent_hugepage=never加入含有GRUB_CMDLINE_LINUX行最后。
vi/etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(seds, release .*$,,g /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=autord.lvm.lv=vg_sys/lv_root rd.lvm.lv=vg_sys/lv_swap rhgb quiettransparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
運行:grub2-mkconfig-o /boot/grub2/grub.cfg
重起后驗證(也可以稍后調整系統參數后重起)
cat/sys/kernel/mm/transparent_hugepage/enabled
alwaysmadvise [never] ?---表示選中了never
好了,本次19C配置分享到此結束,我們下回分解見。
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/130181.html
摘要:最近工作中用到了作為測試的數據庫,在裝和折騰了很久,這篇文章就這兩點對大家分享一些我安裝過程中遇到的問題和注意點,暫時還未配置,稍后找時間補上現在網上找一篇好的文章好難,往往要在一個話題或技術上找多方資源東拼西湊,互相借鑒才能達成目的,原因 最近工作中用到了Oracle作為Intel測試的數據庫,在裝Oracle Linux和Oracle Database 11g R2折騰了很久,這...
閱讀 1346·2023-01-11 13:20
閱讀 1684·2023-01-11 13:20
閱讀 1132·2023-01-11 13:20
閱讀 1858·2023-01-11 13:20
閱讀 4100·2023-01-11 13:20
閱讀 2704·2023-01-11 13:20
閱讀 1385·2023-01-11 13:20
閱讀 3597·2023-01-11 13:20