[Oracle] 오라클 성능 관리 > AutoTrace

개발자 | 2012. 2. 20. 16:46

AutoTrace 결과에는 SQL을 튜닝하는데 유용한 정보들이 많이 포함되어 있어 가장 즐겨 사용되는 도구 중 하나다.

쿼리수행결과, 실행계획, 실행통계

  1. set autotrace on : SQL실제수행 + 결과 + 실행계획 + 실행통계
  2. set autotrace on explain : SQL 실제수행 + 결과 + 실행계획
  3. set autotrace on statistics : SQL실제수행+결과+실행통계
  4. set autotrace traceonly : SQL 실제수행 + 실행계획 + 실행통계
  5. set autotrace traceonly explain : 실행계획
  6. set autotrace traceonly statistics SQL 실제수행 + 실행통계

# 실행통계까지 함께 확인하려면 v_$sesstat, v_$statname, v_$mystat 뷰에 대한 읽기 권한 필요

SQL> @?/sqlplus/admin/plustrce.sql
SQL> grant plustrace to scott;

# statistics 모드로 AutoTrace를 활성화시키면 새로운 세션이 하나 열리면서 현재 세션의 통계정보를 대신 쿼리해서 보여준다.
만약 같은 세션에서 수행한다면 세션통계를 쿼리할 때의 수행통계까지 뒤섞이기 때문에 별도의 세션을 사용하는 것.

AutoTrace 와 SQL Trace - TKProf

* db block gets = current : Current 모드에서 읽은 버퍼 블록 수
* consistent gets = query : Consistent 모드에서 읽은 버퍼 블록 수
* physical reads = disk : 디스크로 부터 읽은 블록 수
* SQL*Net roundtrips to/from client = fetch count 
* rows processed = fetch rows

cr = consistent 모드 블록 읽기
pr = 디스크 블록 읽기
pw = 디스크 블록 쓰기
time = 소요시간(us=microsecond)

 

# alter session set sql_trace = true
트레이스 파일 정보 (. trc)

,