SlideShare uma empresa Scribd logo
1 de 5
Anar Godjaev
http://anargodjaev.wordpress.com/
Tuning Shared Pool& Tuning Large Pool
Shared pool includes cursors, sql statements, plsql blocks which are
parsed/executed and stored/cached in memory. It is important to optimize
theplsql blocks and/or sql commands so sessions can use the same commands
without parsing but only executing the statements. This improves the
application response times. Hints to optimize your sql code will be given
in the following sections.
There are also some system paramters that you can decide to set (or not to
set) to improve your instance performance. These parameters are covered
below.
--- system wide statistics for parsing
--- the statement sent for parsing and
statement is not really parsed
select* from v$sysstatwhere name like
-- the count for sql parses
select* from v$sysstatwhere name like
-- the count for sql executions
select* from v$sysstatwhere name like

and execution of statements
found in cursor cache, this means the
'session cursor cache hits';
'parse count (total)';
'execute count';

--- the real parse count for executions
-- desired result should be as close as to zero
-selecttotal_parse/execute_countfrom
(
select (t2.value - t1.value) total_parsefrom v$sysstat t1, v$sysstat t2
wheret1.name='session cursor cache hits'
andt2.name='parse count (total)'
) t1,
(
select value execute_countfrom v$sysstatwhere name='execute count'
) t2;
NOTE:
If the result of the above query is far from zero this means oracle
instance loses some time for parsing the statement instead of executing
them. First action should be reviewing sql statements of the application.
Bind variables should be a proper approach. We will look at database wide
tuning actions.
--- session wide (user level) statistics for parsing and executin of
statements
--- session wide statistics are same as system wide. but there is only
-- a SID column to fetch only the desired session statistics
select
t1.value,
t2.name,
Anar Godjaev
http://anargodjaev.wordpress.com/
t3.sid,
t3.username,
t3.machine
from
v$sesstat t1,
v$statname t2,
v$session t3
where
t1.statistic# = t2.STATISTIC# and
t1.sid = t3.sid and
t2.name in ('session cursor cache hits','parse count (total)','execute
count') and
usernameis not null
order by t3.sid, t1.value desc;
--- look for any cursors cached for a session, and compare with system
parameter
-select
t1.value curr_cached,
t4.value max_cached,
t3.username,
t3.sid,
t3.serial#
from
v$sesstat t1,
v$statname t2,
v$session t3,
v$parameter2 t4
where
t1.statistic# = t2.statistic# and
t1.sid=t3.sid
andt4.name='session_cached_cursors'
andt2.name = 'session cursor cache count';
--- obtaining cache hit ratios of the sqlarea and some other memory
allocations
-select* from v$librarycache;
/*
Desired value for gethitratio is over %90
gets: number of lookups (parse)
pins: number of reads (execution)
reloads: the number of library cache misses
invalidations: if an object is modified
*/
--- comparison for executions and misses from library cache
--- desired value of course should be as small as possible like < %1
select
sum(pins) "executions" ,
sum(reloads) "cache misses" ,
sum(reloads) / sum(pins)
Anar Godjaev
http://anargodjaev.wordpress.com/
from
v$librarycache;
-- examine the sqlarea
-select
t1.sql_text,
t1.users_executing,
t1.executions,
t1.disk_reads,
t1.buffer_gets,
t1.first_load_time,
t2.username
from
v$sqlarea t1,
dba_users t2
where
t1.parsing_user_id = t2.user_id
order by disk_readsdesc;
--- you can examine execution plans of the queries that are currently in
memory
-- and who are running then
-select
t1.hash_value,
t1.operation,
t1.options,
t1.optimizer,
t1.object_owner || '.'|| t1.object_name,
t2.sql_text,
t2.users_executing,
t3.username
from
v$sql_plan t1,
v$sqlarea t2,
v$session t3
where
t1.hash_value = t2.hash_value and
t2.address = t3.sql_address;
---select* from v$rowcache
/*
Gets :numberof requests on objects
Getmisses : number of requests in resulting misses
*/
NOTES
1- You can find out the queries currently in sqlarea. But tuning the sql
statements will be covered later in this document. Nowly we are
concantrated on tuning shared_pool tuning.
2- If you can’t find any cached cursors, you should check for
session_cached_cursors system parameter. Forexample in my test database the
Anar Godjaev
http://anargodjaev.wordpress.com/
following query was returning ‘0’ which means no cursor (statement) is
cached in memory. As a result all the queries of a session were reparsed by
oracle.
--- session_cached_cursors system parameter
-select value from v$parameterwhere name='session_cached_cursors';
alter system set session_cached_cursors=50 scope=spfile;
-- changes will take effect after instance restart
3- Another parameter is cursor_sharing which effects the sql performance in
an instance.
--- cursor_sharinginit parameter
-select name, value from v$parameterwhere name='cursor_sharing';
alter system set cursor_sharing='SIMILAR';
-- alter system set cursor_sharing=''[EXACT|SIMILAR|FORCE]';
4- If you dont have a plenty of memory then you can set the following
parameter for faster execution of some cursors
--- cursor_space_for_time
-select* from v$parameterwhere name='cursor_space_for_time';
alter system set cursor_space_for_time=TRUE scope=spfile;
-- changes will take effect after instance restart
-- available values: [TRUE|FALSE]
5- Dont forget, sometimes you should decrease the value of the
shared_pool_size, check the following;
if
Request_miss = 0 or not increasing
Free_memory>= %50 of the shared_pool_reserved_size
Then
Decrease the size of the shared_pool
End if
list of views for shared_pool management
v$sysstat
v$sesstat
v$statname
v$session
v$sga
v$sgastat
v$librarycache
v$sql //contains one row for each child of the original
sql text same as v$sqlarea but group by clause
v$sqlarea//full statistics about shared cursors
v$sqltext//full sql text without truncation
dba_users
Anar Godjaev
http://anargodjaev.wordpress.com/
v$db_object_cache
v$rowcache
parameters
session_cached_cursors
cursor_sharing
shared_pool_size
shared_pool_reserved_size
cursor_space_for_time
open_cursors
Tuning Large_pool
Used for I/O Processes
Backup and restore operatins
If set in shared server then this will be used for users instead of PGA.
--- changing large_pool_size parameter
-select* from v$parameterwhere name like '%large_pool_size%';
alter system set large_pool_size=50M;

Mais conteúdo relacionado

Mais de Anar Godjaev

how to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaulthow to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaultAnar Godjaev
 
Database Vault / Verinin Güvenliği
Database Vault /  Verinin GüvenliğiDatabase Vault /  Verinin Güvenliği
Database Vault / Verinin GüvenliğiAnar Godjaev
 
Oracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumOracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumAnar Godjaev
 
DataPump ile Single Parititon Export
DataPump ile Single Parititon ExportDataPump ile Single Parititon Export
DataPump ile Single Parititon ExportAnar Godjaev
 
Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Anar Godjaev
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Anar Godjaev
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeAnar Godjaev
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasiAnar Godjaev
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and RecoveryAnar Godjaev
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed FilesAnar Godjaev
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)Anar Godjaev
 
Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Anar Godjaev
 

