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
Solved

trying to purge old AWR snapshots

Posted on 2012-04-09
10
1,725 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 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 76

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 76

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 76

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 76

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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
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
This video shows how to recover a database from a user managed backup

840 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