この記事ではStatspackのインストール方法について解説します。
StatsPackとは
StatsPackはOracle Databaseからパフォーマンスデータをレポートに出力するツールです。
スナップショットを取得し、2つのスナップショット間のレポートを作成することができます。
出力したレポートからパフォーマンスチューニングを行うことができます。
AWRと機能としては似ていますが、AWRを使用するにはEnterprise EditionのDiagnostics Packライセンスが必要です。
対してStatsPackはStandard Editionを含むすべてのエディションで使用することができます。
Statspackのインストール
Statspackを使用するにはインストール作業が必要です。
インストールはsysユーザで@?/rdbms/admin/spcreate.sqlを実行することで行えます。
コンテナデータベースではCDB$ROOTに対してはインストールは行えません。
使用するPDBに接続してSQLを実行します。
インストールするPDBに接続します。
$ sqlplus / as sysdba
SQL> alter session set container=pdb2;
セッションが変更されました。
SQLを実行するとPERFSTATというStatspackの所有者となるユーザが作成されますので、そのパスワードを入力します。
その後PERFSTATのデフォルト表領域、デフォルト一時表領域を指定します。
デフォルトはSYSAUX、TEMPとなっており、そのままでよければEnterを押します。
SQL> @?/rdbms/admin/spcreate.sql
セッションが変更されました。
Choose the PERFSTAT user's password
-----------------------------------
Not specifying a password will result in the installation FAILING
perfstat_passwordに値を入力してください: password
password
Choose 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
----------------------------
SYSAUX PERMANENT
*
TEST PERMANENT
USERS PERMANENT
Pressing <return> will result in STATSPACK's recommended default
tablespace (identified by *) being used.
default_tablespaceに値を入力してください:
Using tablespace SYSAUX as PERFSTAT default tablespace.
Choose the Temporary tablespace for the PERFSTAT user
-----------------------------------------------------
Below is the list of online tablespaces in this database which can
store temporary data (e.g. for sort workareas). Specifying the SYSTEM
tablespace for the user's temporary tablespace will result in the
installation FAILING, as using SYSTEM for workareas is not supported.
Choose the PERFSTAT user's Temporary tablespace.
TABLESPACE_NAME CONTENTS DB DEFAULT TEMP TABLESPACE
------------------------------ --------------------- --------------------------
TEMP TEMPORARY *
Pressing <return> will result in the database's default Temporary
tablespace (identified by *) being used.
temporary_tablespaceに値を入力してください:
Using tablespace TEMP as PERFSTAT temporary tablespace.
…
エラーがなく正常に完了すればインストール完了です。