statspack이란?
데이터베이스의 performance 관련 데이터를 수집하는데 필요한 *.sql file과 package를 말한다.
statspack의 snapshot level
level 0 : General performance
5 : level0 + sql 에대한 정보 (default)
6 : level5 + sql 상세 실행계획
7 : level6 + segment-level statistics
10: level7 + parent and child latches
v$segment_statistics : 문제의 주범(?)을 쉽게 찾을 수 있게해주는 view
statistics의 level을 7이상 해 놓으면 v$segment_statistics의 내용을 남김.
statspack사용시 고려해야 할 사항.
- statistics_level = typical
- timed_statistics + true
- 수집 기간을 적당하게 줄 것.
Load Profile Section
- 특정 application의 특징들을 볼 수 있다.
- 잠재적 문제를 확인할 수 있다.
- baseline이 있을 경우 효용성이 큼.
statspack 생성 실습(snapshot 수집, report 생성 포함)
OS] export ORACLE_SID=orcl
OS] sqlplus / as sysdba
OS] sqlplus / as sysdba
SQL> shutdown abort
SQL> startup
SQL> startup
SQL> define _editor=vi
SQL> !ls $ORACLE_HOME/rdbms/admin/sp* -- statspack과 관련된 script들을 볼 수 있다.
SQL> !ls $ORACLE_HOME/rdbms/admin/sp* -- statspack과 관련된 script들을 볼 수 있다.
SQL> ed /u01/app/oracle/product/10.2.0/db_1/rdbms/admin/spcreate.sql
SQL> @?/rdbms/admin/spcreate.sql
Enter value for perfstat_password: pertstat
Enter value for default_tablespace: enter -- default는 system tablespace임
Enter value for temporary_tablespace: enter
SQL> show user -- perfstat user가 생성되고, 그 유저로 접속된 것을 확인할 수 있다.
USER is "PERFSTAT"
USER is "PERFSTAT"
SQL> col object_name format a40
SQL> select object_name, object_type
from user_objects order by 2;
SQL> select object_name, object_type
from user_objects order by 2;
SQL> desc statspack
SQL> col name format a30
SQL> select * from stats$sga;
SQL> col name format a30
SQL> select * from stats$sga;
SQL> exec statspack.snap -- snapshot 수집
SQL> select * from stats$sga;
SQL> select * from stats$sga;
SQL> variable no number
SQL> exec :no := statspack.snap
SQL> print no
NO
----------
12
SQL> exec :no := statspack.snap
SQL> print no
NO
----------
12
SQL> @?/rdbms/admin/spreport.sql -- 만들어진 snapshot을 토대로 report를 생성
시작 snapshot과 끝 snapshot을 설정후 report 이름을 차례로 입력해 준다.
시작 snapshot과 끝 snapshot을 설정후 report 이름을 차례로 입력해 준다.
Instance DB Name Snap Id Snap Started Level Comment
------------ ------------ --------- ----------------- ----- --------------------
orcl ORCL 1 15 Jan 2010 14:15 5
2 15 Jan 2010 14:16 5
3 15 Jan 2010 14:17 5
11 15 Jan 2010 14:18 5
12 15 Jan 2010 14:19 5
------------ ------------ --------- ----------------- ----- --------------------
orcl ORCL 1 15 Jan 2010 14:15 5
2 15 Jan 2010 14:16 5
3 15 Jan 2010 14:17 5
11 15 Jan 2010 14:18 5
12 15 Jan 2010 14:19 5
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1
Enter value for end_snap: 3
Enter value for report_name: first_report.lst
SQL> exit
OS] vi first_report.lst
OS] vi first_report.lst
statspack 삭제실습(spdrop.sql script를 실행)
SQL> @?/rdbms/admin/spdrop.sql
그 외의 script 및 기타 사항들
- sppurge.sql : 의미없는 데이터는 사라진다.
- sptruncate.sql : snapshot을 지움.
- exp perfstat/perfstat parfile=spuexp.par : spuexp.par 파일은 export 시의 파일에 부여할 수 있는 여러 옵션들이 저장되어 있음.
참조 : http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/statspac.htm#29200
http://www.oracleclub.com/lecture/1915
http://www.yes24.com/24/goods/291430
http://blog.daum.net/_blog/BlogView.do?blogid=08n3a&articleno=14734688&_bloghome_menu=recenttext#ajax_history_home
http://extremedb.blogspot.com/2008/02/statspack.html
'Oracle > Tuning' 카테고리의 다른 글
Reactive Tuning (EM의 performance page) (0) | 2010.01.16 |
---|---|
AWR & ADDM & ASH (0) | 2010.01.15 |
Metrics, Alerts and Metric Baselines (0) | 2010.01.14 |
[펌]SQL*TRACE와 TKPROF (0) | 2010.01.13 |
Statistics, Waits (0) | 2010.01.13 |