Site search

Categories

Archives

Tags

awr report delete syntax demobld demobld.sql determine oracle db size du find large file ftp script function syntax insert syntax kill oracle process linux du listener listener.log nfs mount instructions oracle constraint oracle database oracle database hosting oracle delete oracle demo build oracle demo setup oracle forein key constraint oracle ftp oracle functions oracle insert oracle process Oracle Scripts oracle select oracle subquery oracle update select syntax solaris sql background sql delete sql functions sql info sql insert sqlplus demo setup sql select sql update subquery syntax Technology Webcasts update syntax vnc tutorial vsftp
RSS
XML RSS
What is this?
AddThis Feed Button

Social
Bookmarking




-- FREE --
IT Magazine
Subscriptions

Oracle Magazine Oracle Magazine Contains technology strategy articles, sample code, tips, Oracle and partner news, how-to articles for developers and DBAs

WebSite Magazine WebSite Magazine Practical advice, helpful tools and insights for website owners

Dr Dobb's Journal Dr Dobb's Journal enables coders to write the most efficient programs and help in daily programming quandaries

DM Review DM Review is recognized as the premier business intelligence, analytics and data warehousing publication
Various other Free IT magazine subscriptions
NoAdware Free Trial

NoAdware Remove
harmful
adware,
spyware,
trojans,
dialers
and worms!
- Featured ebook -

Database Normalization
by Alf Pedersen

Database Normalization ebook Understand and master how to normalize a database using methods richly documented with graphical ERD and server diagram examples



Raise alert.log error

Came across this very handy utility recently.

Warning, it is unsupported by Oracle, so don’t base your mission-critical alerts on this method.

Let’s say you are creating a stored proc as user scott, and instead of writing your
trapped error message to a table, an error file or sending an email, you would like it to be reflected
in the database’s alert.log.

The steps below show you how.

If not documented, this is guaranteed to make you unpopular with DBAs who manage your database in your absence…
First, grant execution privileges to scott:

as sys:

SQL> grant execute on sys.dbms_system to scott;

Grant succeeded.


Now run and test a procedure which will write to the alert.log

declare
Mess varchar2(200);
begin
Mess := ‘ORA-USER_ERROR’||’, scott.test_proc, ‘||’, ‘||substr(SQLERRM,1,100);
sys.dbms_system.ksdwrt(2,Mess);
commit;
end;


This is how it reflects in the alert.log (ORA-0000 because there is no error.)

Thu Jan 24 14:57:15 2008
ORA-USER_ERROR, scott.test_proc, ORA-0000: normal, successful completion

Lastly : implement it in your procedure’s exception handler section:


exception
when others then
Mess := ‘ORA-USER_ERROR’||’, scott.test_proc, ‘||’, ‘||substr(SQLERRM,1,100);
sys.dbms_system.ksdwrt(2,Mess);
commit;
….