[20190507]sga_target=0注意修改_kghdsidx_count设置.txt

--//昨天遇到一例视图定义太复杂导致长时间分析sql语句出现library cache lock等待事件的情况.
--//加上大量使用非绑定变量语句,导致硬解析增加,导致问题更加严重.

--//顺便解析当时同事发现仅仅1个CPU特别忙.实际上因为仅仅1个shared pool latch在工作.

1.环境:
> @ ver1
PORT_STRING        VERSION        BANNER
------------------ -------------- ----------------------------------------------------------------
IBMPC/WIN_NT-8.1.0 10.2.0.3.0     Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
--//注32位版本.

2.解析:

SELECT addr
        ,latch#
        ,child#
        ,level#
        ,name
        ,gets
        ,sleeps
        ,immediate_gets
        ,immediate_misses
        ,spin_gets
    FROM V$LATCH_CHILDREN
   WHERE name LIKE 'shared pool'
ORDER BY addr;

ADDR         LATCH#     CHILD#     LEVEL# NAME              GETS     SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES  SPIN_GETS
-------- ---------- ---------- ---------- ----------- ---------- ---------- -------------- ---------------- ----------
05AA3858        213          1          7 shared pool   25235287        182              0                0       7384
05AA38C0        213          2          7 shared pool        151          0              0                0          0
05AA3928        213          3          7 shared pool        151          0              0                0          0
05AA3990        213          4          7 shared pool        151          0              0                0          0
05AA39F8        213          5          7 shared pool        151          0              0                0          0
05AA3A60        213          6          7 shared pool        151          0              0                0          0
05AA3AC8        213          7          7 shared pool        151          0              0                0          0
7 rows selected.
--//仅仅1个shared pool latch在使用.

> show parameter sga_
NAME          TYPE        VALUE
------------- ----------- ------
sga_max_size  big integer 1200M
sga_target    big integer 1200M

> @ hide _kghdsidx_count
NAME            DESCRIPTION        DEFAULT_VALUE          SESSION_VALUE          SYSTEM_VALUE
--------------- ------------------ ---------------------- ---------------------- ----------------------
_kghdsidx_count max kghdsidx count TRUE                   1                      1

> @ hide _enable_shared_pool_durations
NAME                          DESCRIPTION                            DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
----------------------------- -------------------------------------- ------------- ------------- ------------
_enable_shared_pool_durations temporary to disable/enable kgh policy TRUE          TRUE          TRUE

> show parameter cpu_count
NAME      TYPE    VALUE
--------- ------- ------
cpu_count integer 16
--//注:在任务管理器看到32个CPU.不过我发现图中下面一排16个cpu好像没有负载.

--//主要问题是参数_kghdsidx_count=1.仅仅1个subpool.看来这个版本按照每个子缓冲池至少为512MB设计的.
--//参数_kghdsidx_count大小由CPU数量以及共享池大小决定的.最大不过7个.
--//我仅仅知道的原则:
--//共享子缓冲池的分配的算法很简单:
--//·每个子缓冲池必须满足一定的内存约束;
--//·每4颗CPU可以分配一个子缓冲池,最多7个。

--//本来oracle这样做为了减少shared pool,但是带来另外的问题,如果每个子池太小,反而出现ora-04031错误.于是oracle限制每个子池
--//的大小,你可以发现一些blog提到减少参数_kghdsidx_count大小,限制每个子池避免出现子池太小的情况.

--//在Oracle 9i中,每个SubPool至少128MB,在Oracle 10g中,每个子缓冲池至少为256MB,在Oracle 11g中,每个子缓冲池至少为512MB.
--//Oracle 10g会将单个缓冲池分割再细分4个子分区进行管理(这可能是因为通常4颗CPU才分配一个SubPool),
--//分别是"instance", "session", "cursor", and "execution".

--//对方安装32位系统,不能设置很大sga,受限共享内存大小600M上下,这样仅仅1个shared pool latch.
--//这样在大量硬解析的情况下,特别在分析sql语句很长时间的情况下仅仅1个shared pool latch自然很忙.
--//也就是同事看到的情况,仅仅1个CPU在忙...而且sql语句中的视图关联的表太多,导致1条sql语句消耗共享池很大,我执行前面的语句,查看
--//v$sqlarea的SHARABLE_MEM达到512K.这样大量非绑定变量语句导致许多对象退出又再进入共享池.

