问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

oracle 4031会导致cpu100%吗

发布网友 发布时间:2022-04-08 10:11

我来回答

2个回答

懂视网 时间:2022-04-08 14:33

v$sga_target_advice:该视图可用于建议SGA大小设置是否合理。
   SELECT a.sga_size,--sga期望大小
          a.sga_size_factor,--期望sga大小与实际sga大小的百分比
          a.estd_db_time,--sga设置为期望的大小后,其dbtime消耗期望的变化
          a.estd_db_time_factor,--修改sga为期望大小后,dbtime消耗的变化与修改前的变化百分比
          a.estd_physical_reads--修改前后物理读的差值
     FROM v$sga_target_advice a;

其中:

1、SGA_SIZE_FACTOR为1代表的是当前实际sga大小

2、关注a.estd_physical_reads字段,假如前台数值差距不大,那么这个时候sga的效率是最高的

oracle中v$sga_target_advice的用途

标签:

热心网友 时间:2022-04-08 11:41

ORA-4031错误

1. ORA-4031错误的原因,一般是大量的hard parse导致了shared pool中的free list中产生大量的内存小碎片,当一个需要很大内存来进行hard parse的sql语句到来时,无法从free list中找到内存,即使进行内存的释放,还是不能找到符合的内存块。从而报ORA-4031错误。

2. ORA-4031错误的解决方法:
1)alter system flush shared_pool;将shared pool中的所有内存清空。该方法治标不治本。
2)共享SQL语句:规范SQL语句的书写;使用绑定变量;找到没有使用绑定变量的SQL:
select sql_fulltext from v$sql where executions=1 order by sql_text;
如果在结果中发现一系列仅仅字面值不同的SQL,则可以修改cursor_sharing参数:
alter system set cursor_sharing = 'force'; 来强制使用绑定变量。
3)使用shared pool中的保留区:
select request_misses from v$shared_pool_reserved;
如果结果大于0,则可以调大shared_pool_reserved的大小;
SQL> show parameter shared_pool
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
shared_pool_reserved_size big integer 4M
shared_pool_size big integer 0

alter system set shared_pool_reserved=xxM scope=both;

4)使用dbms_shared_pool.keep('对象名')将使用内存很大的对象keep在内存中:
先要执行:@?/rdbms/admin/dbmspool.sql
SQL> @?/rdbms/admin/dbmspool.sql
Package created.
Grant succeeded.
View created.
Package body created.

再查出需要keep的对象:
SQL> select owner,name,namespace,type,sharable_mem from v$db_object_cache where sharable_mem>10000
2 and (type='PACKAGE' or type='PACKAGE BODY' or type='FUNCTION' or type='PROCEDURE') and kept='NO';

OWNER NAME NAMESPACE TYPE SHARABLE_MEM
---------- ------------------------- ------------------ --------------- ------------
SYS DBMS_BACKUP_RESTORE TABLE/PROCEDURE PACKAGE 33215
SYSMAN EMD_COLLECTION BODY PACKAGE BODY 33233
SYS DBMS_SHARED_POOL BODY PACKAGE BODY 12644
SYS SYS$RAWTOANY TABLE/PROCEDURE FUNCTION 12640
SYSMAN EMD_MAINTENANCE TABLE/PROCEDURE PACKAGE 29030
SYSMAN EMD_MAINTENANCE BODY PACKAGE BODY 62930
SYSMAN MGMT_JOB_ENGINE BODY PACKAGE BODY 218914
SYSMAN EM_PING BODY PACKAGE BODY 29086
SYS DBMS_BACKUP_RESTORE BODY PACKAGE BODY 95519
SYSMAN EMD_LOADER TABLE/PROCEDURE PACKAGE 12641
SYSMAN EMD_LOADER BODY PACKAGE BODY 71861
SYS PRVT_HDM BODY PACKAGE BODY 43624
SYSMAN MGMT_JOB_ENGINE TABLE/PROCEDURE PACKAGE 24938
SYS STANDARD BODY PACKAGE BODY 24960
SYSMAN EM_SEVERITY_REPOS BODY PACKAGE BODY 33236
SYS PRVT_ADVISOR TABLE/PROCEDURE PACKAGE 12640
SYSMAN MGMT_GLOBAL TABLE/PROCEDURE PACKAGE 29902
SYS DBMS_STANDARD TABLE/PROCEDURE PACKAGE 24929
SYS DBMS_ADVISOR BODY PACKAGE BODY 25000
SYS PRVT_HDM TABLE/PROCEDURE PACKAGE 16732
SYS PRVT_ADVISOR BODY PACKAGE BODY 66780
SYS DBMS_RCVMAN TABLE/PROCEDURE PACKAGE 43295
SYS STANDARD TABLE/PROCEDURE PACKAGE 438648
SYS DBMS_RCVMAN BODY PACKAGE BODY 375759

24 rows selected.

5)增加shared_pool_size的大小:
SQL> select component,current_size from v$sga_dynamic_components;

COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
shared pool 75497472
large pool 4194304
java pool 4194304
streams pool 0
DEFAULT buffer cache 130023424
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
DEFAULT 32K buffer cache 0
ASM Buffer Cache 0

13 rows selected.

sga_max_size:SGA允许的最大值,修改必须重启;
sga_target:必须小于sga_max_size, 表示当前SGA的最大值;
alter system set shared_pool_size=xxM scope=both;

3. 使用V$SHARED_POOL_ADVICE来设置shared pool的大小
V$SHARED_POOL_ADVICE displays information about estimated parse time in the shared pool for different pool sizes. The sizes range from 10% of the current shared pool size or the amount of pinned library cache memory (whichever is higher) to 200% of the current shared pool size, in equal intervals. The value of the interval depends on the current size of the shared pool.

