5 этап - Automating Oracle database Shutdown and Startup by systemd
Huge Pages on Oracle Linux
Huge Pages on Oracle Linux
Quick checking
# cat /proc/sys/vm/nr_hugepages
2054
or
# cat /proc/meminfo | grep Huge
AnonHugePages: 0 kB
HugePages_Total: 2054
HugePages_Free: 546
HugePages_Rsvd: 542
HugePages_Surp: 0
Hugepagesize: 2048 kB
Checking if transparent huge pages are disabled`
# cat /sys/kernel/mm/transparent_hugepage/enabled`Viewing database 11.2 alert log`
************************ Large Pages Information *******************`Simplified setup`setup
- Have the memlock user limit set in /etc/security/limits.conf file. Set the value (in KB) slightly smaller than total RAM (90%) , at least it must be bigger than HugePages size.
`* soft memlock`14680064`14680064* hard memlock`14680064`14680064Atentu! If you use systemd to auto startup databases, systemd ignores limits.conf. You need to add the following to a service unit file``
[Service]`
`LimitMEMLOCK=infinity`infinity
`LimitNOFILE=65535`65535
``
- Get the required number of pages from alert.log (EXPECTED_PAGES) or by running Oracle script hugepages_settings.sh (Doc ID 401749.1)
`
3. edit vm.nr_hugepages in /etc/sysctl.conf as root`HugePages on Oracle Linux 64-bit (Doc ID 361468.1)`Automating Oracle database Shutdown and Startup by systemd
Automating by systemd
alternatives are Oracle Restart or SysV init ( /etc/init.d in older Linux).
Service Unit file typically has extension .service and stored in
/usr/lib/systemd/system
/etc/systemd/system
/usr/lib/systemd/user
/etc/systemd/user
For more details read Chapter 9. Managing Services with systemd
Create or edit a service unit file:
cd /etc/systemd/system
vi oracle_database.service
[Unit]
Description=The Oracle Database Service
After=network.target
[Service]
Type=forking
RemainAfterExit=yes
KillMode=none
TimeoutStopSec=10min
# memlock limit is needed for SGA to use HugePages
LimitMEMLOCK=infinity
LimitNOFILE=65535
User=oracle
Group=oinstall
# Please use absolute path here
# ExecStart=$ORACLE_HOME/bin/dbstart $ORACLE_HOME &
# First argument of dbstart is used to bring up Listener
ExecStart=/opt/oracle/product/12.1.0/se2_1/bin/dbstart /opt/oracle/product/12.1.0/se2_1 &
ExecStop=/opt/oracle/product/12.1.0/se2_1/bin/dbshut /opt/oracle/product/12.1.0/se2_1
Restart=no
[Install]
# Puts wants directive for the other units in the relationship
WantedBy=default.target
Источник: https://alexzy.blogspot.com/2017/10/
Huge Pages
systemd ignores /etc/security/limits.conf. If HugePages are configured, you need to use LimitMEMLOCK and LimitNOFILE, otherwise SGA will use small pages and database alert log will show:
reload systemd and enable the service:
systemctl daemon-reload
systemctl enable oracle_database.service
list services:
systemctl list-unit-files --type service|grep oracle
Start the service and check its status
systemctl start oracle_database.service
systemctl status oracle_database.service
Источник: https://alexzy.blogspot.com/2017/10/automating-oracle-database-shutdown-and.htmlHuge Pages on Oracle Linux