--//这就好比一个宾馆的前台仅仅1名接待人员一样,客户入住登记少没有问题,一旦大量客户登记入住,1个人自然忙不过来,
--//而其他人根本插不上手.有时候非常像现实工作的场景,1个忙的要死,别人根本插不上手,只能在那干等^_^.

3.突然想起我以前1个测试:
--//[20190104]sga_target 的设置和ORA-04031错误.txt => http://blog.itpub.net/267265/viewspace-2305567/
--//发现一个问题,就是设置sga_target=0,如果大量语句不使用绑定变量可能存在问题.参数_kghdsidx_count=1,仅仅1个shared pool latch.
--//这样情况应该适当增加_kghdsidx_count,通过测试说明问题:

$ export ORACLE_SID=xxxx
$ cat initxxxx.ora
db_name=xxxx
instance_name=xxxx
sga_target=0
sga_max_size=20G
--//设置sga_target=0.

SYS@xxxx> startup nomount
ORACLE instance started.
Total System Global Area 2.1379E+10 bytes
Fixed Size                  2262656 bytes
Variable Size            2.1206E+10 bytes
Database Buffers          134217728 bytes
Redo Buffers               36073472 bytes

SELECT addr
        ,latch#
        ,child#
        ,level#
        ,name
        ,gets
        ,sleeps
        ,immediate_gets
        ,immediate_misses
        ,spin_gets
    FROM V$LATCH_CHILDREN
   WHERE name LIKE 'shared pool'
ORDER BY addr;

ADDR                 LATCH#     CHILD#     LEVEL# NAME        GETS     SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES  SPIN_GETS
---------------- ---------- ---------- ---------- ----------- ---- ---------- -------------- ---------------- ----------
000000006010F288        336          1          7 shared pool 1397          0              0                0          5
000000006010F328        336          2          7 shared pool    0          0              0                0          0
000000006010F3C8        336          3          7 shared pool    0          0              0                0          0
000000006010F468        336          4          7 shared pool    0          0              0                0          0
000000006010F508        336          5          7 shared pool    0          0              0                0          0
000000006010F5A8        336          6          7 shared pool    0          0              0                0          0
000000006010F648        336          7          7 shared pool    0          0              0                0          0
7 rows selected.

SYS@xxxx> @ hide _kghdsidx_count
old  10:  and lower(a.ksppinm) like lower('%&1%')
new  10:  and lower(a.ksppinm) like lower('%_kghdsidx_count%')
NAME            DESCRIPTION        DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
--------------- ------------------ ------------- ------------- ------------
_kghdsidx_count max kghdsidx count TRUE          1             1

SYS@xxxx> @ hide _enable_shared_pool_durations
old  10:  and lower(a.ksppinm) like lower('%&1%')
new  10:  and lower(a.ksppinm) like lower('%_enable_shared_pool_durations%')
NAME                          DESCRIPTION                            DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
----------------------------- -------------------------------------- ------------- ------------- ------------
_enable_shared_pool_durations temporary to disable/enable kgh policy TRUE          FALSE         FALSE

--//注意_enable_shared_pool_durations参数,在sga_target=0的情况下,_enable_shared_pool_durations的缺省值等于FALSE(实际上设
--//置为true也无效,看后面测试)
--//也就是仅仅1个subpool,下面仅仅一个子子池.

SYS@xxxx> @ sgastatx.sql  'free memory'
-- All allocations:
SUBPOOL                             BYTES         MB
------------------------------ ---------- ----------
shared pool (0 - Unused):        67108864         64
shared pool (1):                268435456        256
shared pool (Total):            335544320        320

-- Allocations matching "free memory":
old  15:     AND LOWER(ksmssnam) LIKE LOWER('%&1%')
new  15:     AND LOWER(ksmssnam) LIKE LOWER('%free memory%')
SUBPOOL                        NAME                 SUM(BYTES)         MB
------------------------------ -------------------- ---------- ----------
shared pool (0 - Unused):      free memory            67108864         64
shared pool (1):               free memory            30813880      29.39

