How to create a on-demand AWR snapshot?

Using dbms_workload_repository.create_snapshot() one can create AWR snapshot.

Example: Creates the snapshot and returns the snap id. If ‘ALL’ is not passed it defaults to typical (statistics_level).

SQL> select dbms_workload_repository.create_snapshot('ALL') from dual;

DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT()
——————————————
856

1 row selected.

To view snapshot

SQL> select end_interval_time, error_count from DBA_HIST_SNAPSHOT where snap_id = 856;

END_INTERVAL_TIME ERROR_COUNT
————————————————————————— ———–
25-AUG-10 11.03.17.486 PM 0

2 thoughts on “How to create a on-demand AWR snapshot?

  1. Hi,

    Do you know if one can create a snapshot from a unix shell
    script ? I have sqlplus running nicely from a shell script and can issue SQL commands with no problem, but when I exec dbms_workload_repository.create_snapshot();
    it will not work. I have Goggled for days, and have found no exapmples of this

    Thank you for your time and expertise!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s