iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >Oracle实例囚笼分析
  • 659
分享到

Oracle实例囚笼分析

2024-04-02 19:04:59 659人浏览 安东尼
摘要

本篇内容介绍了“oracle实例囚笼分析”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!Oracle实例囚笼

本篇内容介绍了“oracle实例囚笼分析”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

Oracle实例囚笼(Instance Caging)



当多个实例运行在同一台服务器上时,为了避免实例间的相互影响,从oracle 11gr2开始推出了实例囚笼的概念。实例囚笼能够限制数据库实例使用的CPU资源。使用实例囚笼,只需要设置CPU_COUT和resource_manager_plan两个参数。该功能可以用于的数据库资源整合,而取代之前的虚拟化和分区等传统的资源分割方法

1,打开swingbench准备设置后进行压力测试(具体方法见前面文章)
2,查看服务器的CPU个数
select value from v$osstat where stat_name = 'NUM_CPUS';
3,开启Instance Caging,只需设置两个参数即可
alter system set cpu_count = 4;
alter system set resource_manager_plan = 'default_plan'; 
备注:这个地方很奇怪,第一次使用报错ORA-00450,经过一段时间后,设置竟然成功了

4,验证功能已经启用
sql> select instance_caging from v$rsrc_plan where is_top_plan = 'TRUE';

INS
---
ON
SQL> show parameter cpu_count; 

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cpu_count                            integer     4
5,查看功能使用情况

SQL> select to_char(begin_time, 'HH24:MI') time, sum(avg_running_sessions) avg_running_sessions, sum(avg_waiting_sessions) avg_waiting_sessions from v$rsrcmgrmetric_history group by begin_time order by begin_time;

TIME  AVG_RUNNING_SESSIONS AVG_WAITING_SESSIONS
----- -------------------- --------------------
14:48               .82905           .000083333
14:49                 .536               .40295
14:50           .334233333           .060016667

17:30           8.53193333           4.39328333
17:31             15.85885                .0001
17:32              9.46965           22.3486667


avg_running_sessions是一分钟内的活动sessions数,如果次数远小于CPU_COUNT,这实例远没有达到限制。如果AVG_WAITING_SESSIONS很大,这系统基本达到最大限制了


6,可以动态的调整CPU_COUNT来调整实例使用的资源。下面是测试结果

a, 设置cpu_count为32,即不设置限制。
SQL> alter system set cpu_count =32;
开始压力测试,PC服务器的TPMC达到45万TPMC,CPU利用率75%左右
09:44:17          all     69.73      0.00      5.65      2.83      0.00     21.79
09:44:27          all     71.52      0.00      5.81      2.69      0.00     19.99
09:44:37          all     61.98      0.00      5.12      2.91      0.00     29.99
09:44:47          all     69.76      0.00      5.66      3.58      0.00     21.00

b, 设置实例囚笼功能,即限制CPU_cout为16,数据库出现大量resmgr:cpu quantum等待事件(这个和资源管理有关),此时系统利用率65%左右,但%user为50%左右,即16个cpu.TPMC为20万。能力受到限制
SQL> alter system set cpu_count=16;

09:49:28          CPU     %user     %nice   %system   %iowait    %steal     %idle
09:49:38          all     53.91      0.00      8.78      1.81      0.00     35.50
09:49:48          all     52.15      0.00      8.66      2.88      0.00     36.31
09:49:58          all     53.91      0.00      8.37      1.85      0.00     35.87
09:50:08          all     50.98      0.00      8.76      2.66      0.00     37.60
09:50:18          all     53.24      0.00      8.42      1.91      0.00     36.43


c, cpu_count=8;%User为27%,基本保持在8个CPU数量,TPMC 10万左右
09:57:38          CPU     %user     %nice   %system   %iowait    %steal     %idle
09:57:48          all     27.96      0.00      4.99      3.01      0.00     64.03
09:57:58          all     27.82      0.00      4.47      2.49      0.00     65.21
09:58:08          all     27.97      0.00      4.54      2.31      0.00     65.18

09:58:18          all     27.90      0.00      4.50      2.25      0.00     65.34

d,查看动态视图avg_running_sessions和cpu_count基本一致,说明已经达到最大限度了

SQL> select to_char(begin_time, 'HH24:MI') time, sum(avg_running_sessions) avg_running_sessions, sum(avg_waiting_sessions) avg_waiting_sessions from v$rsrcmgrmetric_history group by begin_time order by begin_time;