--//仅仅1个子池.共享内存不足的情况下会从shared pool (0 - Unused)分过来.

--//另外注意1个问题,有一些文章提示查询x$kghlu可以查询这些子缓冲池的分配,我的测试不行,当然我现在sga_target=0的情况下不存
--//在子子池的情况.
--//通过一个内部表X$KGHLU([K]ernel [G]eneric memory [H]eap manager State of [L]R[U] Of Unpinned Recreatable chunks)可以
--//查询这些子缓冲池的分配: (我的测试不行!!)

SYS@xxxx> select * from x$kghlu;
ADDR                   INDX    INST_ID   KGHLUIDX   KGHLUDUR KGHLUSHRPOOL   KGHLUFSH   KGHLUOPS   KGHLURCR   KGHLUTRN   KGHLUMXA   KGHLUMES   KGHLUMER   KGHLURCN   KGHLURMI   KGHLURMZ   KGHLURMX   KGHLUNFU   KGHLUNFS
---------------- ---------- ---------- ---------- ---------- ------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00007F6D32E5EFF0          0          1          1          0            1          0         64          3         43 2147483647          0          0          0          0          0          0          0          0

--//只能通过heapdump转储获取这方面信息.
SYS@xxxx> alter session set events 'immediate trace name heapdump level 2';
Session altered.

$ grep 'sga heap' /u01/app/oracle/diag/rdbms/xxxx/xxxx/trace/xxxx_ora_43866.trc
HEAP DUMP heap name="sga heap"  desc=0x60001190
HEAP DUMP heap name="sga heap(1,0)"  desc=0x6005c318

--//可以看出问题.仅仅1个子池,不细分子子池.也就是在sga_target=0的情况下,可能需要手工设置_kghdsidx_count的大小.
--//不然可能出现shared pool latch的争用,特别在应用没有绑定变量的情况下.

--//我个人建议sga_target=0的情况下手工设置shared_pool_size,db_cache_size.
--//或者sga_target<>0的情况下,也设置shared_pool_size,db_cache_size作为最小值,避免内存在这些组件中变换.

--//修改*._kghdsidx_count=3
$ cat initxxxx.ora
db_name=xxxx
instance_name=xxxx
#sga_target=20G
sga_target=0
sga_max_size=20G
#pre_page_sga=true
*._kghdsidx_count=3

SYS@xxxx> startup nomount
ORA-04031: unable to allocate 320032 bytes of shared memory ("shared pool","unknown object","KGSK scheduler","KGSK chg class latches")
--//shared_pool_size太小.仅仅320M.

--//测试增加*._kghdsidx_count=3,*.shared_pool_size=1600M,*._enable_shared_pool_durations=true的情况:
$ cat initxxxx.ora
db_name=xxxx
instance_name=xxxx
sga_target=0G
#sga_target=20G
sga_max_size=20G
#pre_page_sga=true
*._kghdsidx_count=3
*.shared_pool_size=1600M
*._enable_shared_pool_durations=true
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SYS@xxxx> startup nomount
ORACLE instance started.

Total System Global Area 2.1379E+10 bytes
Fixed Size                  2262656 bytes
Variable Size            2.1206E+10 bytes
Database Buffers          134217728 bytes
Redo Buffers               36073472 by

SYS@xxxx> @ hide _kghdsidx_count
old  10:  and lower(a.ksppinm) like lower('%&1%')
new  10:  and lower(a.ksppinm) like lower('%_kghdsidx_count%')
NAME            DESCRIPTION        DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
--------------- ------------------ ------------- ------------- ------------
_kghdsidx_count max kghdsidx count FALSE         3             3

SYS@xxxx> @ hide _enable_shared_pool_durations
old  10:  and lower(a.ksppinm) like lower('%&1%')
new  10:  and lower(a.ksppinm) like lower('%_enable_shared_pool_durations%')
NAME                                     DESCRIPTION                            DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
---------------------------------------- -------------------------------------- ------------- ------------- ------------
_enable_shared_pool_durations            temporary to disable/enable kgh policy FALSE         TRUE          TRUE

