Solved

trying to purge old AWR snapshots

Posted on 2012-04-09
10
1,888 Views
Last Modified: 2012-06-21
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);
0
Comment
Question by:dba1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 23

Accepted Solution

by:
David earned 84 total points
ID: 37825788
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
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 416 total points
ID: 37827240
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
 

Author Comment

by:dba1234
ID: 37829210
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 416 total points
ID: 37829215
>>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
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 416 total points
ID: 37829226
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
 

Author Comment

by:dba1234
ID: 37829341
We have grid control setup to monitor the database.
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 416 total points
ID: 37829382
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
 

Author Comment

by:dba1234
ID: 37829422
Now all the snapshots are gone but still according to view  v$sysaux_occupants space usage is same for SM/AWR
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 416 total points
ID: 37829465
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
 
LVL 23

Expert Comment

by:David
ID: 37829688
I remind the author that this isn't a likely source of any performance issue....
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question