Solved

trying to purge old AWR snapshots

Posted on 2012-04-09
10
1,770 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle - SQL Query with Function 3 65
oracle DR - data guard failover. 18 59
Toad 12.10 Enterprise visual interface 4 32
PL/SQL: ORA-00979: not a GROUP BY expression 3 53
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

756 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