SYS@xxxx> select * from x$kghlu;
ADDR                   INDX    INST_ID   KGHLUIDX   KGHLUDUR KGHLUSHRPOOL   KGHLUFSH   KGHLUOPS   KGHLURCR   KGHLUTRN   KGHLUMXA   KGHLUMES   KGHLUMER   KGHLURCN   KGHLURMI   KGHLURMZ   KGHLURMX   KGHLUNFU   KGHLUNFS
---------------- ---------- ---------- ---------- ---------- ------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00007FC432A52F70          0          1          3          0            1          0         20          0         14 2147483647          0          0          0          0          0          0          0          0
00007FC432A54640          1          1          2          0            1          0          9          0          7 2147483647          0          0          0          0          0          0          0          0
00007FC432A53FF0          2          1          1          0            1          0         14          0         10 2147483647          0          0          0          0          0          0          0          0
--//仅仅3个子池.看不出子子池.

SYS@xxxx> alter session set events 'immediate trace name heapdump level 2';
Session altered.

$ grep 'sga heap' /u01/app/oracle/diag/rdbms/xxxx/xxxx/trace/xxxx_ora_43949.trc
HEAP DUMP heap name="sga heap"  desc=0x60001190
HEAP DUMP heap name="sga heap(1,0)"  desc=0x6005c318
HEAP DUMP heap name="sga heap(2,0)"  desc=0x60065be0
HEAP DUMP heap name="sga heap(3,0)"  desc=0x6006f4a8
--//可以发现设置即使_enable_shared_pool_durations=TRUE,在sga_target=0G的情况下也不会出现子子池的情况.

SYS@xxxx> @ sgastatx.sql  'free memory'

-- All allocations:
SUBPOOL                             BYTES         MB
------------------------------ ---------- ----------
shared pool (0 - Unused):      1275068416       1216
shared pool (1):                134217728        128
shared pool (2):                134217728        128
shared pool (3):                134217728        128
shared pool (Total):           1677721600       1600

-- Allocations matching "free memory":
old  15:     AND LOWER(ksmssnam) LIKE LOWER('%&1%')
new  15:     AND LOWER(ksmssnam) LIKE LOWER('%free memory%')
SUBPOOL                        NAME                                     SUM(BYTES)         MB
------------------------------ ---------------------------------------- ---------- ----------
shared pool (0 - Unused):      free memory                              1275068416       1216
shared pool (1):               free memory                                48797608      46.54
shared pool (2):               free memory                                34835672      33.22
shared pool (3):               free memory                                48306064      46.07

SELECT addr
        ,latch#
        ,child#
        ,level#
        ,name
        ,gets
        ,sleeps
        ,immediate_gets
        ,immediate_misses
        ,spin_gets
    FROM V$LATCH_CHILDREN
   WHERE name LIKE 'shared pool'
ORDER BY addr;

ADDR                 LATCH#     CHILD#     LEVEL# NAME        GETS     SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES  SPIN_GETS
---------------- ---------- ---------- ---------- ----------- ---- ---------- -------------- ---------------- ----------
000000006010F288        336          1          7 shared pool  732          0              1                0          0
000000006010F328        336          2          7 shared pool  673          0              1                0          0
000000006010F3C8        336          3          7 shared pool  903          0              1                0          1
000000006010F468        336          4          7 shared pool    1          0              0                0          0
000000006010F508        336          5          7 shared pool    1          0              0                0          0
000000006010F5A8        336          6          7 shared pool    1          0              0                0          0
000000006010F648        336          7          7 shared pool    1          0              0                0          0
7 rows selected.

--//总之,如果手工管理内存,设置sga_target=0G的情况下,适当设置_kghdsidx_count,shared_pool_size,db_cache_size值.

4.最后测试sga_target<>0的情况:
$ grep -v "^#" initxxxx.ora
db_name=xxxx
instance_name=xxxx
sga_target=20G
sga_max_size=20G

SYS@xxxx> @ hide _kghdsidx_count
old  10:  and lower(a.ksppinm) like lower('%&1%')
new  10:  and lower(a.ksppinm) like lower('%_kghdsidx_count%')
NAME                                     DESCRIPTION                             DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
---------------------------------------- --------------------------------------- ------------- ------------- ------------
_kghdsidx_count                          max kghdsidx count                      TRUE          6             6

