Oracle数据库管理每周一例-第十四期 19c需要调整的参数及操作

Oracle数据库管理每周一例(12.2,18c,19c) 2020-09-13

  • 第十四期 19c需要调整的参数及操作
    • 1.说明
    • 2.需要调整的参数
    • 3.补丁
    • 下期预告:

第十四期 19c需要调整的参数及操作

本周还好,没有工作日的晚上加班,周末也没有再加班,终于在周末睡了个懒觉。然鹅又忘记写了,只能第二周周一补上

1.说明

Exadata经过3个月的运行,通过exachk、AWR、SR等各方面,对19.6版本中各种参数、bug、补丁等方面进行总结

2.需要调整的参数

1.针对每个实例配置对应的internal connect连接的IP。

alter system set CLUSTER_INTERCONNECTS='192.nnn.nnn.X1:192.nnn.nnn.X2' sid='' scope=spfile;
需要重启实例

2.数据库开启仅适用大页内存

alter system set use_large_pages='ONLY' scope=spfile sid='*';
需要重启实例

在开启该参数以前需要在配置好数据库SGA并数据库处于运行状态下通过以下脚本生成系统大页配置:

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 "
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments on Oracle Linux. Before proceeding with the execution please note following:
 * For ASM instance, it needs to configure ASMM instead of AMM.
 * The 'pga_aggregate_target' is outside the SGA and
   you should accommodate this while calculating the overall size.
 * In case you changes the DB SGA size,
   as the new SGA will not fit in the previous HugePages configuration,
   it had better disable the whole HugePages,
   start the DB with new SGA size and run the script again.
And make sure that:
 * Oracle Database instance(s) are up and running
 * Oracle Database 11g Automatic Memory Management (AMM) is not setup
   (See Doc ID 749851.1)
 * The shared memory segments can be listed by command:
     # ipcs -m


Press Enter to proceed..."

read

# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`

# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
if [ -z "$HPG_SZ" ];then
    echo "The hugepages may not be supported in the system where the script is being executed."
    exit 1
fi

# Initialize the counter
NUM_PG=0

# Cumulative number of pages required to handle the running shared memory segments
for SEG_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 segments allocated for
HugePages configuration. HugePages can only be used for shared memory segments
that you can list by command:

    # ipcs -m

of a 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 not configured"
    exit 1
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" ;;
    '5.4') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    *) echo "Kernel version $KERN is not supported by this script (yet). Exiting." ;;
esac

# End

chmod +x hugepages_settings.sh
./hugepages_settings.sh
---> Recommended setting: vm.nr_hugepages = XXXX

将上面脚本生成内容写入到/etc/sysctl.conf中,通过下面命令生效
sysctl -p

3.通过脚本检查ksplice更新及处理

ksplice_check.sh
if rpm -qa|grep -q uptrack-updates-$(uname -r)
then
  RAW_UPTRACK_SHOW=$(uptrack-show --available 2>&1)
  availUpdates=$(echo "$RAW_UPTRACK_SHOW" | grep -A1 'Available updates:' | tail -1)
  if [[ "$availUpdates" == 'None' ]]
  then
    echo 'SUCCESS: All available ksplice updates are installed.'
  else
    echo -e "FAIL: All available ksplice updates are not installed. Run 'uptrack-install --all -y' as the root user.  Details:\n$RAW_UPTRACK_SHOW"
  fi
else
  echo 'SUCCESS: ksplice updates are not used on this system.'
fi
如果出现FAIL,则执行(需要配置yum源,对应系统版本ISO即可):
uptrack-install --all -y

4.调整db_files

alter system set db_files=4096 scope=spfile sid='*';
需要重启实例

5.关闭DRM(具体详见11期)

alter system set "_lm_drm_disable"=4/5 scope=both sid='*';
无需重启实例

or
alter system set "_lm_drm_disable"=7 scope=both sid='*';
需要重启实例

6.关闭实时统计信息收集(出现多次因该特性引起锁表)

alter system set "_optimizer_gather_stats_on_conventional_dml" = false scope=both sid='*' ; 
alter system set "_optimizer_use_stats_on_conventional_dml" = false scope=both sid='*' ;

7.调整readmostly objects参数

alter system set "_gc_persistent_read_mostly"=false scope=spfile sid='*';
alter system set "_gc_read_mostly_locking"=false scope=spfile sid='*';

上面第一条参数修改后需要完全重启整个集群,否则无法修改,该条参数与DRM相关,关闭DRM后可以不进行修改

srvctl stop database -db xxxx
srvctl start database -db xxxx

3.补丁

在使用过程中,除了第十期第一节的bug对应补丁(Bug 30524762 - Application session stuck on gc current request,该bug对应补丁已由BUG 30978554 - RAC HIT ORA 481 AND TERMINATED INSTANCES对应补丁替代),该补丁应用后gc current request的相关问题并未得到显著改善。后面SR匹配到另外一个BUG 30937410 19.3.0.0.0DBRU SESSIONS BLOCKED WAITING FOR GC WAITS FOR A LONG TIME Candidate。由于30937410和30978554两个补丁是互相冲突的,需要通过SR申请由Oracle后台开发提供针对当前数据库版本的这两个bug的融合补丁。应用融合补丁之前回退了30978554。融合补丁安装完成后暂未再发现问题。
这里也说明一下,在能使用DBRU解决问题的情况下,尽量少使用one-off patch,因为这些补丁往往是解决特定的问题,很多时候没有进行联调联测,又是会引发其他问题,需要谨慎。

下期预告:

一些工具和小技巧

你可能感兴趣的:(Oracle,数据库)