원문: http://www.akadia.com/services/ora_statspack_survival_guide.html
원문을 번역한것은 아니며, 원문을 참고하여, statspack을 설치, 구성하였음.
oracle STATSPACK의 설치와 보고서 생성.
1. statspack이 사용할 테이블 스페이스(perfstat) 생성.
SQL> create tablespace perfstat
2 datafile ‘/ora_data/stats_pack/perfstat.dbf’ size 1000M reuse
3 extent management local uniform size 512k
4 segment space management auto
5 permanent
6 online;
reuse 옵션: 해당 위치에 동일한 파일이 있는 경우 그 화일을 재사용. 옵션 사용하기전에 확인해야 할듯.
2. 설치스크립트가 있는곳($ORACLE_HOME/rdbms/admin)으로 이동하여 설치 시작한다. 비밀번호는 perfstat, 사용할테이블 스페이스는 이전에 생성한 perfstats, temporary 테이블스페이스는 temp 를 사용한다.
SQL> start spcreate.sql
Choose the PERFSTAT user’s password
———————————–
Not specifying a password will result in the installation FAILINGEnter value for perfstat_password: perfstat
perfstatChoose the Default tablespace for the PERFSTAT user
—————————————————
Below is the list of online tablespaces in this database which can
store user data. Specifying the SYSTEM tablespace for the user’s
default tablespace will result in the installation FAILING, as
using SYSTEM for performance data is not supported.Choose the PERFSTAT users’s default tablespace. This is the tablespace
in which the STATSPACK tables and indexes will be created.TABLESPACE_NAME CONTENTS STATSPACK DEFAULT TABLESPACE
—————————— ——— —————————-
EXAMPLE PERMANENT
PERFSTAT PERMANENT
SNOWFOX PERMANENT
SYSAUX PERMANENT *
USERS PERMANENTPressing <return> will result in STATSPACK’s recommended default
tablespace (identified by *) being used.Enter value for default_tablespace: PERFSTAT
Using tablespace PERFSTAT as PERFSTAT default tablespace.
Choose the PERFSTAT user’s Temporary tablespace.
TABLESPACE_NAME CONTENTS DB DEFAULT TEMP TABLESPACE
—————————— ——— ————————–
SNOWFOX_TEMP TEMPORARY
TEMP TEMPORARY *Pressing <return> will result in the database’s default Temporary
tablespace (identified by *) being used.Enter value for temporary_tablespace: TEMP
……
SQL> set echo off;
Creating Package STATSPACK…Package created.
No errors.
Creating Package Body STATSPACK…Package body created.
No errors.
NOTE:
SPCPKG complete. Please check spcpkg.lis for any errors.
3. statspack 삭제.
설치시 원하지 않는 테이블스페이스나, 비밀번호를 사용했다면, 삭제후 다시 설치하면된다.
삭제는
SQL> @spdrop.sql
다시 설치하려고 start spcreate.sql 하면, 제대로 설치되지 않는다. 이때는 perfstat user를 삭제한다.
SQL> drop user perfstat;
혹시
SQL> drop user perfstat;
drop user perfstat
*
ERROR at line 1:
ORA-01922: CASCADE must be specified to drop ‘PERFSTAT’
이런 에러가 난다면,
SQL> drop user perfstat cascade;
statspack을 완전히 삭제하려면,
SQL> @spdrop.sql
SQL> DROP TABLESPACE perfstat INCLUDING CONTENTS AND DATAFILES;