09:44           18.4489333           .017666667
09:45           14.9326833           34.1877333
09:46           14.5135167           44.6346167
09:47           13.7069167           41.3688333
09:48           14.3363833           43.9001667
09:49              14.3411               43.345
09:50           14.2703333              43.2445
09:51           8.04406667           58.9471667
09:52              1.86445           15.7961833
09:53               7.1256           62.3546667
09:54              7.32335             64.64055
09:55              7.30835              64.3774
09:56               7.2753           64.0636333
09:57           7.35958333              65.0054
09:58           7.23883333           64.4193333
09:59           7.06161667           62.3264833
10:00               7.3477           66.1179333
10:01               7.3673              66.7519
10:02           5.44061667           48.0556167
10:03           .009183333                    0
10:04           .006833333                    0
10:05               .00545                    0
10:06                .0062                    0
10:07               1.5357           12.9266833
10:08           7.35653333           65.4692333
10:09           7.36343333           65.6357833
10:10               7.1894             63.24075


参考文档

Configuring and Monitoring Instance Caging [ID 1362445.1]
Http://www.oracle.com/technetwork/database/perfORMance/instance-caging-wp-166854.pdf
http://www.dbi-services.com/index.PHP/blog/entry/oracle-11g-instance-caging-limit-database-cpu-consumption




This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.1 to 11.2.0.4 [Release 11.2]
Information in this document applies to any platform.
*** Checked for relevance on 05-Apr-2016 ***

PURPOSE

This document provides a step-by-step guide for configuring Instance Caging. Instance Caging is an RDBMS feature for limiting the CPU usage of a database instance. Instance Caging is a valuable tool for database consolidation.

DETAILS

Determine Number of CPUs 

The first step is to determine the number of CPUs on your server, using the following query. In this context, we need the number of CPU threads (not the number of cores).

select value from v$osstat where stat_name = 'NUM_CPUS';


Determine "cpu_count" for All Instances 

The next step is to determine how the database instances on your server will share the CPU.  With Instance Caging, each instance's cpu_count specifies the maximum number of CPUs you want it to use at any time. The sum of the cpu_counts across all database instances determines the amount of isolation between the database instances and the efficiency of the server. 

For maximum isolation between the database instances, use the "partition" approach. With the partition approach, the sum of the cpu_counts is less than or equal to the number of CPUs, as determined in step 1. With hyper-threaded or CMT processors, you can achieve even more resource isolation if the sum of the cpu_counts is less than or equal to 75% of the number of CPUs. The partition approach is suitable for critical production databases that need very predictable performance.

For example, suppose the total number of CPUs (i.e. CPU threads) is 16.  Using the partition approach, we could set cpu_count=8 for database A, cpu_count=4 for database B, and cpu_count=4 for database C.  The sum of the cpu_counts is 16, which equals the number of CPUs. 

The disadvantage of the partition approach is that any CPU unused by one database instance cannot be used by another. Therefore, for non-critical databases where you also want to achieve better CPU utilization efficiency, use the "over-subscribe" approach. With the over-subscribe approach, the sum of the cpu_counts is less than or equal to 3x the number of CPUs, as determined in step 1.

For example, for a server with 16 CPUs, you could use the over-subscribe approach and set cpu_count=8 for database A, cpu_count=8 for database B, and cpu_count=8 for database C.  The sum of the cpu_counts is 24, which is greater than the number of CPUs.  Therefore, if all databases are using their full CPU allocation, there will be some CPU contention.

Enable Instance Caging 

To enable Instance Caging, set the cpu_count of each instance and then enable CPU Resource Manager.

alter system set cpu_count = 4; 
alter system set resource_manager_plan = 'default_plan';


Monitor Instance Caging 

To verify that Instance Caging is enabled, check that "instance_caging" equals "ON" and that "cpu_count" is set appropriately.

select instance_caging from v$rsrc_plan where is_top_plan = 'TRUE'; 
show parameter cpu_count;


To monitor Instance Caging on an instance, monitor the average number of running and waiting sessions.

select to_char(begin_time, 'HH24:MI') time, sum(avg_running_sessions) avg_running_sessions, sum(avg_waiting_sessions) avg_waiting_sessions from v$rsrcmgrmetric_history group by begin_time order by begin_time;

"avg_running_sessions" is the average number of running sessions for this minute. If avg_running_sessions is much smaller than cpu_count, the instance is not fully utilizing its cpu_count allocation. cpu_count could be decreased without affecting performance. 

"avg_waiting_sessions" is the average number of sessions waiting to be scheduled for this minute. If avg_waiting_sessions is consistently bigger than 0, the performance of the instance could be improved by increasing cpu_count by this amount.

Tuning Instance Caging

You can dynamically tune Instance Caging by adjusting the value of cpu_count.  Changes will take effect within seconds. 

We do not recommend that you change cpu_count too frequently, since changing its value has some overhead.  We also don't recommend that you set it to 1 or change the value from a very small number to an extremely large value.   

