manul PGA下sort_area*需設定兩次問題
作者: 絃樂之花 | 可以轉載, 但必須以超連結形式標明文章原始出處和作者資訊及版權宣告
網址http://shiri512003.itpub.net/post/37713/496824
[@more@]這個問題首先由eagle提出,相關連結為http://www.dbafan.com/blog/?p=295#comment-38424
這裡只是自己在10204linux平臺上測試一下
相關指令碼
-- 指令碼取自tom 9i&10g程式設計藝術P172-173
-- reset_stat.sql
drop table sess_stats;
create table sess_stats
( name varchar2(64), value number, diff number );
variable sid number
exec :sid := &1
-- watch_stat.sql
merge into sess_stats
using
(
select a.name, b.value
from v$statname a, v$sesstat b
where a.statistic# = b.statistic#
and b.sid = :sid
and (a.name like '%ga %'
or a.name like '%direct temp%')
) curr_stats
on (sess_stats.name = curr_stats.name)
when matched then
update set diff = curr_stats.value - sess_stats.value,
value = curr_stats.value
when not matched then
insert ( name, value, diff )
values
( curr_stats.name, curr_stats.value, null )
/
select *
from sess_stats
order by name;
測試表t1
SQL>!ora size t1
Session altered.
OWNER SEGMENT_NAME SEGMENT_TYPE SIZE_MB
---------- ------------ ------------------ ----------
mytest t1 TABLE 222
場景1:sort_area_size只設定一次情況
sess1:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
SQL>select sid from v$mystat where rownum=1;
SID
----------
1083
sess2:
SQL>@reset_stat
Table dropped.
Table created.
Enter value for 1: 1083
PL/SQL procedure successfully completed.
SQL>@watch_stat
6 rows merged.
NAME VALUE DIFF
---------------------------------------------------------------- ---------- ----------
physical reads direct temporary tablespace 0
physical writes direct temporary tablespace 0
session pga memory 560728
session pga memory max 560728
session uga memory 224176
session uga memory max 224176
6 rows selected.
sess1:
SQL>show parameter sort_area
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sort_area_retained_size integer 0
sort_area_size integer 1048576
SQL>alter session set workarea_size_policy=manual;
Session altered.
SQL>alter session set sort_area_size = 300000000;
Session altered.
SQL>set autot trace stat
SQL>select * from t1 order by 1;
819960 rows selected.
Statistics
----------------------------------------------------------
207 recursive calls
98 db block gets
28031 consistent gets
32815 physical reads
0 redo size
108280270 bytes sent via SQL*Net to client
90681 bytes received via SQL*Net from client
8201 SQL*Net roundtrips to/from client
0 sorts (memory)
1 sorts (disk) -- 注意到這裡是disk sort
819960 rows processed
sess2:
SQL>@watch_stat
6 rows merged.
NAME VALUE DIFF
---------------------------------------------------------------- ---------- ----------
physical reads direct temporary tablespace 32813 32813
physical writes direct temporary tablespace 32813 32813
session pga memory 757336 196608
session pga memory max 2264664 1703936 -- 注意到這裡diff只有1M+
session uga memory 289584 65408
session uga memory max 1728560 1504384
6 rows selected.
場景2:sort_area_size設定兩次情況
sess1:
SQL>select sid from v$mystat where rownum=1;
SID
----------
1083
SQL>show parameter sort_area
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sort_area_retained_size integer 0
sort_area_size integer 1048576
sess2:
SQL>@reset_stat
Table dropped.
Table created.
Enter value for 1: 1083
PL/SQL procedure successfully completed.
SQL>@watch_stat
6 rows merged.
NAME VALUE DIFF
---------------------------------------------------------------- ---------- ----------
physical reads direct temporary tablespace 0
physical writes direct temporary tablespace 0
session pga memory 691800
session pga memory max 1019480
session uga memory 231664
session uga memory max 674912
6 rows selected.
sess1:
SQL>alter session set workarea_size_policy=manual;
Session altered.
SQL>alter session set sort_area_size = 300000000;
Session altered.
SQL>alter session set sort_area_size = 300000000;
Session altered.
SQL>set autot trace stat
SQL>select * from t1 order by 1;
819960 rows selected.
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
28031 consistent gets
0 physical reads
0 redo size
108392579 bytes sent via SQL*Net to client
90681 bytes received via SQL*Net from client
8201 SQL*Net roundtrips to/from client
1 sorts (memory) -- 注意到這裡已經是memory sort了
0 sorts (disk)
819960 rows processed
sess2:
SQL>@watch_stat
6 rows merged.
NAME VALUE DIFF
---------------------------------------------------------------- ---------- ----------
physical reads direct temporary tablespace 0 0
physical writes direct temporary tablespace 0 0
session pga memory 757336 65536
session pga memory max 223841880 222822400 --注意到這裡diff值已經是220M左右了,接近於表大小
session uga memory 289584 57920
session uga memory max 222938416 222263504
6 rows selected.
不知道這個問題是否有官方說明?
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7591490/viewspace-1031285/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 近期整理(二)--pga,sga設定問題的兩個診斷案例
- Quartz在weblogic下初始化兩次問題quartzWeb
- Windows 下設定archive的問題WindowsHive
- 兩個關於許可權設定的問題思考
- TOMCAT下設定上下文問題,急!!Tomcat
- Linux 下kernel.shmmax 的設定問題LinuxHMM
- jiveHome設定問題
- shmmax的設定問題HMM
- 如何設定新資料庫的PGA值資料庫
- pga_aggregate_target的設定 (zt)
- STM32埠IO方向設定問題的IO方向設定問題
- Fastclick 導致click事件觸發兩次的問題AST事件
- 多使用者環境下GOPATH的設定問題Go
- 關於Linux 下kernel.shmmax 的設定問題 。LinuxHMM
- PGA的實際管理,設定和最佳化
- tomcat高訪問設定問題Tomcat
- zotero的同步設定問題
- 一個網路卡下設定兩個ip地址
- 記一次 Dcat-admin 圖表設定高度遇到的問題
- memory_target、sga_target、pga_target的設定
- 兩次pta題目總結
- 設定flex後子元素設定寬度失效問題Flex
- Django的時區設定問題Django
- 關於jive的設定問題
- 防火牆設定的小問題防火牆
- 【環境踩坑】ubuntu下jupyter的環境設定問題Ubuntu
- Windows下設定elacticsearch 訪問密碼Windows密碼
- android設定軟鍵盤搜尋鍵以及監聽搜尋鍵點選時發生兩次事件的問題解決Android事件
- WPF --- 觸控式螢幕下的兩個問題
- 解決mac系統下無法手動設定ip的問題Mac
- dhtmlxgrid兩問題HTML
- 【TUNE_ORACLE】PGA_AGGREGATE_LIMIT詳解(三)PGA_AGGREGATE_LIMIT的大小設定OracleMIT
- scrapy 一些設定和問題
- Sublime Text2 Svn設定問題
- Android APN的設定問題薦Android
- Oracle歸檔引數設定問題Oracle
- SQL Server的安全設定問題解答SQLServer
- 兩個引數設定