Infrastructure at your Service

Oracle Team

Statspack installation scripts

By June 29, 2018 Oracle 9 Comments

By Franck Pachot

When Diagnostic Pack is disabled, either because you don’t have Diagnostic Pack or you are in Standard Edition, I highly recommend to install Statspack. When you will need it, to investigate on an issue that occured in the past, you will be happy to have it already installed and gathering snapshots.

I order to be sure to have it installed correctly, there’s a bit more to do than just what is described in spcreate.doc and I detail that in a UKOUG Oracle Scene article Improving Statspack Experience.

For easy download, I’ve put the scripts on GitHub:

You will find the following scripts for Statspack installation:

  • 01-install.sql to create the tablespace and call spcreate
  • 02-schedule.sql to schedule snap and purge jobs
  • 03-idle-events.sql to fix issue described at
  • 04-modify-level.sql to collect execution plans and segment statistics

And some additional scripts:

  • 08-create-delta-views.sql to create views easy to query
  • 11-comment-with-load.sql to add load information to snapshots without comments

You can leave feedback and comment on Twitter:


  • Grzegorz Goryszewski says:

    Thanks for all the valuable info.
    As far as I can tell during the sp installation dbms_job package was recreated, that could lead to some disturbance in production. Not sure if still the case thoug.

  • Jan says:

    Thank you for publishing your scripts. You’ve implemented some special aspects that I didn’t consider, yet.

    One question: Why do you schedule one purge job per RAC instance? I cannot verify this, currently, but I think I never had to do this. I always executed purge only once per database, not once per instance.

  • jarmo says:


    Your install script has two issues in alter statement, wrong syntax and SYS user.

  • jarmo says:


    ORA-28154: Proxy user may not act as client ‘SYS’
    And the syntax should be ‘alter user perfstat GRANT…’

    I can see only one ‘alter user’ statement in install.sql, so don’t know what you mean another statement (install in CDB$ROOT”)?

  • Hi Jarmo,
    Oh yes, typos here :(
    The idea was:

    alter user perfstat grant connect through system;

    Thanks, I fixed it in Git.

Leave a Reply

Oracle Team
Oracle Team