SYS@xxxx> @ hide _enable_shared_pool_durations
old  10:  and lower(a.ksppinm) like lower('%&1%')
new  10:  and lower(a.ksppinm) like lower('%_enable_shared_pool_durations%')
NAME                                     DESCRIPTION                             DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
---------------------------------------- --------------------------------------- ------------- ------------- ------------
_enable_shared_pool_durations            temporary to disable/enable kgh policy  TRUE          TRUE          TRUE

SYS@xxxx> @ sgastatx.sql  'free memory'
-- All allocations:
SUBPOOL                             BYTES         MB
------------------------------ ---------- ----------
shared pool (0 - Unused):       469762048        448
shared pool (1):                268435456        256
shared pool (2):                335544320        320
shared pool (3):                335544320        320
shared pool (4):                335544320        320
shared pool (5):                268435456        256
shared pool (6):                335544320        320
shared pool (Total):           2348810240       2240

8 rows selected.

-- Allocations matching "free memory":
old  15:     AND LOWER(ksmssnam) LIKE LOWER('%&1%')
new  15:     AND LOWER(ksmssnam) LIKE LOWER('%free memory%')
SUBPOOL                        NAME                 SUM(BYTES)         MB
------------------------------ -------------------- ---------- ----------
shared pool (0 - Unused):      free memory           469762048        448
shared pool (1):               free memory           207961376     198.33
shared pool (2):               free memory           224686568     214.28
shared pool (3):               free memory           270474992     257.95
shared pool (4):               free memory           234357448      223.5
shared pool (5):               free memory           206367112     196.81
shared pool (6):               free memory           239940912     228.83
7 rows selected.

SYS@xxxx> select * from x$kghlu;
                                              SUB       SSUB                 FLUSHED   LRU LIST  RECURRENT  TRANSIENT                                    RESERVED   RESERVED   RESERVED    RESERVED FREE UNPIN  LAST FRUNP
ADDR                   INDX    INST_ID       POOL       POOL KGHLUSHRPOOL     CHUNKS OPERATIONS     CHUNKS     CHUNKS   KGHLUMXA   KGHLUMES   KGHLUMER      SCANS     MISSES  MISS SIZE MISS MAX SZ  UNSUCCESS UNSUCC SIZE
---------------- ---------- ---------- ---------- ---------- ------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ---------- -----------
00007F78519F2E48          0          1          6          0            1          0         17          0         17 2147483647          0          0          0          0          0           0          0           0
00007F78519F27F8          1          1          5          0            1          0         27          0         17 2147483647          0          0          0          0          0           0          0           0
00007F78519F3E60          2          1          4          0            1          0         23          0         19 2147483647          0          0          0          0          0           0          0           0
00007F78519F3810          3          1          3          0            1          0         40          0         16 2147483647          0          0          0          0          0           0          0           0
00007F78519F4EE0          4          1          2          0            1          0         34          0         22 2147483647          0          0          0          0          0           0          0           0
00007F78519F4890          5          1          1          0            1          0         26          0         16 2147483647          0          0          0          0          0           0          0           0
6 rows selected.
--// 看不出子子池的分配情况.

SYS@xxxx> alter session set events 'immediate trace name heapdump level 2';
Session altered.

$ egrep "sga heap|Total heap size" /u01/app/oracle/diag/rdbms/xxxx/xxxx/trace/xxxx_ora_44083.trc
HEAP DUMP heap name="sga heap"  desc=0x60001190
HEAP DUMP heap name="sga heap(1,0)"  desc=0x6005c318
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(1,1)"  desc=0x6005db70
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(1,2)"  desc=0x6005f3c8
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(1,3)"  desc=0x60060c20
Total heap size    = 67108776
--// 67108776*4/1024/1024 = 255.99966430664062500000 ,接近256M.
HEAP DUMP heap name="sga heap(2,0)"  desc=0x60065be0
Total heap size    =134217552
HEAP DUMP heap name="sga heap(2,1)"  desc=0x60067438
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(2,2)"  desc=0x60068c90
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(2,3)"  desc=0x6006a4e8
Total heap size    = 67108776
--//(134217552+67108776+67108776+67108776)/1024/1024 = 319.99958038330078125000,接近320M.
HEAP DUMP heap name="sga heap(3,0)"  desc=0x6006f4a8
Total heap size    =134217552
HEAP DUMP heap name="sga heap(3,1)"  desc=0x60070d00
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(3,2)"  desc=0x60072558
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(3,3)"  desc=0x60073db0
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(4,0)"  desc=0x60078d70
Total heap size    =134217552
HEAP DUMP heap name="sga heap(4,1)"  desc=0x6007a5c8
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(4,2)"  desc=0x6007be20
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(4,3)"  desc=0x6007d678
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(5,0)"  desc=0x60082638
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(5,1)"  desc=0x60083e90
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(5,2)"  desc=0x600856e8
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(5,3)"  desc=0x60086f40
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(6,0)"  desc=0x6008bf00
Total heap size    =134217552
HEAP DUMP heap name="sga heap(6,1)"  desc=0x6008d758
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(6,2)"  desc=0x6008efb0
Total heap size    = 67108776
HEAP DUMP heap name="sga heap(6,3)"  desc=0x60090808
Total heap size    = 67108776
--//这样可以看到每个子池有几个子子池,并且每个的大小.