Mais de Anar Godjaev (20)

how to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaulthow to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vault
 
Database Vault / Verinin Güvenliği
Database Vault /  Verinin GüvenliğiDatabase Vault /  Verinin Güvenliği
Database Vault / Verinin Güvenliği
 
Oracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumOracle 10g Database Server Kurulum
Oracle 10g Database Server Kurulum
 
DataPump ile Single Parititon Export
DataPump ile Single Parititon ExportDataPump ile Single Parititon Export
DataPump ile Single Parititon Export
 
Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇
 
Contraints
ContraintsContraints
Contraints
 
Oracle SQL
Oracle SQLOracle SQL
Oracle SQL
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını Inceleme
 
PL/SQL Blocks
PL/SQL BlocksPL/SQL Blocks
PL/SQL Blocks
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasi
 
Parallel Server
Parallel ServerParallel Server
Parallel Server
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and Recovery
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
LogMiner
LogMinerLogMiner
LogMiner
 
Undo Management
Undo ManagementUndo Management
Undo Management
 
ASM
ASMASM
ASM
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed Files
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)
 
Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Oracle Enterprise Linux 5
Oracle Enterprise Linux 5
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Tuning Shared Pool & Tuning Large Pool

  • 1. Anar Godjaev http://anargodjaev.wordpress.com/ Tuning Shared Pool& Tuning Large Pool Shared pool includes cursors, sql statements, plsql blocks which are parsed/executed and stored/cached in memory. It is important to optimize theplsql blocks and/or sql commands so sessions can use the same commands without parsing but only executing the statements. This improves the application response times. Hints to optimize your sql code will be given in the following sections. There are also some system paramters that you can decide to set (or not to set) to improve your instance performance. These parameters are covered below. --- system wide statistics for parsing --- the statement sent for parsing and statement is not really parsed select* from v$sysstatwhere name like -- the count for sql parses select* from v$sysstatwhere name like -- the count for sql executions select* from v$sysstatwhere name like and execution of statements found in cursor cache, this means the 'session cursor cache hits'; 'parse count (total)'; 'execute count'; --- the real parse count for executions -- desired result should be as close as to zero -selecttotal_parse/execute_countfrom ( select (t2.value - t1.value) total_parsefrom v$sysstat t1, v$sysstat t2 wheret1.name='session cursor cache hits' andt2.name='parse count (total)' ) t1, ( select value execute_countfrom v$sysstatwhere name='execute count' ) t2; NOTE: If the result of the above query is far from zero this means oracle instance loses some time for parsing the statement instead of executing them. First action should be reviewing sql statements of the application. Bind variables should be a proper approach. We will look at database wide tuning actions. --- session wide (user level) statistics for parsing and executin of statements --- session wide statistics are same as system wide. but there is only -- a SID column to fetch only the desired session statistics select t1.value, t2.name,
  • 2. Anar Godjaev http://anargodjaev.wordpress.com/ t3.sid, t3.username, t3.machine from v$sesstat t1, v$statname t2, v$session t3 where t1.statistic# = t2.STATISTIC# and t1.sid = t3.sid and t2.name in ('session cursor cache hits','parse count (total)','execute count') and usernameis not null order by t3.sid, t1.value desc; --- look for any cursors cached for a session, and compare with system parameter -select t1.value curr_cached, t4.value max_cached, t3.username, t3.sid, t3.serial# from v$sesstat t1, v$statname t2, v$session t3, v$parameter2 t4 where t1.statistic# = t2.statistic# and t1.sid=t3.sid andt4.name='session_cached_cursors' andt2.name = 'session cursor cache count'; --- obtaining cache hit ratios of the sqlarea and some other memory allocations -select* from v$librarycache; /* Desired value for gethitratio is over %90 gets: number of lookups (parse) pins: number of reads (execution) reloads: the number of library cache misses invalidations: if an object is modified */ --- comparison for executions and misses from library cache --- desired value of course should be as small as possible like < %1 select sum(pins) "executions" , sum(reloads) "cache misses" , sum(reloads) / sum(pins)
  • 3. Anar Godjaev http://anargodjaev.wordpress.com/ from v$librarycache; -- examine the sqlarea -select t1.sql_text, t1.users_executing, t1.executions, t1.disk_reads, t1.buffer_gets, t1.first_load_time, t2.username from v$sqlarea t1, dba_users t2 where t1.parsing_user_id = t2.user_id order by disk_readsdesc; --- you can examine execution plans of the queries that are currently in memory -- and who are running then -select t1.hash_value, t1.operation, t1.options, t1.optimizer, t1.object_owner || '.'|| t1.object_name, t2.sql_text, t2.users_executing, t3.username from v$sql_plan t1, v$sqlarea t2, v$session t3 where t1.hash_value = t2.hash_value and t2.address = t3.sql_address; ---select* from v$rowcache /* Gets :numberof requests on objects Getmisses : number of requests in resulting misses */ NOTES 1- You can find out the queries currently in sqlarea. But tuning the sql statements will be covered later in this document. Nowly we are concantrated on tuning shared_pool tuning. 2- If you can’t find any cached cursors, you should check for session_cached_cursors system parameter. Forexample in my test database the
  • 4. Anar Godjaev http://anargodjaev.wordpress.com/ following query was returning ‘0’ which means no cursor (statement) is cached in memory. As a result all the queries of a session were reparsed by oracle. --- session_cached_cursors system parameter -select value from v$parameterwhere name='session_cached_cursors'; alter system set session_cached_cursors=50 scope=spfile; -- changes will take effect after instance restart 3- Another parameter is cursor_sharing which effects the sql performance in an instance. --- cursor_sharinginit parameter -select name, value from v$parameterwhere name='cursor_sharing'; alter system set cursor_sharing='SIMILAR'; -- alter system set cursor_sharing=''[EXACT|SIMILAR|FORCE]'; 4- If you dont have a plenty of memory then you can set the following parameter for faster execution of some cursors --- cursor_space_for_time -select* from v$parameterwhere name='cursor_space_for_time'; alter system set cursor_space_for_time=TRUE scope=spfile; -- changes will take effect after instance restart -- available values: [TRUE|FALSE] 5- Dont forget, sometimes you should decrease the value of the shared_pool_size, check the following; if Request_miss = 0 or not increasing Free_memory>= %50 of the shared_pool_reserved_size Then Decrease the size of the shared_pool End if list of views for shared_pool management v$sysstat v$sesstat v$statname v$session v$sga v$sgastat v$librarycache v$sql //contains one row for each child of the original sql text same as v$sqlarea but group by clause v$sqlarea//full statistics about shared cursors v$sqltext//full sql text without truncation dba_users
  • 5. Anar Godjaev http://anargodjaev.wordpress.com/ v$db_object_cache v$rowcache parameters session_cached_cursors cursor_sharing shared_pool_size shared_pool_reserved_size cursor_space_for_time open_cursors Tuning Large_pool Used for I/O Processes Backup and restore operatins If set in shared server then this will be used for users instead of PGA. --- changing large_pool_size parameter -select* from v$parameterwhere name like '%large_pool_size%'; alter system set large_pool_size=50M;