Column
Datatype
Description

SHARED_POOL_SIZE_FOR_ESTIMATE NUMBER Shared pool size for the estimate (in megabytes)
SHARED_POOL_SIZE_FACTOR NUMBER Size factor with respect to the current shared pool size
ESTD_LC_SIZE NUMBER Estimated memory in use by the library cache (in megabytes)
ESTD_LC_MEMORY_OBJECTS NUMBER Estimated number of library cache memory objects in the shared pool of the specified size
ESTD_LC_TIME_SAVED NUMBER Estimated elapsed parse time saved (in seconds), owing to library cache memory objects being found in a shared pool of the specified size. This is the time that would have been spent in reloading the required objects in the shared pool had they been aged out e to insufficient amount of available free memory.
ESTD_LC_TIME_SAVED_FACTOR NUMBER Estimated parse time saved factor with respect to the current shared pool size
ESTD_LC_LOAD_TIME NUMBER Estimated elapsed time (in seconds) for parsing in a shared pool of the specified size
ESTD_LC_LOAD_TIME_FACTOR NUMBER Estimated load time factor with respect to the current shared pool size
ESTD_LC_MEMORY_OBJECT_HITS NUMBER Estimated number of times a library cache memory object was found in a shared pool of the specified size

可以使用下面的SQL语句来预估shared pool的大小:

select 'Shared Pool' component,shared_pool_size_for_estimate estd_sp_size,estd_lc_time_saved_factor parse_time_factor,case when current_parse_time_elapsed_s + adjustment_s<0
then 0 else current_parse_time_elapsed_s + adjustment_s end response_time
from (
select shared_pool_size_for_estimate,shared_pool_size_factor,estd_lc_time_saved_factor,a.estd_lc_time_saved,e.value/100
current_parse_time_elapsed_s,c.estd_lc_time_saved - a.estd_lc_time_saved adjustment_s from v$shared_pool_advice a,
(select * from v$sysstat where name='parse time elapsed') e,
(select estd_lc_time_saved from v$shared_pool_advice where shared_pool_size_factor=1) c
);
COMPONENT ESTD_SP_SIZE PARSE_TIME_FACTOR RESPONSE_TIME
-------------- ----------------- ------------------------- -------------
Shared Pool 64 .9989 294.37
Shared Pool 72 1 257.37
Shared Pool 80 1.0009 226.37
Shared Pool 88 1.0016 201.37
Shared Pool 96 1.0022 181.37
Shared Pool 104 1.0027 166.37
Shared Pool 112 1.0029 156.37
Shared Pool 120 1.0032 149.37
Shared Pool 128 1.0033 144.37
Shared Pool 136 1.0034 141.37
Shared Pool 144 1.0034 139.37

11 rows selected.
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
网络宣传文案心碎,句句获赞! 关于朋友圈上万人点赞转发的说说 人生看的很透彻的经典句子 超现实超扎心的说说大全2019最新 心脏血管堵塞吃什么食物 投资理财有什么前景 pp理财什么情况 P2P理财行业的前景如何? 中国目前的财富管理现状是什么情况? 呼吸皮沙发寿命多久 “皮沙发的呼吸寿命” 呼吸皮沙发寿命多久 《汤姆索亚历险记》读后感 5篇 为啥江苏海洋大学百度还没有更新2020年的? 汤姆索亚历险记读后感六百字。 汤姆索亚历险记读后感500字以上 汤姆索亚历险记读后感结尾100字 《汤姆索亚历险记》读后感450——500字左右,小学6年级的水平,要结合生活实际 急需《汤姆索亚历险记》读后感 汤姆索亚历险记读后感 汤姆索亚历险记的读后感 《汤姆索亚历险记》读后感 《汤姆索亚历险记》读后感? 汤姆索亚历险记读后感结尾 汤姆索亚历险记的读后感的结尾怎么写 作文:告别2010年,迎接2011年 求青春校园电视剧 推荐一点偶像剧 帮我推荐几部偶像剧 我的人生日复一日年复一年却从未改变改变的是那种多了皱纹的脸是什么歌名? 2012年7月18日7点20分生的男孩,廖子琪和廖子琦用哪个名字更好 背上行囊离开家乡,独自一人闯他乡是哪首歌的歌词? 《汤姆索亚历险记》读后感 不少于600字 高中同学离开了之后,以后还会搞同学聚会不,有多少人会来呢? 《汤姆索亚历险记》1.摘抄5个特别的开头,5个特别的结尾,分别说说有什么特别? 为啥同学会连你看她朋友圈的权限都设置了?就是不给你看她朋友圈,为啥会这样? 校友会排名为啥没有医学? 湖北中医药大学怎么样?好不好? 艾瑞深中国校友会网大学排名权威吗 中国大学百度百科里面为什么会有QS排名呢? 四川传媒学院是什么本,二本还是三本,怎么官网和百度百科都没写? 大学同学会,考上公务员的同学年年都有理由不来,这是为啥? 为什么我注册QQ校友会这样? 知道贴吧发帖怎么才能让百度快速收录,有什么技巧吗?请告诉一下? 山东农业大学怎么样呀 我看校友会排名挺高为什么知名度那么低呢? 有舞蹈民族民间教师资格证可以带中国舞考级吗 百度贴吧的贴子如何快速被百度收录? 如何让在百度贴吧发的贴子被百度收录? 贴吧 帖子怎么才能被百度收录 贴吧发帖怎么才能让百度快速收录,有什么技巧吗? 什么样的帖子容易被百度收录并能排在百度第一页?请高手指点 中国舞教师资格证考试条件