   |  | | after servererror trigger | after servererror trigger 2006-07-28 - By Baumgartel, Paul
You can use ora_space_error_info to determine if your server error is space -related (such as ora-01652 (See ora-01652.ora-code.com)).
Paul Baumgartel CREDIT SUISSE Information Technology DBA & Admin - NY, KIGA 1 11 Madison Avenue New York, NY 10010 USA Phone 212.538.1143 paul.baumgartel@(protected) www.credit-suisse.com
-- --Original Message-- -- From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]On Behalf Of goran bogdanovic Sent: Friday, July 28, 2006 11:08 AM To: wojciech.skrzynecki@(protected) Cc: oracle-l@(protected) Subject: Re: after servererror trigger
write a script to scan the ora trace/log files for errors? - and get rid of trigger...:-)
On 7/28/06, Wojciech Skrzynecki < <mailto:wojciech.skrzynecki@(protected)> wojciech.skrzynecki@(protected)> wrote:
Hello
I would like to ask you about after servererror trigger. I wrote trigger as below:
CREATE OR REPLACE TRIGGER notification_error
after servererror on database
declare
d_sender varchar2(30) := ora_database_name;
d_user varchar2(30) :=ora_login_user;
d_rcp varchar2(100) := ' test';
d_mailhost VARCHAR2(30) := 'test';
d_mail_conn utl_smtp.connection;
d_terminal VARCHAR2(30) :=userenv('terminal');
d_current_nr_error number := ora_server_error(1);
ora_server_error_msg varchar2(100);
BEGIN
if d_current_nr_error between 01800 and 02231
or d_current_nr_error in (09291,16014)
then
ora_server_error_msg := SQLERRM(-d_current_nr_error);
d_mail_conn := utl_smtp.open_connection(d_mailhost);
utl_smtp.helo(d_mail_conn, d_mailhost );
utl_smtp.mail(d_mail_conn, d_sender);
utl_smtp.rcpt(d_mail_conn, d_rcp);
utl_smtp.open_data(d_mail_conn);
utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'From: ' || ora _database_name);
utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'Subject: ' || ora_server _error_msg);
utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'User: ' || ora_login _user);
utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'Terminal: ' || d _terminal);
utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'Date: ' || to_char (sysdate, 'RRRR-MM-RR HH24:MI:SS') );
utl_smtp.close_data(d_mail_conn);
utl_smtp.quit(d_mail_conn);
end if;
I do not know how to intercept background ORA error example "ORA-01652 (See ORA-01652.ora-code.com): unable to extend temp segment by 512 in tablespace TEMP" or
"ORA-9291 (See ORA-9291.ora-code.com) invalid device specified for archive destination "
Could you explain me how to do this?
Thanks for help
--
Wojciech Skrzynecki Database Administrator
============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1556" name=GENERATOR></HEAD> <BODY> <DIV><SPAN class=955434715-28072006><FONT face=Arial color=#0000ff size=2>You can use ora_space_error_info to determine if your server error is space-related (such as ora-01652 (See ora-01652.ora-code.com)). </FONT></SPAN></DIV> <DIV> </DIV> <P><B><FONT face=Arial size=2>Paul Baumgartel</FONT></B> <BR><B><FONT face =Arial size=2>CREDIT SUISSE</FONT></B> <BR><FONT face=Arial size=2>Information Technology</FONT> <BR><FONT face=Arial size=2>DBA & Admin - NY, KIGA 1</FONT> <BR><FONT face=Arial size=2>11 Madison Avenue</FONT> <BR><FONT face=Arial size=2>New York, NY 10010</FONT> <BR><FONT face=Arial size=2>USA</FONT> <BR><FONT face=Arial size=2>Phone 212.538.1143</FONT> <BR><FONT face=Arial size=2>paul.baumgartel@(protected)</FONT> <BR><FONT face=Arial size=2>www.credit-suisse.com</FONT> </P> <BLOCKQUOTE> <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]<B>On Behalf Of </B>goran bogdanovic<BR><B>Sent:</B> Friday, July 28, 2006 11:08 AM<BR><B>To:</B> wojciech.skrzynecki@(protected)<BR><B>Cc:</B> oracle-l@(protected)<BR><B>Subject:</B> Re: after servererror trigger<BR><BR></FONT></DIV>write a script to scan the ora trace/log files for errors? - and get rid of trigger...:-)<BR><BR> <DIV><SPAN class=gmail_quote>On 7/28/06, <B class=gmail_sendername>Wojciech Skrzynecki</B> <<A href="mailto:wojciech.skrzynecki@(protected)"> wojciech.skrzynecki@(protected)</A>> wrote:</SPAN> <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204 ,204) 1px solid"> <DIV> <P><SPAN style="FONT-FAMILY: Arial">Hello</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"></SPAN> </P> <P><SPAN style="FONT-FAMILY: Arial">I would like to ask you about after servererror trigger. I wrote trigger as below:</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"></SPAN> </P> <P><SPAN style="FONT-FAMILY: Arial">CREATE OR REPLACE TRIGGER notification_error</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial">after servererror on database</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial">declare</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_sender<SPAN> </SPAN><SPAN> </SPAN>varchar2(30) := ora_database_name;</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_user varchar2(30) :=ora_login_user;</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_rcp <SPAN> </SPAN><SPAN> </SPAN>varchar2(100) := ' test';</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_mailhost <SPAN></SPAN><SPAN> </SPAN>VARCHAR2(30) := 'test';</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_mail_conn <SPAN> </SPAN><SPAN> </SPAN>utl_smtp.connection;</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_terminal VARCHAR2(30) :=userenv('terminal');</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_current_nr_error <SPAN> </SPAN><SPAN> </SPAN>number := ora_server_error(1);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>ora_server_error_msg<SPAN> </SPAN>varchar2(100);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial">BEGIN<SPAN> </SPAN></SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>if <SPAN> </SPAN>d_current_nr_error<SPAN> </SPAN>between 01800 and 02231</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>or d_current_nr_error<SPAN> </SPAN>in (09291,16014)</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>then</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>ora_server_error_msg := SQLERRM(-d_current_nr_error);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>d_mail_conn := utl_smtp.open_connection(d_mailhost);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.helo(d_mail_conn, d_mailhost );</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.mail(d_mail_conn, d_sender);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.rcpt(d_mail_conn, d_rcp);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.open_data(d_mail_conn);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'From:<SPAN> </SPAN>' || ora_database_name);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'Subject: ' || ora_server_error_msg);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'User: ' || ora_login_user);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'Terminal: ' || d_terminal);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.write_data(d_mail_conn, utl_tcp.CRLF || 'Date: ' || to_char(sysdate, 'RRRR-MM-RR HH24:MI:SS') );</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.close_data(d_mail_conn);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>utl_smtp.quit(d_mail_conn);</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"><SPAN> </SPAN>end if;</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"></SPAN> </P> <P><SPAN style="FONT-FAMILY: Arial">I do not know how to intercept background ORA error example "ORA-01652 (See ORA-01652.ora-code.com): unable to extend temp segment by 512 in tablespace TEMP" or </SPAN></P><PRE><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">"ORA-9291 (See ORA-9291.ora-code.com) invalid device specified for archive destination "</SPAN></PRE><PRE><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial"> < /SPAN></PRE> <P><SPAN style="FONT-FAMILY: Arial">Could you explain me how to do this?</SPAN></P> <P><SPAN style="FONT-FAMILY: Arial"></SPAN> </P> <P><SPAN style="FONT-FAMILY: Arial">Thanks for help</SPAN></P>-- <BR></DIV> <DIV><SPAN class=sg>Wojciech Skrzynecki<BR>Database Administrator </SPAN></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE> <P><pre wrap>================================================================== ============ Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== </pre></P></BODY></HTML>
|
|
 |