总结:
--//总之注意,如果手工管理内存,设置sga_target=0G的情况下,适当设置_kghdsidx_count,shared_pool_size,db_cache_size值.避免
--//shared pool latch仅仅1个的情况.
--//我个性喜欢手工管理内存设置sga_target=sga_max_size,设置shared_pool_size,db_cache_size基本不会转换.

--//附上sgastatx.sql脚本.
$ cat sgastatx.sql
--------------------------------------------------------------------------------
--
-- File name:   sgastatx
-- Purpose:     Show shared pool stats by sub-pool from X$KSMSS
--
-- Author:      Tanel Poder
-- Copyright:   (c) http://www.tanelpoder.com
--
-- Usage:       @sgastatx <statistic name>
--              @sgastatx "free memory"
--              @sgastatx cursor
--
-- Other:       The other script for querying V$SGASTAT is called sgastat.sql
--
--
--
--------------------------------------------------------------------------------

COL sgastatx_subpool HEAD SUBPOOL FOR a30

PROMPT
PROMPT -- All allocations:

SELECT
    'shared pool ('||NVL(DECODE(TO_CHAR(ksmdsidx),'0','0 - Unused',ksmdsidx), 'Total')||'):'  sgastatx_subpool
  , SUM(ksmsslen) bytes
  , ROUND(SUM(ksmsslen)/1048576,2) MB
FROM
    x$ksmss
WHERE
    ksmsslen > 0
--AND ksmdsidx > 0
GROUP BY ROLLUP
   ( ksmdsidx )
ORDER BY
    sgastatx_subpool ASC
/

BREAK ON sgastatx_subpool SKIP 1
PROMPT -- Allocations matching "&1":

SELECT
    subpool sgastatx_subpool
  , name
  , SUM(bytes)
  , ROUND(SUM(bytes)/1048576,2) MB
FROM (
    SELECT
        'shared pool ('||DECODE(TO_CHAR(ksmdsidx),'0','0 - Unused',ksmdsidx)||'):'      subpool
      , ksmssnam      name
      , ksmsslen      bytes
    FROM
        x$ksmss
    WHERE
        ksmsslen > 0
    AND LOWER(ksmssnam) LIKE LOWER('%&1%')
)
GROUP BY
    subpool
  , name
ORDER BY
    subpool    ASC
  , SUM(bytes) DESC
/

BREAK ON sgastatx_subpool DUP

