Re: Saving Backup Errros inside the db
- From: BN <bnsarma@xxxxxxxxx>
- To: "Johnson, George" <GJohnson@xxxxxxx>
- Date: Thu, 29 Dec 2005 13:13:23 -0500
Greetings,
Thank you all for your reply...
We have a mix of Oracle version starting from 8.1.7
Right now I have a few lines in the RMAN Hotbackup script that extracts the
info (success or error) from the RMAN log and write into on my tables with
the following info:
hostname, instance_name, start_time, end_time, status (varchar2(4000))
# Start of Code
HOST=$(hostname)
PROGRAM=${0##*/}
START_TIME=$(date '+%m/%d/%y %X')
BACKUP_LOGFILE="..../.../rman_backup.log"
exec 2>&1 >> $BACKUP_LOGFILE
RMAN Backup commands {}
END_TIME=$(date '+%m/%d/%y %X')
STATUS=$(awk '/ERROR MESSAGE STACK FOLLOWS/,/RMAN>/ {print $0}'
<${BACKUP_LOGFILE}|sed '/^$/d')
if [[ -z "$STATUS" ]]
then
STATUS="Backup Successful"
fi
$ORACLE_HOME/bin/sqlplus -S <<EOF
/ as sysdba
prompt Inserting Backup timing info into system.XXX_backup_status
prompt START_TIME=$START_TIME END_TIME=$END_TIME STATUS=$STATUS
insert into system.XXXX_backup_status
(INSTANCE_NAME,HOST_NAME,SCRIPT_NAME,START_TIME,END_TIME,STATUS)
values
('$ORACLE_SID','$HOST','$PROGRAM',to_date('$START_TIME','MM/DD/YY
HH24:MI:SS'),
to_date('$END_TIME','MM/DD/YY HH24:MI:SS'),'$STATUS');
EOF
# End of Code
The SED is to remove the blank lines, other wise INSERT complains.
IF there are no errors then STATUS string will be zero, so I assume Backup
is successful.
I am only hoping that VARCAHR2(4000) should be good enough to hold any type
of RMAN Error message. Please note, I am collecting all the error messages
lines, not just the last error message line.
Regards & Thanks
BN
On 12/28/05, Johnson, George <GJohnson@xxxxxxx> wrote:
>
>
> I was under the impression that this was already stored or is that
> only under 10g and with central catalog? I just remember reading something
> about this in a tech doc somewhere.
>
> Rgds
>
> -----Original Message-----
> From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]
> On Behalf Of Grant Allen
> Sent: 28 Dec 2005 7:34
> To: bnsarma@xxxxxxxxx
> Cc: lazydba
> Subject: Re: Saving Backup Errros inside the db
>
>
> BN wrote:
>
> > Greetings,
> >
> > I would like to save the following RMAN error messages inside a table
> > along with the timestamp
> >
> > RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
> >
> [snip]
>
> > Can somebody suggest me how I can do this. I want to save the new
> > lines, as they appear in the error message.
> >
> > Am I looking at a CLOB or do I have other options.
>
>
> BN - others are already suggesting the post-backup shell script, but you
> do have options other than CLOB. You can save the new lines with some
> easy regex work and the ever-useful chr(10) or chr(13)||chr(10) trick
> (depending on your OS). This means you can opt for char or varchar2,
> which you might find *much* easier to use in the long run.
>
> Ciao
> Fuzzy
> :-)
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
>
> ****************************************************************************
> This message contains confidential information and is intended only
> for the individual or entity named. If you are not the named addressee
> you should not disseminate, distribute or copy this e-mail.
> Please notify the sender immediately by e-mail if you have received
> this e-mail by mistake and delete this e-mail from your system.
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed, arrive
> late or incomplete, or contain viruses. The sender therefore does not
> accept liability for any errors or omissions in the contents of this
> message which arise as a result of e-mail transmission.
> If verification is required please request a hard-copy version.
> This message is provided for informational purposes and should not
> be construed as an invitation or offer to buy or sell any securities or
> related financial instruments.
> GAM operates in many jurisdictions and is
> regulated or licensed in those jurisdictions as required.
>
> ****************************************************************************
>
>
--
Regards & Thanks
BN
- References:
- RE: Saving Backup Errros inside the db
- From: Johnson, George
Other related posts:
- » Saving Backup Errros inside the db
- » Re: Saving Backup Errros inside the db
- » Re: Saving Backup Errros inside the db
- » RE: Saving Backup Errros inside the db
- » Re: Saving Backup Errros inside the db
- RE: Saving Backup Errros inside the db
- From: Johnson, George