trying to purge old AWR snapshots

Hi,
I am trying to purge old snapshots. PL/SQL procedure is running successfully, but when I check the list of snapshots all the snapshots are still available.
exec dbms_workload_repository.drop_snapshot_range (low_snap_id => 2401, high_snap_id => 51216);
dba1234Asked:
Who is Participating?
 
DavidConnect With a Mentor Senior Oracle Database AdministratorCommented:
In 10g your syntax is wrong, try (2401,51216)

based upon docs.oracle.com

DROP_SNAPSHOT_RANGE Procedure

This procedure drops a range of snapshots.

Syntax

DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(
   low_snap_id    IN  NUMBER,
   high_snap_id   IN  NUMBER
   dbid           IN  NUMBER DEFAULT NULL);
Parameters

Table 119-15 DROP_SNAPSHOT_RANGE Procedure Parameters

Parameter      Description
low_snap_id
The low snapshot id of snapshots to drop.
high_snap_id
The high snapshot id of snapshots to drop.
dbid
The database id (default to local DBID.

Examples

This example drops the range of snapshots between snapshot id 102 to 105 for the local database:

EXECUTE DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(102, 105);

And to confirm:
SELECT snap_id, startup_time
FROM dba_hist_snapshot
ORDER BY 1,2;
0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Is this in dbConsole or Grid Control?  If Grid Control then you likley need the optional dbid parameter.  The default is the local instance.

>>In 10g your syntax is wrong

Syntax looks fine to me.
0
 
dba1234Author Commented:
I am using throgh SQLPLUS . I tried three times but everytime it ran without any error, but snapshots are still there and in the view v$sysaux_occupants space usage is same for SM/AWR. Please suggest what should I do.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
>>I am using throgh SQLPLUS

This does not answer my question.  Are you using Grid Control or dbConsole to collect the AWR reports?  

The AWR reports are stord inside the database in a repository.  If you are using Grid Control and connecting to that database to purge logs, you likely need the optional dbid parameter.
0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
In other words:  If you have Grid Control set up and monitoring 2 databases and both databsaes have a AWR report with a snap_id of 2401, you don't want to delete BOTH.  You need to tell the delete which database's snap_id to delete.
0
 
dba1234Author Commented:
We have grid control setup to monitor the database.
0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
OK then.  It is likely what I've been saying all along:  You need to set the dbid parameter.

I'm not a Grid Control expert so don't know how to get that from the GUI.

I know you can connect to the database that was used to generate the AWR reports and:
SELECT dbid FROM v$database;

Then you use that databsaes dbid in the call to DROP_SNAPSHOT_RANGE.
0
 
dba1234Author Commented:
Now all the snapshots are gone but still according to view  v$sysaux_occupants space usage is same for SM/AWR
0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Deleting objects in Oracle does not 'reclaim' space in a way you might think.  Once a block of space is allocated to something, it remains allocated even if no rows/bytes are used.

I'm not familiar with that view but I wonder if it is reporting 'allocated' space.
0
 
DavidSenior Oracle Database AdministratorCommented:
I remind the author that this isn't a likely source of any performance issue....
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.