[20190507]sga_target=0注意修改_kghdsidx_count设置.txt的更多相关文章

  1. [20180604]在内存修改数据(bbed).txt

    [20180604]在内存修改数据(bbed).txt --//以前曾经做过在内存修改数据,通过oradebug poke命令修改内存信息,相关链接:--//http://blog.itpub.net ...

  2. [20171120]关于INBOUND_CONNECT_TIMEOUT设置.txt

    [20171120]关于INBOUND_CONNECT_TIMEOUT设置.txt --//上午翻看以前我的发的帖子,发现链接:http://www.itpub.net/thread-2066758- ...

  3. CI框架3.0关于session的设置改动及存数据库的使用方法

    Session的设置跟之前有点不一样 我们来看看2.0版本中的设置是什么样子的: $config['sess_cookie_name']= 'test_session'; $config['sess_ ...

  4. 【前端】webkit内核浏览器DIV滚动条样式修改和设置

    webkit内核浏览器DIV滚动条样式修改和设置 引言: 最近在做自己的小项目,为了设计出好看的页面费劲了心思,大到页面的整体布局,小到DIV的滚动条都不放过,以下是我通过查阅资料总结的webkit内 ...

  5. div背景透明内容不透明与0.5PX边框兼容设置

    1.问题:设置 border-width:0.5px;  并兼容安卓和苹果移动端.  兼容:苹果IOS的 safari 支持浮点数边框,安卓浏览器不支持,会四舍五入到1px.不同浏览器效果额不同  解 ...

  6. LoadRunner如何在脚本运行时修改log设置选项

    LoadRunner如何在脚本运行时修改log设置选项?答案是使用lr_set_debug_message函数: lr_set_debug_message Sets the message level ...

  7. springboot 修改和设置 banner

    springboot 修改和设置 banner 先上图 修改步骤 1.在src/main/resources下新建一个banner.txt文档 2.通过http://patorjk.com/softw ...

  8. linux sudo命令失败 提示sudo:/usr/bin/sudo 必须属于用户 ID 0(的用户)并且设置 setuid 位

    sudo:/usr/bin/sudo 必须属于用户 ID 0(的用户)并且设置 setuid 位 一.前言 这是一个神奇的错误,缘由是因为有人将/usr/bin/sudo的权限改为777或其他. 解决 ...

  9. 怎么修改与设置.jsp文件属性?

    1.首先  打开  >>  Myeclipse或Eclipse.(我用的是Myeclipse) 2.打开  >>  Window  >>  Preferences  ...

随机推荐

  1. 第十二章 WEB渗透

    Web技术发展 • 静态WEB• 动态WEB • 应用程序 • 数据库 • 每个人看到的内容不同 • 根据用户输入返回不同结果 WEB攻击面• Network• OS• WEB Server• App ...

  2. 第十七周博客作业 <西北师范大学| 周安伟>

    第十七周作业 助教博客链接https://home.cnblogs.com/u/zaw-315/ 作业要求链接https://www.cnblogs.com/nwnu-daizh/p/11012922 ...

  3. TeamyinyinFish-> 测试报告

    测试人员 1. 姓名:鱼嘤嘤 2. 年龄: 21 3. 职业: 大三学生 4. 感情状况: 单身 用户故事 软件工程课上,老师想要他们组实现一个小组项目,鱼嘤嘤原本想摸鱼,但是转念一想觉得 还是需要好 ...

  4. Jmeter怎么搭建环境

    1.JDK检查与安装 cmd输入命令:java -version   -- 检查主机是否安装了JDK JDK下载官网:https://www.oracle.com/technetwork/java/j ...

  5. 2019.6.13_MySQL简单命令的使用

    1.show databases; -- 显示当前连接下的数据库 2.use db_name;   -- 使用当前数据库db_name 3.show tables;      -- 显示当前数据库下数 ...

  6. 详解C++ STL priority_queue 容器

    详解C++ STL priority_queue 容器 本篇随笔简单介绍一下\(C++STL\)中\(priority_queue\)容器的使用方法和常见的使用技巧. priority_queue容器 ...

  7. QTP10启动错误:Error creatingUnable to create configuration directory "C:UsersmR?ã? directory entry

    安装完之后打开就一直: 百度也不知道为哈子(莫非是中文的用户名?反正我不想重装系统),真是很气人. 我就直接创建了一个临时账户,登陆进去,就可以运行了:

  8. luoguP2463 [SDOI2008]Sandy的卡片

    题意 显然加上一个数相等就是差分数组相等,于是问题变为求几个串的最长公共子串. 这里我学习了如何用SA求LCS. 首先问题要转化成求一些后缀的最长公共前缀,要求这些后缀分属不同的串. 于是二分答案,于 ...

  9. layui教程---table

    layui.config({ base: "${ctx}/static/js/" }).use(['form', 'layer', 'jquery', 'common','elem ...

  10. 合并K个有序数组-Java

    package com.rao.algorithm; import java.util.Arrays; /** * @author Srao * @className MergeK * @date 2 ...