statspackはある一時点から一時点までの統計情報を取得するツールです。
エディションを問わずに利用できるので、とても手軽です。
[oracle@DB01 ~]$ sqlplus / as sysdba
CREATE TABLESPACE TOOLS
DATAFILE '+DATA/ORCL/DATAFILE/tools01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL AUTOALLOCATE;
statspackを利用するにはまず専用のテーブルスペースを作成します。
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
------------------------------ --------- ----------------------------
EXAMPLE PERMANENT
SYSAUX PERMANENT *
TOOLS PERMANENT
USERS PERMANENT
Pressing <return> will result in STATSPACK's recommended default
tablespace (identified by *) being used.
default_tablespaceに値を入力してください: TOOLS
Using tablespace TOOLS 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に値を入力してください: TEMP
・
・
・
続いてstatspak作成用のsql、spcreate.sqlを実行します。
専用スキーマのパスワード、表領域を指定します。
[oracle@DB01 ~]$ sqlplus perfstat/password
SQL> execute statspack.snap
PL/SQLプロシージャが正常に完了しました。
・
・
・
SQL> execute statspack.snap
PL/SQLプロシージャが正常に完了しました。
statspackのレポートを作成するためには、まず2時点以上のスナップショットを取得する必要があります。
pertstatスキーマが作成されているのでsqlplusで接続します。
「execute statspack.snap」でスナップショットを取得します。
SQL> @?/rdbms/admin/spreport.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
1452348317 ORCL 1 orcl
Instances in this Statspack schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
----------- -------- ------------ ------------ ------------
1452348317 1 ORCL orcl DB01
Using 1452348317 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Listing all Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level Comment
------------ ------------ --------- ----------------- ----- --------------------
orcl ORCL 1 14 10月 2016 00:4 5
9
2 14 10月 2016 00:5 5
0
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
begin_snapに値を入力してください: 1
Begin Snapshot Id specified: 1
end_snapに値を入力してください: 2
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is sp_1_2. To use this name,
press <return> to continue, otherwise enter an alternative.
report_nameに値を入力してください: test_report.txt
・
・
・
End of Report ( test_report.txt )
そして、レポートを作成するため、spreport.sqlを実行します。
番号で始点となるスナップショットと終点となるスナップショットを選択します。
レポートでは始点から終点の統計情報が記載されます。
エディションを問わずに利用できるので、とても手軽です。
[oracle@DB01 ~]$ sqlplus / as sysdba
CREATE TABLESPACE TOOLS
DATAFILE '+DATA/ORCL/DATAFILE/tools01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL AUTOALLOCATE;
statspackを利用するにはまず専用のテーブルスペースを作成します。
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
------------------------------ --------- ----------------------------
EXAMPLE PERMANENT
SYSAUX PERMANENT *
TOOLS PERMANENT
USERS PERMANENT
Pressing <return> will result in STATSPACK's recommended default
tablespace (identified by *) being used.
default_tablespaceに値を入力してください: TOOLS
Using tablespace TOOLS 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に値を入力してください: TEMP
・
・
・
続いてstatspak作成用のsql、spcreate.sqlを実行します。
専用スキーマのパスワード、表領域を指定します。
[oracle@DB01 ~]$ sqlplus perfstat/password
SQL> execute statspack.snap
PL/SQLプロシージャが正常に完了しました。
・
・
・
SQL> execute statspack.snap
PL/SQLプロシージャが正常に完了しました。
statspackのレポートを作成するためには、まず2時点以上のスナップショットを取得する必要があります。
pertstatスキーマが作成されているのでsqlplusで接続します。
「execute statspack.snap」でスナップショットを取得します。
SQL> @?/rdbms/admin/spreport.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
1452348317 ORCL 1 orcl
Instances in this Statspack schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
----------- -------- ------------ ------------ ------------
1452348317 1 ORCL orcl DB01
Using 1452348317 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Listing all Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level Comment
------------ ------------ --------- ----------------- ----- --------------------
orcl ORCL 1 14 10月 2016 00:4 5
9
2 14 10月 2016 00:5 5
0
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
begin_snapに値を入力してください: 1
Begin Snapshot Id specified: 1
end_snapに値を入力してください: 2
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is sp_1_2. To use this name,
press <return> to continue, otherwise enter an alternative.
report_nameに値を入力してください: test_report.txt
・
・
・
End of Report ( test_report.txt )
そして、レポートを作成するため、spreport.sqlを実行します。
番号で始点となるスナップショットと終点となるスナップショットを選択します。
レポートでは始点から終点の統計情報が記載されます。

コメント