Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

trying to purge old AWR snapshots

Posted on 2012-04-09
10
Medium Priority
?
2,062 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
  • 5
  • 3
  • 2
10 Comments
 
LVL 23

Accepted Solution

by:
David earned 252 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 78

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1248 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 78

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1248 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 78

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1248 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 78

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1248 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 78

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1248 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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 recover a database from a user managed backup

916 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