Explain one query in 256M shared pool and ORA-4031 .
Hi,
looks like Oracle 9.2.0.8 got some problems with explaining huge (1000 lines) queries, here
goes ORA-4031 dump, shared pool is about 256 M but there are no other sessions in that DB only mine .
I can reproduce that in 1GB shared pool as well .
*** 2010-09-06 09:43:24.005
*** SESSION ID:(13.24) 2010-09-06 09:43:23.997
=================================
Begin 4031 Diagnostic Information
=================================
The following information assists Oracle in diagnosing
causes of ORA-4031 errors. This trace may be disabled
by setting the init.ora parameter _4031_dump_bitvec = 0
======================================
Allocation Request Summary Information
======================================
Current information setting: 00654fff
Dump Interval=300 seconds SGA Heap Dump Interval=3600 seconds
Last Dump Time=09/06/2010 09:43:22
Allocation request for: qknAllocate : qkn
Heap: 70000002aa6f4e8, size: 640
HEAP DUMP heap name="sga heap" desc=700000000000058
extent sz=0xfe0 alt=200 het=32767 rec=9 flg=-126 opc=0
parent=0 owner=0 nex=0 xsz=0x0
HEAP DUMP heap name="sql area" desc=70000002aa6f4e8
extent sz=0x1040 alt=32767 het=32 rec=0 flg=2 opc=2
parent=700000000000058 owner=0 nex=0 xsz=0x1
Subheap has 102506016 bytes of memory allocated
====================
Process State Object
====================
SO: 7000000222fe540, type: 2, owner: 0, flag: INIT/-/-/0x00
(process) Oracle pid=12, calls cur/top: 700000021736ba0/700000021736ba0, flag: (0) -
int error: 0, call error: 0, sess error: 0, txn error 0
(post info) last post received: 199 0 4
last post received-location: kslpsr
last process to post me: 7000000222fca88 1 6
last post sent: 0 0 16
last post sent-location: ksasnd
last process posted by me: 7000000222fca88 1 6
(latch info) wait_event=0 bits=0
Process Group: DEFAULT, pseudo proc: 7000000212e7290
O/S info: user: oracle, term: UNKNOWN, ospid: 6766752
OSD pid info: Unix process pid: 6766752, image: oracle@prod3 (TNS V1-V3)
=========================
User Session State Object
=========================
SO: 7000000226ee540, type: 4, owner: 7000000222fe540, flag: INIT/-/-/0x00
(session) trans: 0, creator: 7000000222fe540, flag: (100045) USR/- BSY/-/-/-/-/-
DID: 0001-000C-00000002, short-term DID: 0000-0000-00000000
txn branch: 0
oct: 50, prv: 0, sql: 70000002aa7fbf8, psql: 0, user: 2622/INSTALL
program: sqlplus.exe
application name: SQL*Plus, hash value=3669949024
last wait for 'db file sequential read' blocking sess=0x0 seq=93 wait_time=11432
file#=1, block#=106e8, blocks=1
temporary object counter: 0
=========================
Current Parent KGL Object
=========================
LIBRARY OBJECT HANDLE: handle=70000002aa7fbf8
name=
explain plan for
select *
from salda
where saldo <> 0
and konta in ('361','362','363','371','372','373','380','381','382','383','384','385','386','387','388','389','390','391','392','393',
'394','395','396','397','398','399','400','401','402','403','404','405','406','407','408','409','410','411','412','413',
hash=ff099bfd timestamp=09-06-2010 09:41:45
namespace=CRSR flags=RON/KGHP/TIM/PN0/[10010000]
kkkk-dddd-llll=0000-0001-0001 lock=N pin=X latch#=7
lwt=70000002aa7fc28[70000002aa7fc28,70000002aa7fc28] ltm=70000002aa7fc38[70000002aa7fc38,70000002aa7fc38]
pwt=70000002aa7fc58[70000002aa7fc58,70000002aa7fc58] ptm=70000002aa7fce8[70000002aa7fce8,70000002aa7fce8]
ref=70000002aa7fc08[70000002aa7fc08, 70000002aa7fc08] lnd=70000002aa7fd00[70000002aa7fd00,70000002aa7fd00]
LIBRARY OBJECT: object=70000002aa6fc98
type=CRSR flags=EXS[0001] pflags= [00] status=VALD load=0
CHILDREN: size=16
child# table reference handle
0 70000002aa6ff08 70000002aa6fbc0 70000002aa6f7a0
==================
Current KGL Object
==================
LIBRARY OBJECT HANDLE: handle=70000002aa6f7a0
namespace=CRSR flags=RON/KGHP/PN0/[10010000]
kkkk-dddd-llll=0000-0000-0000 lock=N pin=X latch#=7
lwt=70000002aa6f7d0[70000002aa6f7d0,70000002aa6f7d0] ltm=70000002aa6f7e0[70000002aa6f7e0,70000002aa6f7e0]
pwt=70000002aa6f800[70000002aa6f800,70000002aa6f800] ptm=70000002aa6f890[70000002aa6f890,70000002aa6f890]
ref=70000002aa6f7b0[70000002aa6fbc0, 70000002aa6fbc0] lnd=70000002aa6f8a8[70000002aa6f8a8,70000002aa6f8a8]
LIBRARY OBJECT: object=70000002aa6f3b8
type=CRSR flags=EXS[0001] pflags= [00] status=VALD load=0
===========================
Current Instatiation Object
===========================
INSTANTIATION OBJECT: object=1102fa2e0
type="cursor"[2] lock=70000002865ffe0 handle=70000002aa7fbf8 body=0 level=0
flags=FST[60] executions=0
cursor name:
explain plan for
select *
from salda
where saldo <> 0
and nr_konta in ('361','362','363','371','372','373','380','381','382','383','384','385','386','387','388','389','390','391','392','393',
'394','395','396','397','398','399','400','401','402','403','404','405','406','407','408','409','410','411','412','413',
'414','432','450','453','454','455','456','457','458','459','460','461','462','463','464','465','466','467','468','469',
'470','471','472','473','474','475','476','477','478','479','480','481')
and (
(umowa = lpad('2169725150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2170639147',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2170815147',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2170991138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2173034150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2173821138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2174491138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2176065138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2177180150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2178183150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2178609150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2180241147',10) and nr_klasy = lpad('27',3)) or
(umowa = lpad('2180252147',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2180377148',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2180787148',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2181011148',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2183314150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2187754150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2189036150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2189362150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2189685150',10) and nr_klasy = lpad('27',3)) or
(umowa = lpad('2191061124',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2194768150',10) and nr_klasy = lpad('27',3)) or
(umowa = lpad('2195063150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2195568150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2196774143',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2196872143',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2196964143',10) and nr_klasy = lpad('7',3)) or
.... a lot off similar lines
child pin: 0, child lock: 70000002865fb18, parent lock: 70000002865ffe0
xscflg: 4004, parent handle: 70000002aa7fbf8, xscfl2: 0
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
ksm_4031_dump+065c bl ksedst 110006450 ?
ksmasg+0084 bl ksm_4031_dump FFFFFFFFFFF5F60 ? 10299AAF8 ?
000000000 ? 70000002A9007F8 ?
000000000 ? 000000000 ?
kghnospc+0178 bl _ptrgl
kghalp+00f0 bl kghnospc FFFFFFFFFFF6150 ?
422222247FFFFFFC ?
100107620 ? 080000000 ?
000000000 ?
kksalc+0048 bl kghalp 100107620 ? 000000000 ?
FFFFFFFFFFF62C0 ? 000000000 ?
000000080 ? 000000003 ?
qknAllocate+0040 bl kksalc 70000002AC2E1C0 ?
70000002C873DD8 ?
70000002AC2E1C0 ?
qknltAllocate+00d0 bl qknAllocate FFFFFFFFFFF65C0 ?
7000000345292A0 ? 000000000 ?
000000003 ?
qkatab+0ec8 bl qknltAllocate 000000000 ? 000000000 ?
000000000 ? 000000000 ?
000000000 ? 000000000 ?
000000000 ? 000000000 ?
70000002C874170 ?
qkajoi+0b30 bl qkatab 000000000 ? 110378F00 ?
000000000 ? 000000042 ?
100002100050000 ? 110378530 ?
qkaqkn+08d0 bl qkajoi 000000000 ? 000000000 ?
000000000 ? 000000000 ?
000000000 ? 000000000 ?
000000000 ? 000000000 ?
qkadrv+07a0 bl qkaqkn 000000000 ? 10299B690 ?
===============================
Memory Utilization of Subpool 1
===============================
Allocation Name Size
"free memory " 148632616
"miscellaneous " 3998104
"qmps connections " 1454200
"errors " 0
"txncallback " 246640
"PL/SQL MPCODE " 506520
"enqueue " 6054632
"KSXR pending messages que" 853952
"KQR L PO " 221192
"parameters " 1064
"Checkpoint queue " 1026560
"1M buffer " 528384
"db_block_hash_buckets " 589824
"fixed allocation callback" 1112
"sim trace entries " 196608
"KGLS heap " 374728
"KGK heap " 552
"channel handle " 780672
"MTTR advisory " 34088
"DML lock " 1022032
"trigger source " 2288
"trigger defini " 280
"dictionary cache " 2137216
"table definiti " 456
"KQR X PO " 28352
"transaction " 2747760
"constraints " 824960
"library cache " 2030512
"message pool freequeue " 213264
"sql area " 1546168
"sessions " 4467008
"replication session stats" 1004720
"event statistics per sess" 18791304
"KQR S SO " 5632
"sim memory hea " 157768
"PL/SQL DIANA " 80104
"KQR M PO " 141320
"messages " 624000
===============================
Memory Utilization of Subpool 2
===============================
Allocation Name Size
"free memory " 6285488
"miscellaneous " 8927008
"log_buffer " 1056800
"FileOpenBlock " 16270720
"sim memory hea " 162008
"KQR S SO " 9472
"transaction " 3297312
"PL/SQL DIANA " 0
"KGLS heap " 47776
"table definiti " 0
"db_handles " 3480000
"KQR L PO " 213056
"Temporary Tables State Ob" 775488
"trigger inform " 0
"message pool freequeue " 558720
"trigger defini " 0
"fixed allocation callback" 1168
"branch " 1180120
"ktlbk state objects " 1948360
"PLS non-lib hp " 2088
"KGK heap " 6448
"KQR M SO " 1024
"dictionary cache " 2137216
"parameters " 0
"Checkpoint queue " 1026560
"trigger source " 0
"enqueue resources " 768192
"library cache " 1798152
"KSXR receive buffers " 1034000
"sql area " 105380864
"processes " 4104000
"sessions " 4469712
"joxs heap init " 4240
"errors " 0
"event statistics per sess" 18779936
"PL/SQL MPCODE " 0
"KQR M PO " 173592
"UNDO INFO SEGMENTED ARRAY" 649856
LIBRARY CACHE STATISTICS:
namespace gets hit ratio pins hit ratio reloads invalids
CRSR 3184 0.874 12550 0.950 97 11
TABL/PRCD/TYPE 1917 0.871 2293 0.811 0 0
BODY/TYBD 52 0.788 52 0.788 0 0
TRGR 33 0.939 33 0.939 0 0
INDX 74 0.514 43 0.140 0 0
CLST 353 0.977 489 0.980 0 0
OBJE 0 0.000 0 0.000 0 0
PIPE 0 0.000 0 0.000 0 0
LOB 0 0.000 0 0.000 0 0
DIR 0 0.000 0 0.000 0 0
QUEU 0 0.000 0 0.000 0 0
OBJG 0 0.000 0 0.000 0 0
PROP 0 0.000 0 0.000 0 0
JVSC 0 0.000 0 0.000 0 0
JVRE 0 0.000 0 0.000 0 0
ROBJ 0 0.000 0 0.000 0 0
REIP 0 0.000 0 0.000 0 0
CPOB 0 0.000 0 0.000 0 0
EVNT 8 0.750 91 0.978 0 0
SUMM 0 0.000 0 0.000 0 0
DIMN 0 0.000 0 0.000 0 0
CTX 0 0.000 0 0.000 0 0
OUTL 0 0.000 0 0.000 0 0
RULS 0 0.000 0 0.000 0 0
RMGR 0 0.000 0 0.000 0 0
IFSD 0 0.000 0 0.000 0 0
PPLN 0 0.000 0 0.000 0 0
PCLS 0 0.000 0 0.000 0 0
SUBS 0 0.000 0 0.000 0 0
LOCS 0 0.000 0 0.000 0 0
RMOB 0 0.000 0 0.000 0 0
RSMD 0 0.000 0 0.000 0 0
JVSD 0 0.000 0 0.000 0 0
ENPR 0 0.000 0 0.000 0 0
RELC 0 0.000 0 0.000 0 0
STREAM 0 0.000 0 0.000 0 0
APPLY 0 0.000 0 0.000 0 0
APPLY SOURCE 0 0.000 0 0.000 0 0
APPLY DESTN 0 0.000 0 0.000 0 0
TEST 0 0.000 0 0.000 0 0
CUMULATIVE 5621 0.874 15551 0.928 97 11
Permanent space allocted for Load Locks
LATCH:0 TOTAL SPACE: 4248
FREELIST CHUNK COUNT:59 OBJECT SIZE:72
Permanent space allocted for KGL pins
LATCH:0 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:13 OBJECT SIZE:128
LATCH:1 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:15 OBJECT SIZE:128
LATCH:2 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:18 OBJECT SIZE:128
LATCH:3 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:19 OBJECT SIZE:128
LATCH:4 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:21 OBJECT SIZE:128
LATCH:5 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:27 OBJECT SIZE:128
LATCH:6 TOTAL SPACE: 4224
FREELIST CHUNK COUNT:16 OBJECT SIZE:128
Permanent space allocted for KGL locks
LATCH:0 TOTAL SPACE: 4216
FREELIST CHUNK COUNT:11 OBJECT SIZE:136
LATCH:1 TOTAL SPACE: 4216
FREELIST CHUNK COUNT:13 OBJECT SIZE:136
LATCH:2 TOTAL SPACE: 4216
FREELIST CHUNK COUNT:16 OBJECT SIZE:136
...<snipped>...any ideas ?
GregG wrote:
Thanks,
but I'm interested in what is the particular problem. Looks like sql area is short on free chunks .I can't say if it is an oracle bug so feel free to ignore my post.
select *
from salda
where saldo 0
and nr_konta in ('361','362','363','371','372','373','380','381','382','383','384','385','386','387','388','389','390','391','392','393',
'394','395','396','397','398','399','400','401','402','403','404','405','406','407','408','409','410','411','412','413',
'414','432','450','453','454','455','456','457','458','459','460','461','462','463','464','465','466','467','468','469',
'470','471','472','473','474','475','476','477','478','479','480','481')
and (
(umowa = lpad('2169725150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2170639147',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2170815147',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2170991138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2173034150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2173821138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2174491138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2176065138',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2177180150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2178183150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2178609150',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2180241147',10) and nr_klasy = lpad('27',3)) or
(umowa = lpad('2180252147',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2180377148',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2180787148',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2181011148',10) and nr_klasy = lpad('13',3)) or
(umowa = lpad('2183314150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2187754150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2189036150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2189362150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2189685150',10) and nr_klasy = lpad('27',3)) or
(umowa = lpad('2191061124',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2194768150',10) and nr_klasy = lpad('27',3)) or
(umowa = lpad('2195063150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2195568150',10) and nr_klasy = lpad('9',3)) or
(umowa = lpad('2196774143',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2196872143',10) and nr_klasy = lpad('7',3)) or
(umowa = lpad('2196964143',10) and nr_klasy = lpad('7',3)) or
.... a lot off similar linesThis looks like an ideal candidate for using a Global Temporary table (if you can).
So if you can insert all combination of valid values for "umowa" and "nr_klasy" columns in a GTT,
you can simplify your query as
select *
from salda
where saldo 0
and nr_konta in ('361','362','363','371','372','373','380','381','382','383','384','385','386','387','388','389','390','391','392','393',
'394','395','396','397','398','399','400','401','402','403','404','405','406','407','408','409','410','411','412','413',
'414','432','450','453','454','455','456','457','458','459','460','461','462','463','464','465','466','467','468','469',
'470','471','472','473','474','475','476','477','478','479','480','481')
and (umowa, nr_klasy) in (select lpad(col1,10), lpad(col2,3) from gtt_temp)
Similar Messages
-
ORA-604 and ORA-4031 during installation of SAP
Hi,
I tried to install Oracle 10.2.0.2 on Windows 2003 with SAP R3E 47X2.
However, during the installation on the Database Load phases it pops up a ORA-604 and ORA-4031 error log. It was unable to completed the Database Load phase showed as R3 load jobs: running 1, waiting 0.
I tried to set the share pool in init.ora as shared_pool_size = 40000000. It still show up as shared memory issue.
The log shows as,
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: START OF LOG: 20081201110818
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: sccsid @(#) $Id: //bas/640_REL/src/R3ld/R3load/R3ldmain.c#12 $ SAP
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: version R6.40/V1.4 [UNICODE]
Compiled Dec 15 2005 22:22:21
E:\usr\sap\IDE\SYS\exe\run/R3load.exe -dbcodepage 4103 -i C:\Program Files\sapinst_instdir\R3E47X2\SYSTEM\ABAP\ORA\UC\DB/SAPSSEXC.cmd -l C:\Program Files\sapinst_instdir\R3E47X2\SYSTEM\ABAP\ORA\UC\DB/SAPSSEXC.log -stop_on_error
DbSl Trace: ORA-1403 when accessing table SAPUSER
DbSl Trace: Failed to register client info: orc=604
(DB) INFO: connected to DB
(DB) INFO: DbSlControl(DBSL_CMD_NLS_CHARACTERSET_GET): UTF8
DbSl Trace: Error in exec_immediate()
DbSl Trace: ORA-604 occurred when executing SQL statement (parse error offset=15)
(DB) ERROR: DDL statement failed
(TRUNCATE TABLE "DYNPSOURCE")
DbSlExecute: rc = 99
(SQL error 604)
error message returned by DbSl:
ORA-00604: error occurred at recursive SQL level 1
ORA-04031: unable to allocate 4120 bytes of shared memory ("shared pool","select user#,type# from user...","Typecheck","kgghteInit")
(DB) INFO: disconnected from DB
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: job finished with 1 error(s)
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: END OF LOG: 20081201110858
Could anyone help me about it?
Thanks.hi Nikhuj,
I reset the installation and however endup the installation still have an error. Please help me to check with the following:
SQL> connect system
Enter password:
ERROR:
ORA-00604: error occurred at recursive SQL level 2
ORA-04031: unable to allocate 4120 bytes of shared memory ("shared
pool","select ts#,file#,block#,nvl(...","Typecheck","kgghtInit")
SQL> show parameters shared_pool;
NAME TYPE VALUE
shared_pool_reserved_size big integer 12881756
shared_pool_size big integer 124M
SQL> alter system set shared_pool_size=40000000;
alter system set shared_pool_size=40000000
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-04034: unable to shrink pool to specified size
As I had changed the parameter in initsmpl.ora shared pool from 10000000 to 40000000. The log as below was showing that:
SAPAPPL1.log:
Error accessing package DBMS_APPLICATION_INFO
Connected.
(IMP) INFO: import of LXE_PPX__1 completed (1 rows) #20081201200124
(DB) INFO: LXE_PPX__1~0 created #20081201200124
DbSl Trace: Error in exec_immediate()
DbSl Trace: ORA-604 occurred when executing SQL statement (parse error offset=34)
(DB) ERROR: DDL statement failed
(CREATE INDEX "LXE_PPX__1~CNT" ON "LXE_PPX__1" ( "T_LANG" , "S_LANG" ,
"DOMATYP" , "DOMANAM" , "USAGECNT" ) TABLESPACE PSAPIDE STORAGE (INITIAL 0 NEXT
0000010240K MINEXTENTS 0000000001 MAXEXTENTS 2147483645 PCTINCREASE 0 ) )
DbSlExecute: rc = 99
(SQL error 604)
error message returned by DbSl:
ORA-00604: error occurred at recursive SQL level 1
ORA-04031: unable to allocate 4120 bytes of shared memory ("shared pool","CREATE
UNIQUE INDEX "PA0399~...","Typecheck","kgghteInit")
(DB) INFO: disconnected from DB
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: job finished with 1 error(s)
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: END OF LOG: 20081201200129
SAPAPPL2.log:
(DB) INFO: TCN2T~0 created #20081201200843
DbSl Trace: Error in exec_immediate()
DbSl Trace: ORA-604 occurred when executing SQL statement (parse error offset=0)
(DB) ERROR: DDL statement failed
(CREATE TABLE "TCN41" ( "MANDT" VARCHAR2(9) DEFAULT '000' NOT NULL , "PLNAW"
VARCHAR2(3) DEFAULT ' ' NOT NULL , "PROFIDNETZ" VARCHAR2(21) DEFAULT ' ' NOT NULL
, "FLG_ERF_H" VARCHAR2(3) DEFAULT ' ' NOT NULL , "ESOKZ" VARCHAR2(3) DEFAULT ' '
NOT NULL , "EKORG" VARCHAR2(12) DEFAULT ' ' NOT NULL , "KSTAR_FRMD" VARCHAR2(30)
DEFAULT ' ' NOT NULL , "STEUS_WORK" VARCHAR2(12) DEFAULT ' ' NOT NULL ,
"STEUS_FRMD" VARCHAR2(12) DEFAULT ' ' NOT NULL , "STEUS_PRIM" VARCHAR2(12)
DEFAULT ' ' NOT NULL , "KSTAR_COST" VARCHAR2(30) DEFAULT ' ' NOT NULL ,
"KSTAR_SERV" VARCHAR2(30) DEFAULT ' ' NOT NULL , "STEUS_SERV" VARCHAR2(12)
DEFAULT ' ' NOT NULL , "DAUNE" VARCHAR2(9) DEFAULT ' ' NOT NULL , "ARBEH"
VARCHAR2(9) DEFAULT ' ' NOT NULL , "WAERS" VARCHAR2(15) DEFAULT ' ' NOT NULL ,
"SLWID" VARCHAR2(21) DEFAULT ' ' NOT NULL , "LVARI" VARCHAR2(6) DEFAULT ' ' NOT
NULL , "INDET" VARCHAR2(3) DEFAULT ' ' NOT NULL , "BUKRS" VARCHAR2(12) DEFAULT '
' NOT NULL , "AOB_KEY" VARCHAR2(3) DEFAULT ' ' NOT NULL , "VORNR_DEL" VARCHAR2
(12) DEFAULT ' ' NOT NULL , "TERKZ" VARCHAR2(3) DEFAULT ' ' NOT NULL , "AUART"
VARCHAR2(12) DEFAULT ' ' NOT NULL , "WERKS" VARCHAR2(12) DEFAULT ' ' NOT NULL ,
"DISPO" VARCHAR2(9) DEFAULT ' ' NOT NULL , "RSCHL_OFER" VARCHAR2(18) DEFAULT ' '
NOT NULL , "RSCHL_OFRD" VARCHAR2(18) DEFAULT ' ' NOT NULL , "RSCHL_UFER"
VARCHAR2(18) DEFAULT ' ' NOT NULL , "RSCHL_UFRD" VARCHAR2(18) DEFAULT ' ' NOT
NULL , "RSCHL_OCST" VARCHAR2(18) DEFAULT ' ' NOT NULL , "RSCHL_UCST" VARCHAR2(18)
DEFAULT ' ' NOT NULL , "GR_PRF_GR" VARCHAR2(12) DEFAULT ' ' NOT NULL ,
"GR_PRF_NAM" VARCHAR2(36) DEFAULT ' ' NOT NULL , "FHORI" VARCHAR2(9) DEFAULT ' '
NOT NULL , "NETSTUFE" VARCHAR2(6) DEFAULT '00' NOT NULL , "VAGRP" VARCHAR2(9)
DEFAULT ' ' NOT NULL , "MSGTY" VARCHAR2(3) DEFAULT ' ' NOT NULL , "AOB_DARST"
VARCHAR2(3) DEFAULT ' ' NOT NULL , "VRG_DARST" VARCHAR2(3) DEFAULT ' ' NOT NULL ,
"NO_DISP" VARCHAR2(3) DEFAULT ' ' NOT NULL , "COLKZ_ELEM" VARCHAR2(33) DEFAULT '
' NOT NULL , "COLKZ_TEIL" VARCHAR2(33) DEFAULT ' ' NOT NULL , "COLKZ_MLST"
VARCHAR2(33) DEFAULT ' ' NOT NULL , "COLKZ_DOKU" VARCHAR2(33) DEFAULT ' ' NOT
NULL , "COLKZ_MAT" VARCHAR2(33) DEFAULT ' ' NOT NULL , "VSPRF" VARCHAR2(21)
DEFAULT ' ' NOT NULL , "CLASF" VARCHAR2(3) DEFAULT ' ' NOT NULL , "PROFILE_ID"
VARCHAR2(30) DEFAULT ' ' NOT NULL , "BALK_PROF" VARCHAR2(36) DEFAULT ' ' NOT NULL
, "KBED" VARCHAR2(3) DEFAULT ' ' NOT NULL , "KKALKR" VARCHAR2(3) DEFAULT ' ' NOT
NULL , "LSTVAR" VARCHAR2(36) DEFAULT ' ' NOT NULL , "MATKL" VARCHAR2(27) DEFAULT
' ' NOT NULL , "MATEXIT" VARCHAR2(3) DEFAULT ' ' NOT NULL , "EKGRP" VARCHAR2(9)
DEFAULT ' ' NOT NULL , "MATKL_FRMD" VARCHAR2(27) DEFAULT ' ' NOT NULL ,
"EKGRP_FRMD" VARCHAR2(9) DEFAULT ' ' NOT NULL , "POSNR_MAT" VARCHAR2(12) DEFAULT
'0000' NOT NULL , "SCHED_END" VARCHAR2(3) DEFAULT ' ' NOT NULL , "SCEND_ACT"
VARCHAR2(3) DEFAULT ' ' NOT NULL , "NT_SEARCH1" VARCHAR2(6) DEFAULT ' ' NOT NULL
, "NT_SEARCH2" VARCHAR2(6) DEFAULT ' ' NOT NULL , "NT_SEARCH3" VARCHAR2(6)
DEFAULT ' ' NOT NULL , "MFLIC" VARCHAR2(9) DEFAULT ' ' NOT NULL , "MEINH_FRMD"
VARCHAR2(9) DEFAULT ' ' NOT NULL , "MEINH_SERV" VARCHAR2(9) DEFAULT ' ' NOT NULL
, "KSTAR_MATVORPL" VARCHAR2(30) DEFAULT ' ' NOT NULL , "KZERB" VARCHAR2(3)
DEFAULT ' ' NOT NULL , "VALID" VARCHAR2(21) DEFAULT ' ' NOT NULL , "VALID_VG"
VARCHAR2(21) DEFAULT ' ' NOT NULL , "SUBST" VARCHAR2(21) DEFAULT ' ' NOT NULL ,
"SUBST_VG" VARCHAR2(21) DEFAULT ' ' NOT NULL , "FPART" VARCHAR2(6) DEFAULT ' '
NOT NULL ) TABLESPACE PSAPIDE STORAGE (INITIAL 65536 NEXT 0000000040K MINEXTENTS
0000000001 MAXEXTENTS 2147483645 PCTINCREASE 0 ) )
DbSlExecute: rc = 99
(SQL error 604)
error message returned by DbSl:
ORA-00604: error occurred at recursive SQL level 2
ORA-04031: unable to allocate 4040 bytes of shared memory ("shared pool","select
i.obj#,i.ts#,i.file#,...","Typecheck","seg:kggfaAllocSeg")
(DB) INFO: disconnected from DB
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: job finished with 1 error(s)
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: END OF LOG: 20081201200843
SAPAPPL0.log:
(DB) INFO: PA0398~0 created #20081201200124
(DB) INFO: PA0399 created #20081201200124
(IMP) INFO: import of PA0399 completed (12 rows) #20081201200124
DbSl Trace: Error in exec_immediate()
DbSl Trace: ORA-4031 occurred when executing SQL statement (parse error offset=0)
(DB) ERROR: DDL statement failed
(CREATE UNIQUE INDEX "PA0399~0" ON "PA0399" ( "MANDT", "PERNR", "SUBTY",
"OBJPS", "SPRPS", "ENDDA", "BEGDA", "SEQNR" ) TABLESPACE PSAPIDE STORAGE (INITIAL
0 NEXT 0000000080K MINEXTENTS 0000000001 MAXEXTENTS 2147483645 PCTINCREASE 0 ) )
DbSlExecute: rc = 99
(SQL error 4031)
error message returned by DbSl:
ORA-04031: unable to allocate 4120 bytes of shared memory ("shared pool","CREATE
UNIQUE INDEX "PA0399~...","Typecheck","kgghteInit")
(DB) INFO: disconnected from DB
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: job finished with 1 error(s)
E:\usr\sap\IDE\SYS\exe\run/R3load.exe: END OF LOG: 20081201200129 -
Query about Keep Buffer Pool and Recycle Buffer Pool
What will Keep Buffer Pool and Recycle Buffer Pool contains actually in Database Buffer Cache, specially what type of objects? I know the definitions but need to know the practical aspects about them.
918868 wrote:
What will Keep Buffer Pool and Recycle Buffer Pool contains actually in Database Buffer Cache, specially what type of objects? I know the definitions but need to know the practical aspects about them.I believe you have already got the answer from the experts. Just to echo the same, in any cache, either Buffer Cache(default), Keep or Recycle, its going to be data buffers which are actually the placeholders for the data blocks that are available on the disk. The default cache is going to throw away the lesser used buffers as fast as possible. And if you don't want this to happen, you can use either of the other two, indepandant caches-Recycle and Keep. The keep cache , as the name suggests would keep the buffers in it for a more loonger duration compared to the default cache. This probably would be a better idea when you know that some buffers are meant to be reused again and again. Recycle is going tobe for those, which are very seldom used and you don't want them to choke up the caches at all. For the buffers kept in the Recycle cache, they would be thrown out almost instantly.
Read the link that's given to you. It contains a lot of stuff that would further make things clear.
Aman.... -
how can i pin blocks to plsql in oracle 11g/oracle 10g?
it is through exec dbms_shared_pool.keep()?Yes.
-
hi friends i have a procedure
and its have *(AD IS NULL OR NVAD LIKE AD||'%') AND (SOYAD IS NULL OR NVSOYAD LIKE SOYAD||'%')*
if i use this query and pass different things for AD ; is it become a brand new query for oracle because of ||'%' or its parse and put in shared pool and for a sometime this query don't parse and take from shared pool
PROCEDURE P_YENI_TALEP_LISTELE(RC_CURSOR OUT SYS_REFCURSOR,TOPLAM_TALEP OUT NUMBER,SAYFA_INDEX IN NUMBER,SAYFA_BUYUKLUK IN NUMBER,TC_NO IN NVARCHAR2,AD IN NVARCHAR2,SOYAD IN NVARCHAR2,ONAY IN NUMBER,H_TIP_ID IN NUMBER)
AS
BEGIN
OPEN RC_CURSOR FOR SELECT TA.NT_ID,TA.NTC_NO,HI.NVHIZMET_TUR AS NVARM_KONU,TA.NVOPRTR_CVP,TA.NVGRSM_SURE,TA.NVGRSM_DRM,
TA.NHIZMET,TA.BONAY,TA.DTLP_TRH,TH.NVAD,TH.NVSOYAD,TH.NVILCE ,TA.DALINAN_TRH,
TA.DBRKLAN_TRH,TA.NG_ID,GU.NVAD1||' - '||GU.NVAD2 AS GUZERGAH,HI.NH_TIP_ID,HT.NVHIZMET_TIP,
FROM H_TALEP TA,TNM_HASTA_BILGI TH,TNM_HIZMET HI,SBT_HIZMET_TIP HT,TNM_GUZERGAH GU
WHERE TA.NTC_NO=TH.NTC_NO AND TA.NH_ID=HI.NH_ID AND HI.NH_TIP_ID=HT.NH_TIP_ID AND(TC_NO IS NULL OR TA.NTC_NO=TO_NUMBER(TC_NO)) AND TA.NG_ID=GU.NG_ID AND
*(AD IS NULL OR NVAD LIKE AD||'%') AND (SOYAD IS NULL OR NVSOYAD LIKE SOYAD||'%')*...............The code you have posted has no DYNAMIC SQL in it.... Static SQL inside PL/SQL will bind all the variables for you.
So what you are saying does not compute.
What is making you think a 'brand new query' is being parsed for each execution?
Edited by: Tubby on Nov 8, 2008 4:19 PM -
100% CPU, wait event : latch shared pool
I have a store procedure, run in one of database, it hangs in a "create table ... as select ..." statement.
the wait event is : latch shared pool, and CPU is up to 100%, it has run over few hours and seems hang.
Same stored procedure run on others enviroment, never seen such problem, even run on the same data size or even much much bigger data size.
This procedure has been used more than 2 years, never see such problem in any others enviroment. it only happend in this new setup enviroment.
however, in this enviroment, if I try to reduce data to be very very small, I was able to see procudure complate in 10 sec.
I suspect parameter, for example, I changed shared_pool_size from 40MB to 150 MB, re-start database and re-run, still see the same problem here.
Could anybody suggest any thing I can look into?
Thanksjjzz wrote:
I have a store procedure, run in one of database, it hangs in a "create table ... as select ..." statement.
the wait event is : latch shared pool, and CPU is up to 100%, it has run over few hours and seems hang.
If it's running at 100% CPU, it's not waiting.
Does v$session_wait (or even v$session since you seem to be running 10g) tell you that the session is *"waiting"*, or is it simply noting that your last wait was on the shared pool latch ?
If the latter, then you probably have some SQL in the procedure that has changed its execution plan to become much more CPU intensive - perhaps because of a small change in the data volume, data distribution, or statistics.
First step - find out what SQL statements are executing, and see how much work they are doing. You could query v$session for that session a few times and check what the sql_id and sql_child number are, also prev_sql_id and prev_child_number. If these stay constant, one or other may give you the guilty SQL statement. If not check v$open_cursor for the session.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
"Science is more than a body of knowledge; it is a way of thinking"
Carl Sagan -
Hello Team:
I ran a metalink script to report the shared pool utilization recently. I took this output when the database was on peak load.
SQL> /
Obj mem: 66435759 bytes (63.36MB)
Shared sql: 324219036 bytes (309.2MB)
Cursors: 341207073 bytes (325.4MB)
Free memory: 67228508 bytes (64.11MB)
Shared pool utilization (total): 468785754 bytes (447.07MB)
Shared pool allocation (actual): 754974720bytes (720MB)
Percentage Utilized: 91%
does this mean I have to add more space to shared pool. If so what is the threshold value?
Regards,
BalaBhawani nandan Prasad - Principal DBA -- See a to z diagnostics about Shared pool
1. Memory 2
a. Shared Pool 2
1. Introduction 2
2. Architecture 2
3. Scripts for different DBA tasks: 5
a.Measure object usage inside the shared pool and Tune shared pool 7
b.Check reload problem in library cache 12
c.Find the large queries in the shared pool library cache (using > 4mb each) 13
d.Find objects that can be considered pining into the shared pool 13
e.LRU work and objects were loaded and flushed 13
f.How much are waiting for Library Cache Latch 14
g.Queries identical but aren’t shared. 14
h.Get Biggest chunk of free memory. 14
i.Check the shared pool reserved size status 16
j.When having multiple subheaps: 16
k.Check shared pool at first glance quick diagnostics 17
l.Memory Usage - object list level view 17
m.Loads Number of times object has been loaded 17
n.Check number of times and object has been executed 18
o.Check shared pool in more details 18
p.Library Cache Statistics 18
q.Reserve Pool Settings 19
r.Pinned Objects 19
s.Finding literal SQL 19
t.Finding the Library Cache hit ratio 19
u. Row Cache Misses – Dictionary cache stats 19
v. Checking hash chain lengths 20
w. Checking for high version counts 20
x. Finding statement/s which use lots of shared pool memory 20
y. Allocations causing shared pool memory to be 'aged' out 21
z. Issues in various Oracle Releases 21
4. Terminology 22
5. Oracle 11g Caching and Pooling – SQL Result Cache 27
6. References 37
2. SQL 38
3. Statistics 38
4. Wait events 38
5. Schema 39
6. General 39
a. Scripts 39
1. accept.sql 39
1. Memory
a. Shared Pool
1. Introduction
Shared pool is used to cache different types of data such as textual and executable forms of PL/SQL blocks and SQL statements, dictionary cache data, and other data in SGA. Additional shared memory needed in the SHARED POOL if using ASM storage. Gathering schema/database stats (table/index stats) makes database query performance better and it reduce utilization of shared pool. Hence, practice to schedule job to gather stats regularly which suites your database performance. If you use shared pool effectively you can reduce resource consumption in at least four ways
1. Parse overhead is avoided if the SQL statement is already in the shared pool. This saves CPU resources on the host and elapsed time for the end user.
2. Latching resource usage is significantly reduced, which results in greater scalability.
3. Shared pool memory requirements are reduced, because all applications use the same pool of SQL statements and dictionary resources.
4. I/O resources are saved, because dictionary elements that are in the shared pool do not require disk access.
This sharable area of memory is managed as a sophisticated cache and heap manager rolled into one. It has 3 fundamental problems to overcome:
1. The unit of memory allocation is not a constant - memory allocations from the pool can be anything from a few bytes to many kilobytes
2. Not all memory can be 'freed' when a user finishes with it (as is the case in a traditional heap manager) as the aim of the shared pool is to maximize share of information. The information in the memory may be useful to another session - Oracle cannot know in advance if the items will be of any use to anyone else or not.
3. There is no disk area to page out to so this is not like a traditional cache where there is a file backing store. Only "rewriteable" information can be discarded from the cache and it has to be re-created when it is next needed.
Oracle 10g architecture of Shared pool:
Library Cache Shared SQL Area (Hash Value, SQL source, Execution plan)
Data Dictionary Cache
Enqueues Fixed Area Other
Latches
Oracle 11g architecture of Shared pool:
Library Cache Shared SQL Area (Hash Value, SQL source, Execution plan)
Data Dictionary Cache
Result Cache
Enqueues Fixed Area Other
Latches
1. Library Cache
Shared Sql Area: contains Parsed SQL and execution Plans for statements already run against the database. This area allows SQL execution plans to be reused by many users.
Private SQL Area: Private SQL areas are non-shared memory areas assigned to unique user sessions.
Pl/sql Area: contains the recently executed Procedures, Functions and Packages.
Control Structures: Common control structure information example Memory for Latches and locks, sequence cache.
2. Dictionary cache known as the row cache.
Dictionary cache stores all the metadata info of tables and views in the database, Names and data types of the columns in the database, Object and system privileges of all the Users. Oracle maintains the stats of all the objects in the shared pool, if any of the memory objects are not used from the last 3 seconds, these memory objects will be aged out and will be removed from the cache. All the Shared Pool Structures are maintained by a LRU (least recently Used) algorithm, by which Oracle removes the objects from the shared Pool, until there is enough free space in the shared Pool to keep new Object.
3. Scripts for different DBA tasks:
Dictionary Views for shared POOL:
NON-RAC
V$DB_CACHE_ADVICE
V$DB_OBJECT_CACHE
V$DLM_LATCH
V$DLM_LOCKS
V$LATCH
V$LATCHHOLDER
V$LATCHNAME
V$LATCH_CHILDREN
V$LATCH_MISSES
V$LATCH_PARENT
V$LIBRARYCACHE
V$LOCK
V$LOCKED_OBJECT
V$LOCKS_WITH_COLLISIONS
V$LOCK_ACTIVITY
V$LOCK_ELEMENT
V$OPEN_CURSOR
V$PROCESS
V$PX_PROCESS
V$PX_PROCESS_SYSSTAT
V$PX_SESSION
V$PX_SESSTAT
V$ROWCACHE
V$ROWCACHE_PARENT
V$ROWCACHE_SUBORDINATE
V$SESSION
V$SESSION_CONNECT_INFO
V$SESSION_CURSOR_CACHE
V$SESSION_EVENT
V$SESSION_LONGOPS
V$SESSION_OBJECT_CACHE
V$SESSION_WAIT
V$SESSTAT
V$SESS_IO
V$SGA
V$SGASTAT
V$SGAINFO
V$SGA_DYAMIC_COMPONENTS
V$SGA_DYNAMIC_FREE_MEMORY
V$SGA_RESIZE_OPS
V$SGA_CURRENT_RESIZE_OPS
v$shared_pool_advice
V_$SHARED_POOL_ADVICE
V$SHARED_POOL_RESERVED
V$SHARED_SERVER
V$SORT_SEGMENT
V$SORT_USAGE
V$SQL
V$SQLAREA
V$SQLTEXT
V$SQLTEXT_WITH_NEWLINES
V$SQL_BIND_DATA
V$SQL_BIND_METADATA
V$SQL_CURSOR
V$SQL_SHARED_CURSOR
V$SQL_SHARED_MEMORY
V$STATNAME
V$SUBCACHE
V$SYSSTAT
V$SYSTEM_CURSOR_CACHE
V$SYSTEM_EVENT
V$SYSTEM_PARAMETER
X$KSMSP
RAC
GV$LATCH
GV$LATCHHOLDER
GV$LATCHNAME
GV$LATCH_CHILDREN
GV$LATCH_MISSES
GV$LATCH_PARENT
GV$LIBRARYCACHE
GV$LOCK
GV$LOCKED_OBJECT
GV$LOCKS_WITH_COLLISIONS
GV$LOCK_ACTIVITY
GV$LOCK_ELEMENT
GV$PROCESS
GV$PX_PROCESS
GV$PX_PROCESS_SYSSTAT
GV$PX_SESSION
GV$PX_SESSTAT
GV$ROWCACHE
GV$ROWCACHE_PARENT
GV$ROWCACHE_SUBORDINATE
GV$SESSION
GV$SESSION_CONNECT_INFO
GV$SESSION_CURSOR_CACHE
GV$SESSION_EVENT
GV$SESSION_LONGOPS
GV$SESSION_OBJECT_CACHE
GV$SESSION_WAIT
GV$SESSTAT
GV$SESS_IO
GV$SGA
GV$SGASTAT
gv$shared_pool_advice
GV$SHARED_POOL_RESERVED
GV$SHARED_SERVER
GV$SORT_SEGMENT
GV$SORT_USAGE
GV$SQL
GV$SQLAREA
GV$SQLTEXT
GV$SQLTEXT_WITH_NEWLINES
GV$SQL_BIND_DATA
GV$SQL_BIND_METADATA
GV$SQL_CURSOR
GV$SQL_SHARED_CURSOR
GV$SQL_SHARED_MEMORY
GV$STATNAME
GV$SUBCACHE
GV$SYSSTAT
GV$SYSTEM_CURSOR_CACHE
GV$SYSTEM_EVENT
GV$SYSTEM_PARAMETER
GV$WAITSTAT
GV$_LOCK
a.Measure object usage inside the shared pool and Tune shared pool
set pagesize 132
column owner format a16
column name format a36
column sharable_mem format 999,999,999
column executions format 999,999,999
prompt
prompt Memory Usage of Shared Pool Order - Biggest First
prompt
column name format 45
select owner, name||' - '||type name, sharable_mem from v$db_object_cache
where sharable_mem > 10000
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by sharable_mem desc
prompt
prompt Loads into Shared Pool - Most Loads First
prompt
select owner, name||' - '||type name, loads , sharable_mem from v$db_object_cache
where loads > 3
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by loads desc
prompt
prompt Executions of Objects in the Shared Pool - Most Executions First
prompt
select owner, name||' - '||type name, executions from v$db_object_cache
where executions > 100
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by executions desc
select 'If the values for the EXEC and LOADS close increase SHARED_POOL_SIZE!' from dual ;
set feedback off
set linesize 80
set pagesize 52
clear columns
clear breaks
col executions HEADING EXEC
col sharable_mem heading SHAMEM
col owner format a8
col name format a30
col type format a12
set numwidth 8
ttitle center 'Data Base Objects Owned by All Users Statistics' skip 2
select name, type, sharable_mem, loads, executions, pins
from sys.v_$db_object_cache ;
b.Check reload problem in library cache
select namespace, pins, reloads from v$librarycache;
show parameters shared_pool
select bytes/1024/1024 from v$sgastat where pool='shared pool' and name='free memory';
c.Find the large queries in the shared pool library cache (using > 4mb each)
SELECT sql_text "Stmt", count(*), sum(sharable_mem) "Mem",
sum(users_opening) "Open", sum(executions) "Exec"
FROM v$sql GROUP BY sql_text HAVING sum(sharable_mem) > 4096000;
d.Find objects that can be considered pining into the shared pool
column name format a40
column owner format a15
select owner, name, executions, locks, pins, loads, kept from v$db_object_cache where loads > 10;
create temp table and insert records of candidates to be pinned.
CREATE TABLE LRU_TMP AS SELECT * FROM X$KSMLRU;
INSERT INTO LRU_TMP SELECT * FROM X$KSMLRU;
Use the LRU_TMP table for analysis.
SELECT USERNAME, KSMLRCOM, KSMLRHON, KSMLRNUM, KSMLRSIZ, SQL_TEXT
FROM V$SQLAREA A, LRU_TMP K, V$SESSION S WHERE KSMLRSIZ > 3000
AND A.ADDRESS=S.SQL_ADDRESS AND A.HASH_VALUE = S.SQL_HASH_VALUE
AND SADDR=KSMLRSES;
You can see the candidates to pin from the query below
COL STORED_OBJECT FORMAT A40;
COL SQ_EXECUTIONS FORMAT 999,999;
SELECT /*+ ORDERED USE_HASH(D) USE_HASH(C) */ O.KGLNAOWN||’.'||O.KGLNAOBJ STORED_OBJECT, SUM(C.KGLHDEXC) SQL_EXECUTIONS
FROM SYS.X$KGLOB O, SYS.X$KGLRD D, SYS.X$KGLCURSOR C
WHERE
O.INST_ID = USERENV(’INSTANCE’) AND
D.INST_ID = USERENV(’INSTANCE’) AND
C.INST_ID = USERENV(’INSTANCE’) AND
O.KGLOBTYP IN (7, 8, 9, 11, 12) AND
D.KGLHDCDR = O.KGLHDADR AND
C.KGLHDPAR = D.KGLRDHDL
GROUP BY O.KGLNAOWN, O.KGLNAOBJ
HAVING SUM(C.KGLHDEXC) > 0
ORDER BY 2 DESC;
How to pin object
EXECUTE SYS.DBMS_SHARED_POOL.SIZES(150);
EXECUTE SYS.DBMS_SHARED_POOL.KEEP('SYS.STANDARD');
EXECUTE SYS.DBMS_SHARED_POOL.UNKEEP('SYS.STANDARD');
e.LRU work and objects were loaded and flushed
LRU work in the shared pool KSMLRNUM stores the number of objects that were flushed to load the large object. KSMLRISZ stores the size of the object that was loaded (contiguous memory allocated)
column ksmlrcom format a20
column username format a5
select username,sid,KSMLRCOM,KSMLRSIZ,KSMLRNUM, KSMLRHON, KSMLROHV, KSMLRSES from x$ksmlru , v$session where KSMLRSES=SADDR and KSMLRNUM >2 ;
f.How much are waiting for Library Cache Latch
select count(*),event from v$session_wait where event not like '%SQL%' and event not like '%ipc%' and event not like '%timer%' GROUP BY EVENT;
select count(*),wait_time from v$session_wait where event='latch free' and p2=106 group by wait_time;
select sid,wait_time,seconds_in_wait from v$session_wait where event='latch free' and p2=106 and WAIT_TIME>1;
g.Queries identical but aren’t shared.
SELECT address, hash_value, version_count , users_opening , users_executing,
substr(sql_text,1,240) "SQL" FROM v$sqlarea WHERE version_count > 10;
h.Get Biggest chunk of free memory.
select sysdate, decode( sign(ksmchsiz - 812), -1, (ksmchsiz - 16) / 4,
decode(sign(ksmchsiz - 4012),-1, trunc((ksmchsiz + 11924) / 64),
decode(sign(ksmchsiz - 65548), -1, trunc(1/log(ksmchsiz - 11, 2)) + 238,254))) bucket,
sum(ksmchsiz) free_space, count(*) free_chunks, trunc(avg(ksmchsiz)) average_size,
max(ksmchsiz) biggest from x$ksmsp
where inst_id = userenv('Instance') and ksmchcls = 'free' group by
decode(sign(ksmchsiz - 812),-1, (ksmchsiz - 16) / 4,
decode(sign(ksmchsiz - 4012),-1, trunc((ksmchsiz + 11924) / 64),
decode(sign(ksmchsiz - 65548),-1, trunc(1/log(ksmchsiz - 11, 2)) + 238,254 ))) ;
SELECT KSMCHCLS CLASS, COUNT(KSMCHCLS) NUM, SUM(KSMCHSIZ) SIZ,
To_char( ((SUM(KSMCHSIZ)/COUNT(KSMCHCLS)/1024)),’999,999.00′)||’k’ “AVG SIZE”
FROM X$KSMSP GROUP BY KSMCHCLS;
CLASS NUM SIZ AVG SIZE
freeabl 19010 34519404 1.77k
recr 23581 24967956 1.03k
R-freea 68 1632 .02k
perm 22 39801268 1,766.75k
R-free 34 7238192 207.90k
free 2389 36075980 14.75k
Watch for trends using these guidelines:
a) if ‘free’ memory is low (less than 5mb or so) you may need to increase the shared_pool_size and shared_pool_reserved_size. You should expect ‘free’ memory to increase and decrease over time. Seeing trends where ‘free’ memory decreases consistently is not necessarily a problem, but seeing consistent spikes up and down could be a problem.
b) if ‘freeable’ or ‘perm’ memory continually grows then it is possible you are seeing a memory bug.
c) if ‘freeabl’ and ‘recr’ memory classes are always huge, this indicates that you have a lot of cursor info stored that is not releasing.
d) if ‘free’ memory is huge but you are still getting 4031 errors, the problem is likely reloads and invalids in the library cache causing fragmentation.
-Note says that this query can hang database on HP platforms
See the shared pool parameters
column name format a30
select name,value from v$parameter where name like '%shared_pool%' ;
select x.ksppinm, y.ksppstvl from x$ksppi x , x$ksppcv y where x.indx = y.indx and lower(x.ksppinm) like '%spin%';
SELECT count(*) FROM v$latch_children WHERE NAME = 'library cache';
Shrinking and growing operations from V$SGA_RESIZE_OPS dynamic view:
select to_char(end_time, ‘dd-Mon-yyyy hh24:mi’) end, oper_type, initial_size, target_size, final_size from V$SGA_RESIZE_OPS where component=’shared pool’ order by end;
#shared_pool_summary.sql -get an overview of chunks in the shared pool
select
ksmchcom contents,
count(*) chunks,
sum(decode(ksmchcls, 'recr', ksmchsiz)) recreatable,
sum(decode(ksmchcls, 'freeabl', ksmchsiz)) freeable,
sum(ksmchsiz) total
from
sys.x_$ksmsp
where
inst_id = userenv('Instance') and
ksmchcls not like 'R%'
group by
ksmchcom
#reserved_pool_summary.sql - get an overview of chunks in the reserved pool
select
ksmchcom contents,
count(*) chunks,
sum(decode(ksmchcls, 'R-recr', ksmchsiz)) recreatable,
sum(decode(ksmchcls, 'R-freea', ksmchsiz)) freeable,
sum(ksmchsiz) total
from
sys.x_$ksmspr
where
inst_id = userenv('Instance')
group by
ksmchcom
#save_sqlplus_settings.sql -reset sqlplus settings
set termout off
store set sqlplus_settings replace
clear breaks
clear columns
clear computes
set feedback off
set verify off
set termout on
set define "&"
#restore_sqlplus_settings.sql -reset sqlplus settings
set termout off
@sqlplus_settings
clear breaks
clear columns
clear computes
set termout on
i.Check the shared pool reserved size status
SELECT free_space, avg_free_size, used_space, avg_used_size, REQUEST_MISSES, request_failures, last_miss_size FROM v$shared_pool_reserved;
An ORA-04031 error referencing large failed requests, indicates the Reserved Area is too fragmented. The reserved pool is small when: REQUEST_FAILURES > 0 (and increasing), The DBA should Increase shared_pool_reserved_size and shared_pool_size together. It is possible that too much memory has been allocated to the reserved list. The DBA should Decrease shared_pool_reserved_size, If: REQUEST_MISS = 0 or not increasing
FREE_MEMORY = > 50% of shared_pool_reserved_size minimum
col free_space for 999,999,999,999 head “TOTAL FREE”
col avg_free_size for 999,999,999,999 head “AVERAGE|CHUNK SIZE
col free_count for 999,999,999,999 head “COUNT”
col request_misses for 999,999,999,999 head “REQUEST|MISSES
col request_failures for 999,999,999,999 head “REQUEST|FAILURES”
col max_free_size for 999,999,999,999 head “LARGEST CHUNK”
select free_space, avg_free_size, free_count, max_free_size, request_misses, request_failures from v$shared_pool_reserved;
TOTAL FREE AVERAGE
CHUNK SIZE COUNT LARGEST CHUNK REQUEST
MISSES REQUEST
FAILURES
7,238,192 212,888 34 212,888 0 0
You should also use hidden and unsupported parameter “_shared_pool_reserved_pct” to control reserved pool. This parameter controls the allocated percentage of shared pool for reserved pool. By default it is %5 of the shared pool and if you use ASMM for memory management you can set this value higher like 10 to allocate reserved pool dynamically. When you set the parameter you will see the shared_pool_reserved_size parameter will be adjusted to the new setting. The parameter can not be modified when instance is started. You can use the query below to see the current value
select a.ksppinm “Parameter”, b.ksppstvl “Session Value”, c.ksppstvl “Instance Value” from sys.x$ksppi a, sys.x$ksppcv b, sys.x$ksppsv c where a.indx = b.indx and a.indx = c.indx and a.ksppinm = ‘_shared_pool_reserved_pct’;
Parameter Session Value Instance Value
sharedpool_reserved_pct 10 10
j.When having multiple subheaps:
select KSMCHIDX, ksmchcom ChunkComment,
decode(round(ksmchsiz/1000),0,'0-1K', 1,'1-2K', 2,'2-3K', 3,'3-4K',4,'4-5K',5,'5-6k',6,'6-7k',7,'7-8k',8,'8-9k', 9,'9-10k', '> 10K'), count(*), ksmchcls Status, sum(ksmchsiz) Bytes
from x$ksmsp where KSMCHCOM = 'free memory' group by KSMCHIDX,ksmchcom, ksmchcls, decode(round(ksmchsiz/1000),0,'0-1K', 1,'1-2K', 2,'2-3K', 3,'3-4K',4,'4-5K',5,'5-6k',6,'6-7k',7,'7-8k',8,'8-9k', 9,'9-10k','> 10K');
SubPool SGA_HEAP CHUNKCOMMENT size COUNT(*) STATUS BYTES
1 sga heap(1,0) free memory > 10K 34 R-free 7238192
1 sga heap(1,0) free memory 3-4K 2 free 6284
1 sga heap(1,0) free memory > 10K 241 free 35707400
1 sga heap(1,0) free memory 8-9k 1 free 7712
1 sga heap(1,0) free memory 2-3K 4 free 6752
1 sga heap(1,0) free memory 0-1K 2090 free 133288
1 sga heap(1,0) free memory 9-10k 21 free 188676
1 sga heap(1,0) free memory 1-2K 30 free 25868
If you see lack of large chunks it is possible that you can face with ORA-04031 in near future.
k.Check shared pool at first glance quick diagnostics
select 'You may need to increase the SHARED_POOL_RESERVED_SIZE' Description, 'Request Failures = '||REQUEST_FAILURES Logic
from v$shared_pool_reserved where REQUEST_FAILURES > 0
and 0 != (select to_number(VALUE) from v$parameter
where NAME = 'shared_pool_reserved_size')
union
select 'You may be able to decrease the SHARED_POOL_RESERVED_SIZE' Description,'Request Failures = '||REQUEST_FAILURES Logic
from v$shared_pool_reserved where REQUEST_FAILURES < 5
and 0 != (select to_number(VALUE) from v$parameter
where NAME = 'shared_pool_reserved_size')
l.Memory Usage - object list level view
• Owner - Owner of the object
• Object - Name/namespace of the object
• Sharable Memory - Amount of sharable memory in the shared pool consumed by the object
select OWNER, NAME||' - '||TYPE object,SHARABLE_MEM
from v$db_object_cache where SHARABLE_MEM > 10000
and type in ('PACKAGE','PACKAGE BODY','FUNCTION','PROCEDURE')
order by owner asc ,SHARABLE_MEM desc
SELECT * FROM (SELECT ROW_NUMBER () over (PARTITION BY NAMESPACE ORDER BY SHARABLE_MEM DESC) ROW_within , NAMESPACE, SHARABLE_MEM, SUBSTR(NAME,1,40) NAME FROM V$DB_OBJECT_CACHE ORDER BY SHARABLE_MEM DESC) WHERE ROW_WITHIN <= 2 ORDER BY NAMESPACE, ROW_WITHIN;
ROW_WITHIN NAMESPACE SHARABLE_MEM NAME
1 CLUSTER 2794 C_OBJ#_INTCOL#
2 CLUSTER 1684 SMON_SCN_TO_TIME
1 RSRCPLAN 5117 SYS_GROUP -
Hi, all.
"shared pool free memory" from v$sgastat include "SHARED_POOL_RESERVED_SIZE" ??
For example,
select * from v$sgastat
where pool ='shared pool'
and name like 'free memory'
assuming that the result of the above query is about 100Megabytes
and "SHARED_POOL_RESERVED_SIZE" is 50Megabytes,
"100 M free memory" in shared pool includes 50M (reserved area)??
Thanks and Regards.
Message was edited by:
user507290Shortly after the database starts up, some of the 'shared_pool_reserved_size' will probably be in use, although quite a lot of it may still be free; so you cannot say (directly) how much of the "free memory" belongs in the reserved area and how much comes from the rest of the shared pool.
However, there is a view called v$shared_pool_reserved that tells you how much of the reserved area is currently free (and gives various other statisics about the pool's use). There are some versions of Oracle where the definition of this view is wrong, though - possibly in the lower 9i versions.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk -
Shared Pool: KGH No ACCESS Is Very High
if you run the following query it shows you a very high value for KGH NO ACCESS (around 5GB)
select * from v$sgastat where pool = 'shared pool' and (name in ('free memory', 'sql area', 'library cache', 'miscellaneous', 'row cache', 'KGH: NO ACCESS') )
that KGH means?Hi,
As you have sga_target, ASMM is enabled and could be the cause of high KGH No Access. Have a look at
Common Cause for ORA-4031 in 10gR2, Excess "KGH: NO ACCESS" Memory Allocation [Video] (Doc ID 801787.1)
Anand -
Find below a modified version of a script retrieved from Metalink 146599.1 to check for shared pool fragmentation
I am not sure if it is possible, but is there any way to incorporate into this script a query that will show the effectiveness of using an ALTER SYSTEM FLUSH SHARED_POOL command .
select bucket, freespace,
ROUND(ratio_to_report(freespace) over () * 100, 5) AS "Percentage"
from
(select '0 (<140)' BUCKET, sum(KSMCHSIZ) freespace
from x$ksmsp
where KSMCHSIZ<140
and KSMCHCLS='free'
UNION ALL
select '1 (140-267)' BUCKET, sum(KSMCHSIZ) freespace
from x$ksmsp
where KSMCHSIZ between 140 and 267
and KSMCHCLS='free'
UNION ALL
select '2 (268-523)' BUCKET, sum(KSMCHSIZ) freespace
from x$ksmsp
where KSMCHSIZ between 268 and 523
and KSMCHCLS='free'
UNION ALL
select '3-5 (524-4107)' BUCKET, sum(KSMCHSIZ) freespace
from x$ksmsp
where KSMCHSIZ between 524 and 4107
and KSMCHCLS='free'
UNION ALL
select '6+ (4108+)' BUCKET, sum(KSMCHSIZ) freespace
from x$ksmsp
where KSMCHSIZ >= 4108
and KSMCHCLS='free');Running this SQL, flushing the shared pool, and the re-running should show what the difference before and after is - or does this not suffice?
Flushing the shared pool is also not really addressing the root cause - which most often is non-sharable SQL.
Thus I'm not exactly sure what you're trying to achieve here. The SQL identifies the symptoms - flushing the shared pool treats those symptoms. For a while.
Surely you should rather be looking at the shared pool itself to determine what the problem is and try and fix that instead? A db logon trigger for a poorly written app can for example force cursor sharing for all sessions created by that app. -
Packaged procedures in shared pool?
I have a question. Maybe someone can help me.
When I call a standalone stored procedure, this is loaded in the shared pool and it is available for other users too. That's right, I think.
But what about a packaged procedure? When I call one of the elements declared in the package spec the whole package is loaded in memory. It seems to me that is only for my session. Or is a package, including it's subprograms and global declared variables, also loaded in the shared pool and available for other users, after it is called by a user?> It seems to me that is only for my session.
What test is that based on?
> Or is a package, including its subprograms and global declared variables, also loaded in the shared pool and available for other users, after it is called by a user?
Yes. -
Hi,
Because I use RMAN I decided to configure Large Pool. It is said, that RMAN should use this area if it's defined. But im my system statistics for LargePool are constant - there is always only empty space, no blocks are allocated by RMAN. Could someone tell me what's wrong? Why my RMAN still uses shared pool and no large?
Regards,
Kubathat was an interesting question, after checking in metalink this seems to be myth that if you configure large_pool rman will use it. (the problem with oracle documentation is it conveniently forgets to qualify the conditions).
"The LARGE_POOL is only used if I/O Slaves are specified by one or both of the initialization parameters DBWR_IO_SLAVES or BACKUP_TAPE_IO_SLAVES."
so in your case may be you have not using these parameters, that maybe the reason why RMAN is not using Large_pool.
check metalink note : 134214.1 for more RMAN myths.
which leaves us wondering...why can't these information be made available in the public documentation in the form of short notes or caveats??? -
Difference between cisco shared support and standard warranty
Dear Sirs,
would you please explain me difference between cisco shared support and cisco standard warranty? For example for model Cisco 881?
I heard that Gold Partners of Cisco can not sell products with standart warranty, only with shared support and the price is higher because of it, is it possible?
Thank you.Hello Iakov Mozalev,
Thank you for bringing this to our attention
We would like to inform you that you may reach the Partner Helpline or Presales for further assistance regarding the difference of Cisco Shared Support and Cisco Standard Warranty, For example for model Cisco 881.
Please contact Partner Helpline or Presales at 1-800-553-6387 options 5,1and 1. We hope that we have answered your query.
Thank you and Have a great day!
Best Regards,
Jen
CCW Support Team -
Shared pool cluttered ... ?
Hi,
Notes from Sr.DBA:
Yesterday evening , production operator called me to inform that one of the regular processing was hanging on webash server.
When I analyzed , found that shared pool is totally cluttered and tens of thousands of same program scripts lying in shared pool. I cleared the shared pool and restarted the regular processing.
Please let me know how to find the shared pool is cluttered and tens of thousands of same program scripts lying in shared pool ? Thanks.Your solution is in the first answer of Tom's link Below. This normally happens when you are not using bind variables which increasing your parsing time. This is a very good link. I had used this link to resolve same kind of problem. If it turns out to be bind variables issue, you will need to fix the application code and that will be the right fix. Check this link.
The output of the function in this link will show you all the identical statements in the shared pool after all the literals have been removed.
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1163635055580
You have so many unanswered questions in your profile. Please mark this question answered if you have your question answered to keep your forum clean. -
Problem in SAP Query will displaing the curency and quentity values
Hi Gurus,
I had copied one query which is having currency and quantity values and displaying with out unit of measurement, And in my copied query i and able to see unit of measure automatically while executing the query.How to remove this .
Thanks and regards
Ravinder Elagamsolved by myself
Maybe you are looking for
-
How to avoid creation of _(file.*), coping from tiger to pc?
how to avoid the creation of this file for ever on a pc environment?? I explain: as i copy any image file, it goes to a spooler directory and that begins instantly to process the file to an OPI server, separating CMYK channels, converting it to high
-
Touch can not be read from or written to
After upgrading to iTunes 7.7.1 and iPod 2.0, I can not sync at all anymore. I get an error window telling me that my sync failed because my iPod Touch can not be read from or written to. I applied the "5 Rs" troubleshooting tips, to no avail. (5 Rs
-
Music alarm clock battery draining
I like to be wake up in the morning by music and in windows8 I can choose music for alarm but sound volume cannot be regulated(too loud for me). So I installed aplication music alarm where sound volume for alarm can be regulated but it drain my batte
-
Hi all, What is the logical system name? Is it the same "source system name"? It shows when I try to create a R3 datasource in BW. Thank you. Thank you for everyone who answered my questions before. I assigned the points to you and didn't get chance
-
Bat file to Start Service.
Hi All, I need a bat file to restart one of the service when user login to the PC. These users are not local admins so they cannot start this service. net start "Service Updater" give and access denied. This service have to run as SUser not as