Know more about shared pool subpool
有同学在T.askmaclean.com上求助Shared Pool里SubPool子分区问题,这里我们来搞清楚_kghdsidx_count 与 subpool 以及subpool中的分区( 实际是duration)的关系:
SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi PL/SQL Release 10.2.0.5.0 - Production CORE 10.2.0.5.0 Production TNS for Linux: Version 10.2.0.5.0 - Production NLSRTL Version 10.2.0.5.0 - Production SQL> set linesize 200 pagesize 1400 SQL> show parameter kgh NAME TYPE VALUE ------------------------------------ -------------------------------- ------------------------------ _kghdsidx_count integer 7 SQL> oradebug setmypid; Statement processed. SQL> oradebug dump heapdump 536870914; Statement processed. SQL> oradebug tracefile_name /s01/admin/G10R25/udump/g10r25_ora_11783.trc [oracle@vrh8 dbs]$ grep "sga heap" /s01/admin/G10R25/udump/g10r25_ora_11783.trc HEAP DUMP heap name="sga heap" desc=0x60000058 HEAP DUMP heap name="sga heap(1,0)" desc=0x60036110 FIVE LARGEST SUB HEAPS for heap name="sga heap(1,0)" desc=0x60036110 HEAP DUMP heap name="sga heap(2,0)" desc=0x6003f938 FIVE LARGEST SUB HEAPS for heap name="sga heap(2,0)" desc=0x6003f938 HEAP DUMP heap name="sga heap(3,0)" desc=0x60049160 FIVE LARGEST SUB HEAPS for heap name="sga heap(3,0)" desc=0x60049160 HEAP DUMP heap name="sga heap(4,0)" desc=0x60052988 FIVE LARGEST SUB HEAPS for heap name="sga heap(4,0)" desc=0x60052988 HEAP DUMP heap name="sga heap(5,0)" desc=0x6005c1b0 FIVE LARGEST SUB HEAPS for heap name="sga heap(5,0)" desc=0x6005c1b0 HEAP DUMP heap name="sga heap(6,0)" desc=0x600659d8 FIVE LARGEST SUB HEAPS for heap name="sga heap(6,0)" desc=0x600659d8 HEAP DUMP heap name="sga heap(7,0)" desc=0x6006f200 FIVE LARGEST SUB HEAPS for heap name="sga heap(7,0)" desc=0x6006f200 SQL> alter system set "_kghdsidx_count"=6 scope=spfile; System altered. SQL> startup force; ORACLE instance started. Total System Global Area 859832320 bytes Fixed Size 2100104 bytes Variable Size 746587256 bytes Database Buffers 104857600 bytes Redo Buffers 6287360 bytes Database mounted. Database opened. SQL> SQL> oradebug setmypid; Statement processed. SQL> oradebug dump heapdump 536870914; Statement processed. SQL> oradebug tracefile_name /s01/admin/G10R25/udump/g10r25_ora_11908.trc [oracle@vrh8 dbs]$ grep "sga heap" /s01/admin/G10R25/udump/g10r25_ora_11908.trc HEAP DUMP heap name="sga heap" desc=0x60000058 HEAP DUMP heap name="sga heap(1,0)" desc=0x600360f0 FIVE LARGEST SUB HEAPS for heap name="sga heap(1,0)" desc=0x600360f0 HEAP DUMP heap name="sga heap(2,0)" desc=0x6003f918 FIVE LARGEST SUB HEAPS for heap name="sga heap(2,0)" desc=0x6003f918 HEAP DUMP heap name="sga heap(3,0)" desc=0x60049140 FIVE LARGEST SUB HEAPS for heap name="sga heap(3,0)" desc=0x60049140 HEAP DUMP heap name="sga heap(4,0)" desc=0x60052968 FIVE LARGEST SUB HEAPS for heap name="sga heap(4,0)" desc=0x60052968 HEAP DUMP heap name="sga heap(5,0)" desc=0x6005c190 FIVE LARGEST SUB HEAPS for heap name="sga heap(5,0)" desc=0x6005c190 HEAP DUMP heap name="sga heap(6,0)" desc=0x600659b8 FIVE LARGEST SUB HEAPS for heap name="sga heap(6,0)" desc=0x600659b8 SQL> SQL> alter system set "_kghdsidx_count"=2 scope=spfile; System altered. SQL> SQL> startup force; ORACLE instance started. Total System Global Area 851443712 bytes Fixed Size 2100040 bytes Variable Size 738198712 bytes Database Buffers 104857600 bytes Redo Buffers 6287360 bytes Database mounted. Database opened. SQL> oradebug setmypid; Statement processed. SQL> oradebug dump heapdump 2; Statement processed. SQL> oradebug tracefile_name /s01/admin/G10R25/udump/g10r25_ora_12003.trc [oracle@vrh8 ~]$ grep "sga heap" /s01/admin/G10R25/udump/g10r25_ora_12003.trc HEAP DUMP heap name="sga heap" desc=0x60000058 HEAP DUMP heap name="sga heap(1,0)" desc=0x600360b0 HEAP DUMP heap name="sga heap(2,0)" desc=0x6003f8d SQL> alter system set cpu_count=16 scope=spfile; System altered. SQL> startup force; ORACLE instance started. Total System Global Area 851443712 bytes Fixed Size 2100040 bytes Variable Size 738198712 bytes Database Buffers 104857600 bytes Redo Buffers 6287360 bytes Database mounted. Database opened. SQL> oradebug setmypid; Statement processed. SQL> oradebug dump heapdump 2; Statement processed. SQL> oradebug tracefile_name /s01/admin/G10R25/udump/g10r25_ora_12065.trc [oracle@vrh8 ~]$ grep "sga heap" /s01/admin/G10R25/udump/g10r25_ora_12065.trc HEAP DUMP heap name="sga heap" desc=0x60000058 HEAP DUMP heap name="sga heap(1,0)" desc=0x600360b0 HEAP DUMP heap name="sga heap(2,0)" desc=0x6003f8d8 SQL> show parameter sga_target NAME TYPE VALUE ------------------------------------ -------------------------------- ------------------------------ sga_target big integer 0 SQL> alter system set sga_target=1000M scope=spfile; System altered. SQL> startup force; ORACLE instance started. Total System Global Area 1048576000 bytes Fixed Size 2101544 bytes Variable Size 738201304 bytes Database Buffers 301989888 bytes Redo Buffers 6283264 bytes Database mounted. Database opened. SQL> alter system set sga_target=1000M scope=spfile; System altered. SQL> startup force; ORACLE instance started. Total System Global Area 1048576000 bytes Fixed Size 2101544 bytes Variable Size 738201304 bytes Database Buffers 301989888 bytes Redo Buffers 6283264 bytes Database mounted. Database opened. SQL> SQL> SQL> oradebug setmypid; Statement processed. SQL> oradebug dump heapdump 2; Statement processed. SQL> oradebug tracefile_name /s01/admin/G10R25/udump/g10r25_ora_12148.trc SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@vrh8 dbs]$ grep "sga heap" /s01/admin/G10R25/udump/g10r25_ora_12148.trc HEAP DUMP heap name="sga heap" desc=0x60000058 HEAP DUMP heap name="sga heap(1,0)" desc=0x60036690 HEAP DUMP heap name="sga heap(1,1)" desc=0x60037ee8 HEAP DUMP heap name="sga heap(1,2)" desc=0x60039740 HEAP DUMP heap name="sga heap(1,3)" desc=0x6003af98 HEAP DUMP heap name="sga heap(2,0)" desc=0x6003feb8 HEAP DUMP heap name="sga heap(2,1)" desc=0x60041710 HEAP DUMP heap name="sga heap(2,2)" desc=0x60042f68 _enable_shared_pool_durations:该参数控制是否启用10g中特有的shared pool duration特性,当我们设置sga_target为0时该参数为false; 同时在10.2.0.5前若cursor_space_for_time设置为true时该参数也为false,不过在10.2.0.5以后cursor_space_for_time参数被废弃 SQL> alter system set "_enable_shared_pool_durations"=false scope=spfile; System altered. SQL> SQL> startup force; ORACLE instance started. Total System Global Area 1048576000 bytes Fixed Size 2101544 bytes Variable Size 738201304 bytes Database Buffers 301989888 bytes Redo Buffers 6283264 bytes Database mounted. Database opened. SQL> oradebug setmypid; Statement processed. SQL> oradebug dump heapdump 2; Statement processed. SQL> oradebug tracefile_name /s01/admin/G10R25/udump/g10r25_ora_12233.trc SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options\ [oracle@vrh8 dbs]$ grep "sga heap" /s01/admin/G10R25/udump/g10r25_ora_12233.trc HEAP DUMP heap name="sga heap" desc=0x60000058 HEAP DUMP heap name="sga heap(1,0)" desc=0x60036690 HEAP DUMP heap name="sga heap(2,0)" desc=0x6003feb8结论: 1. _kghdsidx_count 控制了 shared pool subpool的数量, _kghdsidx_count的最大允许值是7 即最多 7个 shared pool subpool 2. 为什么会在一个 subpool中还有4个 sub partition 如: sga heap(1,0) sga heap(1,1) sga heap(1,2) sga heap(1,3) 这不是因为 cpu的数目 也不是因为_kghdsidx_count, 而是因为 在10g 中AUTO SGA 引入了 shared pool duration的概念, duration 分成4类:
- Session duration
- Instance duration (never freed)
- Execution duration (freed fastest)
- Free memory
posted on 2013-03-19 00:51 Oracle和MySQL 阅读(314) 评论(0) 编辑 收藏 举报