数据库管理-第143期 Oracle DB 19c需要调整的基本参数V2(20240202)

数据库管理-第143期 Oracle DB 19c需要调整的基本参数V2(20240202)

作者:胖头鱼的鱼缸(尹海文)
Oracle ACE Associate: Database(Oracle与MySQL)
网思科技 DBA总监
10年数据库行业经验,现主要从事数据库服务工作
拥有OCM 11g/12c/19c、MySQL 8.0 OCP、Exadata、CDP等认证
墨天轮MVP、认证技术专家,ITPUB认证专家,OCM讲师
圈内拥有“总监”、“保安”、“国产数据库最大敌人”等称号,非著名社恐(社交恐怖分子)
公众号:胖头鱼的鱼缸;CSDN:胖头鱼的鱼缸(尹海文);墨天轮:胖头鱼的鱼缸;ITPUB:yhw1809。
除授权转载并标明出处外,均为“非法”抄袭。

2020年9月14日写过一篇《Oracle数据库管理每周一例-第十四期 19c需要调整的参数及操作》(https://blog.csdn.net/yhw1809/article/details/108571904),但是时过境迁,而且当时也是为了处理一些19c前期版本BUG和在Exadata上进行的调整,这里针对19c较新补丁(≥19.20)的数据库参数或操作进行一个总结。本文不包含针对特定BUG和功能性调整的参数变更。

1 DRM

DRM仍然是RAC环境运行的主要不稳定因素之一,简介《Oracle数据库管理每周一例-第十一期 DRM》(https://blog.csdn.net/yhw1809/article/details/108195827),这里仍然建议关闭DRM:

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

2 readmostly objects

该参数依然可能造成GC相关异常:

alter system set "_gc_persistent_read_mostly"=false scope=spfile sid='*';
alter system set "_gc_read_mostly_locking"=false scope=spfile sid='*';
需要重启集群

3 内存大页

Oracle数据库建议开启内存大页:

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
alter system set use_large_pages='ONLY' scope=spfile sid='*';
需要重启实例

4 CLUSTER_INTERCONNECTS

Oracle RAC建议在数据库配置CLUSTER_INTERCONNECTS相关参数以提升私网连接指向性与性能:

alter system set CLUSTER_INTERCONNECTS='192.nnn.nnn.X1:192.nnn.nnn.X2' sid='<instanceName>' scope=spfile;
按实例配置不同节点私网IP信息,需要重启集群

5 db_files

Oracle默认db_files大小往往不能满足实际生产需求:

alter system set db_files=10240 scope=spfile sid='*';
需要重启集群

6 内存配置

不要在PDB级别配置SHARED_POOL_SIZE, SGA_MIN_SIZE, DB_CACHE_SIZE,容易出现ORA-04031的问题切Shared pool无法释放。详见《数据库管理-第八十三期 炒点冷饭(20230620)》(https://blog.csdn.net/yhw1809/article/details/131305269)。如果因为业务程序造成Shared pool过大挤占db_cache大小,可以在CDB级别配置shared_pool_size和db_cache_size,让PDB去自动争用。

7 555.1

Oracle Database 19c Important Recommended One-off Patches (Doc ID 555.1),这个DOC中包含了19c最近4个版本的重要One-off补丁。还是需要注意一点,Oracle数据库上,不是每一个BUG都会被触发,而且大多数BUG有Workaround。如不是特定情况不建议使用One-off补丁,现在可以使用季度补丁上的月度MRP解决大部分问题。

总结

算是一篇划水,重新整理了下Oracle DB 19c(≥19.20)需要调整的基本参数。
老规矩,知道写了些啥。

  • 24
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

胖头鱼的鱼缸(尹海文)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值