Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

anyone have a decent purge script for 11g diag directories

19 views
Skip to first unread message

hpuxrac

unread,
Nov 13, 2008, 7:37:48 PM11/13/08
to
Not only do we have the standard .trc files there are now .trm files
and probably various other things.

Maybe I am missing some basic concept like some parameter to set or
utility to use so that 11g databases will clean out and delete stuff
after a certain date in the diag structure.

Or perhaps oracle has that on their to-do list but hasn't gotten
around to that yet.

The idea of collecting and keeping all the diagnostic stuff around
together is fine if only there is some method behind the madness of
getting rid of stuff that you don't want anymore.

Ideas or clarification or working 11g linux scripts would be
appreciated! Even some words of warning about things not to get rid
of are fine.

Thanks John

DA Morgan

unread,
Nov 13, 2008, 9:04:08 PM11/13/08
to

I don't expect to see any automatic clean-out but that is just my
impression not based on anything I've been told.

What may or may not be important, unlike with backups, is not as
clear cut when it comes to trace files.

What I'd like to see is an easy way to do backup controlfile to
trace and not have the file named like every other trace file (I
mean the text version not just the binary). That would be a
decent enhancement.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damo...@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org

Mladen Gogala

unread,
Nov 14, 2008, 3:22:35 AM11/14/08
to
DA Morgan wrote:

> What I'd like to see is an easy way to do backup controlfile to
> trace and not have the file named like every other trace file (I
> mean the text version not just the binary). That would be a
> decent enhancement.

You mean something like this?
SQL>
SQL> alter database backup controlfile to trace as '/tmp/dan.sql';

Database altered.


--
http://mgogala.freehostia.com

Palooka

unread,
Nov 14, 2008, 2:24:33 PM11/14/08
to

MAX_DUMP_FILE_SIZE?

Does everything in bdump etc. automatically, except the alert log (in
10g at any rate).
I also have a stored proc for trimming the audit trail, and a shell
script for the listener logs/alert log/rman log - but I don't do it by
age, just tail to the last 20,000 (or whatever) lines. If any of this is
of any use, please let me know.

Palooka

DA Morgan

unread,
Nov 14, 2008, 9:32:26 PM11/14/08
to

That makes a binary copy not a text copy. Please note that I
addressed that above.

Maxim Demenko

unread,
Nov 15, 2008, 3:35:18 AM11/15/08
to DA Morgan
DA Morgan schrieb:

> Mladen Gogala wrote:
>> DA Morgan wrote:
>>
>>> What I'd like to see is an easy way to do backup controlfile to
>>> trace and not have the file named like every other trace file (I
>>> mean the text version not just the binary). That would be a
>>> decent enhancement.
>>
>> You mean something like this?
>> SQL> SQL> alter database backup controlfile to trace as '/tmp/dan.sql';
>>
>> Database altered.
>
> That makes a binary copy not a text copy. Please note that I
> addressed that above.

That produces either ORA-00933 (on 9.0.1 and below) or textfile (from
9.2 onwards).

Best regards

Maxim

jan.be...@gmail.com

unread,
Nov 15, 2008, 5:15:54 AM11/15/08
to


The new adrci command line tool could do this, look at the purge
command:

$ adrci

ADRCI: Release 11.1.0.7.0 - Production on Sat Nov 15 11:16:48 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved.

ADR base = "/app/oracle"
adrci> help purge

Usage: PURGE [[-i <id1> | <id1> <id2>] |
[-age <mins> [-type ALERT|INCIDENT|TRACE|CDUMP|HM|
UTSCDMP]]]:

Purpose: Purge the diagnostic data in the current ADR home. If no
option is specified, the default purging policy will be
used.

Options:
[-i id1 | id1 id2]: Users can input a single incident ID, or a
range of incidents to purge.

[-age <mins>]: Users can specify the purging policy either to all
the diagnostic data or the specified type. The data older than
<mins>
ago will be purged

[-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]: Users can specify
what type of
data to be purged.

Examples:
purge
purge -i 123 456
purge -age 60 -type incident

adrci>

hpuxrac

unread,
Nov 15, 2008, 9:38:00 AM11/15/08
to
On Nov 15, 5:15 am, "jan.benjam...@gmail.com"
<jan.benjam...@gmail.com> wrote:

snip

> > Not only do we have the standard .trc files there are now .trm files
> > and probably various other things.
>
> > Maybe I am missing some basic concept like some parameter to set or
> > utility to use so that 11g databases will clean out and delete stuff
> > after a certain date in the diag structure.
>

Now that is what I was thinking about and looking for!

Thank you very much ... I will check it out and report back results
here.

Maybe we will get some kind of integration eventually so that we get
something that can also trim various log files ( alert, listener, em
etc ) automatically along with un-needed trace files, incidents,
whatever.

Thanks John

hpuxrac

unread,
Nov 15, 2008, 9:40:05 AM11/15/08
to
On Nov 15, 3:35 am, Maxim Demenko <mdeme...@gmail.com> wrote:

snip

> >> You mean something like this?
> >> SQL> SQL> alter database backup controlfile to trace as '/tmp/dan.sql';
>
> >> Database altered.
>
> > That makes a binary copy not a text copy. Please note that I
> > addressed that above.
>
> That produces either ORA-00933 (on 9.0.1 and below) or textfile (from
> 9.2 onwards).
>

No clue why Captain Morgan hasn't tried that command and is unaware of
how it works apparently.

hpuxrac

unread,
Nov 15, 2008, 10:12:28 AM11/15/08
to
On Nov 15, 5:15 am, "jan.benjam...@gmail.com"
<jan.benjam...@gmail.com> wrote:

snip

> The new adrci command line tool could do this, look at the purge

Yes thank you this seems to work well and was what I was looking
for ... ( will come up with something that looks at the various adr
homes and drives a purge based on parameters of how many days old
alert files to ditch ).

Looks like it cleans out the .trc and .trm files together of
course ...

#!/bin/ksh
. /home/oracle/ora_11g_env
adrci << EOF
set home diag/rdbms/test11g/test11g
purge -age 4320 -type trace
exit
EOF


Mladen Gogala

unread,
Nov 15, 2008, 11:58:45 AM11/15/08
to
On Fri, 14 Nov 2008 18:32:26 -0800, DA Morgan wrote:

>> SQL> alter database backup controlfile to trace as '/tmp/dan.sql';
>>
>> Database altered.
>
> That makes a binary copy not a text copy. Please note that I addressed
> that above.

No, it doesn't make a binary copy. It produces a trace file and renames
it as requested.

--
http://mgogala.freehostia.com

gazzag

unread,
Nov 17, 2008, 11:29:46 AM11/17/08
to

Indeed. It would appear that there's a clue in the statement itself:

alter database backup controlfile TO TRACE as '/tmp/dan.sql';

-g

0 new messages