REFERENCES

NOTE:1340172.1 - Recommended Patches for Instance Caging
NOTE:1484302.1 - Master Note: Overview of Oracle Resource Manager and DBMS_RESOURCE_MANAGER
NOTE:1339769.1 - Master Note for Oracle Database Resource Manager

“Oracle实例囚笼分析”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!

您可能感兴趣的文档:

--结束END--

本文标题: Oracle实例囚笼分析

本文链接: https://www.lsjlt.com/news/69552.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Oracle实例囚笼分析
    本篇内容介绍了“Oracle实例囚笼分析”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!Oracle实例囚笼...
    99+
    2022-10-19
  • Oracle表分区实例分析
    这篇文章主要介绍了Oracle表分区实例分析的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Oracle表分区实例分析文章都会有所收获,下面我们一起来看看吧。一、 表空间及分区表的概念表空间:是一个或多个数据文件...
    99+
    2023-06-30
  • Oracle事务实例分析
    这篇文章主要介绍“Oracle事务实例分析”,在日常操作中,相信很多人在Oracle事务实例分析问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Oracle事务实例分析”的疑惑有所帮助!接下来,请跟着小编一起来...
    99+
    2023-06-30
  • Oracle连接问题实例分析
    今天小编给大家分享一下Oracle连接问题实例分析的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一...
    99+
    2022-10-19
  • oracle 11.2.0.4单实例打补丁的示例分析
    这篇文章主要介绍oracle 11.2.0.4单实例打补丁的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完! 0、如何获取oracle 11g安装...
    99+
    2022-10-19
  • Oracle FGA的示例分析
    小编给大家分享一下Oracle FGA的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!Oracle FGA(Fine-G...
    99+
    2022-10-19
  • oracle update操作的优化实例分析
    本篇内容主要讲解“oracle update操作的优化实例分析”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“oracle update操作的优化实例分...
    99+
    2022-10-19
  • Oracle常见分析函数实例详解
    目录1. 认识分析函数1.1 什么是分析函数1.2 分析函数和聚合函数的不同1.3 分析函数的形式2. 理解over()函数2.1 两个order by 的执行机制2.2 分析函数中的分组、排序、窗口2.3 帮助理解ov...
    99+
    2023-04-25
    oracle分析函数用法 oracle的分析函数 oracle分析函数有哪些
  • Oracle Library Cache的示例分析
    这篇文章主要为大家展示了“Oracle Library Cache的示例分析”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Oracle Library Cach...
    99+
    2022-10-19
  • Oracle sharding database的示例分析
    这篇文章主要为大家展示了“Oracle sharding database的示例分析”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Oracle sharding...
    99+
    2022-10-19
  • Oracle分页查询的示例分析
    这篇文章主要介绍Oracle分页查询的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!Oracle分页查询的实例详解1.Oracle分页查询:SELECT *...
    99+
    2022-10-18
  • oracle goldengate维护的示例分析
    这篇文章给大家分享的是有关oracle goldengate维护的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。1.配置源端具有pump、目标端具有trail的ogg环境...
    99+
    2022-10-19
  • Oracle逻辑读的示例分析
    这篇文章给大家分享的是有关Oracle逻辑读的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。1.物理读(physical read)当数据块第一次读取到,就会缓存到buf...
    99+
    2022-10-19
  • Oracle优化器的示例分析
    这篇文章主要介绍Oracle优化器的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!一、优化器的模式      优化器的模式用...
    99+
    2022-10-19
  • MySQL和Oracle的元数据抽取实例分析
    目录前言什么是元数据参考文档地址先说MySQL再说Oracle总结前言 最近接到个任务是抽取mysql和Oracle的元数据,大致就是在库里把库、schema、表、字段、分区、索引、...
    99+
    2022-11-12
  • jQuery.ajaxPrefilter实例分析
    这篇文章主要讲解了“jQuery.ajaxPrefilter实例分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“jQuery.ajaxPrefilter实...
    99+
    2022-10-19
  • jQuery.getScript实例分析
    这篇文章主要讲解了“jQuery.getScript实例分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“jQuery.getScript实例分析”吧! ...
    99+
    2022-10-19
  • callbacks.disabled实例分析
    这篇文章主要介绍“callbacks.disabled实例分析”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“callbacks.disabled实例分析”文章能帮助...
    99+
    2022-10-19
  • HttpContext.Current实例分析
    本篇内容主要讲解“HttpContext.Current实例分析”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“HttpContext.Current实例分析”吧!无处不在的HttpContext...
    99+
    2023-06-17
  • ADO实例分析
    本篇内容介绍了“ADO实例分析”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!定义和用法Close 方法用于关闭 Connection 对象、...
    99+
    2023-06-17
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作