Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Backup controlfile to trace

Re: Backup controlfile to trace

From: Jim Blazek <xxx_jblazek_at_a.com>
Date: Mon, 24 Nov 2003 08:04:20 -0700
Message-ID: <3FC21DF4.EFC3E374@a.com>


This is inside of a package that is called by an Oracle job. Then you can run it once a day. I have a directory called ddump to keep output that I create. And with the exception handling, the job does not break.

Jim

PROCEDURE system_trace
IS
 cursor_name INTEGER;
 ret INTEGER;
 s_sql varchar(100);
Begin

 cursor_name := dbms_sql.open_cursor;

 s_sql := 'alter database backup controlfile to trace as ''$ORACLE_ADMIN/ddump/$ORACLE_SID.'|| to_char(sysdate, 'yyyy-mm-dd') ||'.trc'' reuse';  dbms_sql.parse(cursor_name, s_sql, dbms_sql.native);  ret := dbms_sql.execute(cursor_name);

 s_sql := 'create pfile=''$ORACLE_ADMIN/ddump/pfile$ORACLE_SID.'|| to_char(sysdate, 'yyyy-mm-dd') ||'.ora'' from spfile';
 dbms_sql.parse(cursor_name, s_sql, dbms_sql.native);  ret := dbms_sql.execute(cursor_name);

 DBMS_SQL.close_cursor(cursor_name);

EXCEPTION
 WHEN OTHERS THEN
  fxs_da_mail.send_err_mail(
   header => 'FAILURE of system_trace',
   message => 'system_trace' || crlf || sqlerrm );

End system_trace;

Jack Wang wrote:

> All,
>
> I have a job 'alter database backup controlfile to trace'. How can I automate the process of
> locating the trace file and copying to somewhere else? Thanks.
>
> W2K + 9.2.0.3
>
> - Jack
Received on Mon Nov 24 2003 - 09:04:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US