|
$ sqlplus system/manger
SQL> select name,value from v$sysstat
2 where name like 'sorts%';
NAME VALUE
---------------------------------------------------------------- ----------
sorts (memory) 17833
sorts (disk) 0
sorts (rows) 128722
<-- ÀÌ sessionÀº ±×´ë·Î µÐ »óÅ¿¡¼
2. sh/sh session À» »õ·Ó°Ô open ÇÏ¿© Disk sort¸¦ À¯¹ßÇÑ´Ù.
$ sqlplus sh/sh
SQL> alter session set sort_area_size=512;
SQL> !cat $HOME/LABS/ptw9i/lab07_02.sql
select * from dba_objects
order by object_id;
SQL> @$HOME/LABS/ptw9i/lab07_02.sql
<-- ³¯¼¾´Ù.. ¸¸¾à ¿©±â¼ error°¡ ³´Ù¸é temp tbsÀÇ size°¡ À۱⠶§¹®ÀÌ´Ù.
alter database tempfile '$HOME/dbs/temp01.dbs' resize 20M;
<-- ÀÌ sessionÀº ±×´ë·Î µÐ´Ù.
-----------------------------------------------------------
2-1. disk sort¸¦ À¯µµÇÏ´Â µ¿¾È system user session À¸·Î À̵¿ÇÏ¿© ´ÙÀ½À» query ÇÑ´Ù.
- ÁøÇàÁß query ÇÏ°í ³¡³ª¸é ¶Ç!
SQL> select tablespace_name,current_users,used_extents,free_extents
2 from v$sort_segment;
TABLESPACE_NAME CURRENT_USERS USED_EXTENTS FREE_EXTENTS
------------------------------- ------------- ------------ ------------
TEMP 0 0 0
------------------------------------------------------------
3. ´Ù½Ã system/manager sessionÀ¸·Î À̵¿ÇÏ¿© ÀÌÀü sorts (memory), sorts(disk)¿Í ºñ±³ÇÑ´Ù.
¶ÇÇÑ V$SORT_SEGMENT¸¦ Á¶È¸ÇÑ´Ù.
SQL> select name,value from v$sysstat
2 where name like 'sorts%';
NAME VALUE
---------------------------------------------------------------- ----------
sorts (memory) 17988
sorts (disk) 0
sorts (rows) 136304 <--- ÀÌ sessionµµ ±×µ¥·Î µÐ´Ù.
4. ´Ù½Ã sh/sh session À¸·Î À̵¿ÇÏ¿© Memory sort¸¦ À¯µµÇϱâ À§ÇØ sort_area_size¸¦ ´Ã·Á º»´Ù.
SQL> alter session set sort_area_size = 512000;
SQL> @LABS/ptw9i/lab07_02.sql
5. system/manager ·Î À̵¿ÇÏ¿©
SQL> select name,value from v$sysstat
2 where name like 'sorts%';
NAME VALUE
---------------------------------------------------------------- ----------
sorts (memory) 18045
sorts (disk) 0
sorts (rows) 143750
6. system/manager session À¸·Î À̵¿ÇÏ¿© ÀÚµ¿ PGA ¸Þ¸ð¸®¿¡ ´ëÇÑ parameter¸¦ ±¸¼ºÇÑ´Ù.
SQL> alter system set pga_aggregate_target = 10M;
SQL> alter system set workarea_size_policy = auto;
|