How to create procedure to mail ORA-error

hi all,
anyone please tell me how to create a procedure to mail the ORA-error when ORA- error comes in alert.log

Ok, I can't really do this for you. It's not hard, just a lot of back-and-forth testing needs to be done. To do it solely in PL/SQL you need to monitor the alter_<sid>.log file for changes and filter the changed records for ORA- errors.. So, first step is to create, or get the dba to create a directory for that bdump directory. This will allow you to open the file for reading in PL/SQL
This is on an XE 10g database as SYSTEM user, with poly being the database user that is monitoring the file.
select value from v$parameter where name like 'background_dump_dest';
/usr/lib/oracle/xe/app/oracle/admin/XE/bdump
SQL> CREATE DIRECTORY BDUMP_DIR AS '/usr/lib/oracle/xe/app/oracle/admin/XE/bdump';
create directory succeeded.
SQL> grant read on directory alert_dir to poly;
grant read succeeded.After this, you need to read the file and search for ORA- messages. You use the UTL_FILE package to do this. The following subprograms in UTL_FILE will be useful to you.
Function: UTL_FILE.FOPEN You use this to open the file in readonly mode. Please look at the UTL_FILE documentation examples.
Procedure: UTL_FILE.GET_LINE You use this to read lines into PL/SQL
Procedure: UTL_FILE.GETATTR You use this to get the filelength. If the filelength is different from your previous call, you know some writes occurred.
Procedure UTL_FILE.FSEEK You use this to position the reading stream to the first byte of new data read. You've detected the file has grown in size and do something like utl_file.fseek(file_desc,last_file_length+1)
Procedure UTL_FILE.FCLOSE Close file when done.
Pseudologic:
This logic assumes you have a table which stores the filelength from the last time you executed the procedure. This allows you to only process records that have not already been processed.
1. Read last file length from persistent storage such as a table. Default to zero if no value.
2. Get filelength using UTL_FILE.GETATTR
3. Compare filelength. If equal to prior value, exit. If greater, than more lines added. If less, then dba must have rolled the log, reset prior filelength to zero to process entire new file.
4. Use UTL_FILE.FSEEK to position reader to one byte past last file length. This is why we default it to zero, 0+1=1.
5. Open file using UTL_FILE.FOPEN
6. Loop while data is avaliable, read each line, use instr or whatever to detect ORA- messages, call SMTP mailer as needed. You may want to log each email into a log table.
7. After loop, set persisted last file length (update a table and commit maybe) to value returned from UTL_FILE.FGETPOS.
8. Sleep for some interval of time. Start back at step 1.
You should consider using DBMS_SCHEDULER to set up this job.
There are lots of other ways of doing this. Remember that it's possible for your database to crash and your procedure might not be able to send an email. If someone edits the alter file and adds lines anywhere other than at the end, your program may resend some messages.
Edited by: david.sweet on Feb 19, 2011 10:16 AM: changed the word function to procedure for most of them

Similar Messages

  • Verizon Blackberry Internet Service Client (BIS)- How to create an e-mail Filter

    Hello. Thank you in advance for replying to my question. I am trying to create an e-mail filter so that a contact's e-mail messages do not get delivered to my BB and instead just go straight to my regular e-mail account. I understand that you can do this function from the BIS, however when I tried to create an account I received a message that said "please use your device to access the BIS." I did just as the message told me but I did not get the same menu options from my BB as I would have gotten from doing it from the internet. The page only showed a list of my e-mails and an "edit" and "delete" choice for each one. There was no "Filter" button for me to click. I remember a while ago I able to access this page and was able to remove the BB signature (i.e.. "This message is being sent from a BB"), so I know that it was possible to access this page. I do not know why I am not able to accesses it now.               
    If anyone out there has Verizon and knows how to access the BIS, please let me know how. Or if you know how to create an e-mail filter function, please let me know.
    Thank you,
    Fred
    Solved!
    Go to Solution.

    Hi there!
    To log into your BIS account from a PC/browser (not the BB browser), go to this URL:
    https://bis.na.blackberry.com/html?brand=vzw
    Enter your BIS credentials and you will then be in your BIS account screen. From there, use this KB to create the filter you desire:
    KB04558 Add a filter to a BlackBerry Internet Service account
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to create a group mailing list in JavaMail?

    Hello,
    I've been searching through the entire API, specifically the InternetAddress class and I can't seem to find out how to create a group/mailing list. Does anyone know how to do this?
    That is, I would like to be able to group a bunch of e-mail addresses together and give that group a name "my friends". Then send it off using this 'group mail address' as opposed to an array of InternetAddress[]. Then when the recipients receive the e-mail, they see "my friends" in the To: field, instead of everyone's e-mail address...
    Is this possible in JavaMail? I've tried many things like creating an InternetAddress object passing in a comma-delimited list of e-mail addresses but it doesn't like it.
    Thanks in advance!

    Hi:
    I have the same problem. I've read JavaMail implements RFC 822 which allow mailing lists. But, �how can I implement it with JavaMail?
    Best regards,
    Fabio Galarraga.

  • How to create a group mailing list?

    how to create agroup mailing list?

    i have followed instructions on "how to create a group mailing list" & get a total blank when i hit return after entering the group name in addressee column.   this is after i created a new group under address book, & then drug over individual names into the group.   what am i doing wrong?

  • How to be notified for all ORA- Errors recorded in the alert.log file

    based on Note:405396.1, I Changed the Matches Warning from the default value ORA-0*(600?|7445|4[0-9][0-9][0-9])[^0-9] to ORA-* in order to receive an warning alert for all ORA- errors.
    but I just recieved the alert like the following:
    Metric=Generic Alert Log Error
    Time/Line Number=Mon Feb 25 23:52:21 2008/21234
    Timestamp=Feb 26, 2008 12:06:03 AM EST
    Severity=Warning
    Message=ORA-error stack (1654, 1654, 1654) logged in /opt/oracle/admin/PRD/bdump/alert_PRD.log.
    Notification Rule Name=Alert Log Error
    Notification Rule Owner=SYSMAN
    as you can see, the message only indicate the ORA-1654, nothing else.
    How to set in 10g grid control to get the details alert that in the alert log like:
    "ORA-1654: unable to extend index ADM.RC_BP_STATUS by 1024 in tablespace PSINDEX"
    I can't believe Oracle 10g Grid control only provide the ORA- number without details

    Go to your database target.
    On the home tab, on the left hand side under Diagnostic Summary, you'll see a clickable date link next to where it says 'Alert Log'. Click on that.
    next click on Generic Alert Log Error Monitoring Configuration (its at the bottom)
    In the alert thresholds put:
    ORA-0*(600?|7445|4[0-9][0-9][0-9])[^0-9]
    I believe that will pick anything up but experiment, its only perl.
    If you want to test this use the DBMS_System.ksdwrt package but I would advise you only do so on a test database. If you've never heard of it, google it. Its a way of writing to your alert log.
    Make sure you have your emails sent to long format as well.

  • How to create an e-mail that contains a graphic flyer notice

    I need to create an e-mail poster advertisement for a
    recreation area that
    will be sent out to shareholders. I need to do this as an
    extra-curricular
    activity for work. Does anyone have any suggestions on how I
    would do this?
    Would I create the web page and then send the web page in an
    e-mail. I need
    the info to show up directly, not
    through an attachment. Also, once created, this will be sent
    out to
    shareholders. How do I save this file to disk( in what format
    )so that it
    can be sent out by my boss. Any suggestions would be helpful.
    Thanks
    jmick

    Thanks for your assistance. I went to mailchimp and found
    some helpful
    information. I also found another program and created a
    presentable draft
    that I have forwarded on. Thanks again.
    jmick

  • How to create folders in mail?

    How do I create folders in Mail?

    This discussion is just about one year old. I suggest you start a new discussion.
    Please include details about your Macbook Pro, the version of the operating system and  the version of Mail you have.
    https://discussions.apple.com/community/notebooks/post!input.jspa?containerType= 14&container=2097

  • How to create procedure

    hi
    i have a little problem with creating procedure
    i have a table
    create table t
    t_id int,
    t_name varchar(22)
    insert into t values(1,'AA');
    and then i try to create procedure for insert into this table
    create or replace procedure my_proc(pt_id int,pt_name varchar(22))
    as begin
    insert into t values(pt_id,pt_name);
    end;
    but i receive an error
    please help me anybody

    Diman wrote:
    hi
    i have a little problem with creating procedure
    i have a table
    create table t
    t_id int,
    t_name varchar(22)
    insert into t values(1,'AA');Thanks for posting the CRATE TABLE and INSERT statements; that's very helpful!
    and then i try to create procedure for insert into this table
    create or replace procedure my_proc(pt_id int,pt_name varchar(22))
    as begin
    insert into t values(pt_id,pt_name);
    end;
    but i receive an errorWhy not post the error message?
    please help me anybodyWhen you give the datatype of an argument, you can't qualify it with a length (like VARCHAR *(22)* ); just give the type (VARCHAR)
    create or replace procedure     my_proc
    (   pt_id       int
    ,   pt_name     varchar          -- no size
    as begin
        insert into t (t_id,   t_name)
                values (pt_id,  pt_name);
    end;By the way, it's a good idea to explicitly name the columns in an INSERT statement. It helps prevent bugs, and it keeps you procedure working if you forget to change it when you add columns to the table.

  • How to create a notification mailer that handles only some of Item Types

    Hi All,
    we are currently try to create another notification mailer to handle ONLY some of the workflows.
    I have been browsing the internet (oracle site and none) as well as looking for an answer here but I was unable to find a solution/detailed documentation.
    The only reference I was able to find is in the Oracle Workflow Admin's Guide where it's written "you can create a notification mailer that processes only messages that belong to a particular workflow item type" but it does not explain how.
    Can anyone help me?
    Thank You, Pier Paolo.

    You may use Correlation ID parameter of the mailer to specify the Itemtype that your mailer should process. This information should be available in the Workflow Admin Guide or Oracle Apps Admin Guide.

  • How to create procedure having delete statement with between function?

    I am very new in SQL Development, I want to create a procedure having two date variable start and end and these two variable i want to use in procedure body to delete data from a specific table between two date duration.
    Please guide
    Thanks,

    create procedure some_proc (start_date date, end_date date)
    as
    begin
         delete from your_table
                   where your_date_column between start_date and end_date;
    end some_proc;
    /

  • Visual composer  How to create an e-mail

    Hi everybody
    Someone can help me with the ownership of user data I need to create an iview to send emails
    and saw that this property is within the user data that comes in email
    How I Can  create a mail from this property with visual composer
    Thanks

    Hi,
    Plz follow the below Blog
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c09fd8a0-96ac-2910-a0ba-f00d2ab70949
    Regards,
    Govindu

  • How to create checkbox in mail content

    Hello,
    I have created a program to send mail. The requirement is to write some text in mail content along with pdf.
    The issue I am facing is that the mail content(body) should contain check boxes.
    At present the mail body fetches all text from SO10 standard text. I have tried inserting symbol in SO10 ( SAP-SYMBOLS ) but the out displays <697>,, instead of checkbox in mail.
    How should I create checkbox that are displayed in mail body.?
    <removed by moderator>
    Edited by: Thomas Zloch on Aug 10, 2011 12:01 PM

    go to the standard text > change editor > select PC editor
    now you can put an HTML TAG
    <br>
    <input type="checkbox" name="option1" value="Milk"> Milk
    <br>
    I can see the check box in SAP, but not in OUTLOOK... not sure whether we an issue with SAP or OUTLOOK or we entirely look in different way..

  • How to create a voice mail password if you did not do it when you bought the phone?

    I did not create a password for my voice mail when I bought the phone.  How can you do it now since I ignored the prompt when I first tapped voice mail?

    YOu will have to contact your cell provider to get the password, voicemail is a carrier feature.

  • How to create stationary in Mail

    I would like to create a stationary template in Mail. Any easy ways to do this?
    Thanks
    DC

    I have the same question and issue. How do you save the pictures after you place them in the "place older"?
    I compose the email text, click the stationary icon and select the stationary I want, the text shows up correctly, then I drag pictures to the stationary. I try and save as stationary the "save stationary" is not highlighted. I have tried several ways with no luck. I want to save the stationary just how I like it, without having to recreate it every time.
    Suggestions as to where I'm going wrong?

  • How to create a new mail db

    Hi,
    I want to change to lacation of my mails. Currently the database and the users account are on one Firewire drive (external). I want to create a new database on another disk. I don't care about moving the old one. Just want to create a new one.
    I know I must change settings in Server Admin, but before setting the new path I need to create all folders.
    Can someone tell me how to do it ?
    Thanks,

    Your question was about a creating a new one not about moving it. You explicitely said you do not care about the existing one. So yes, SA will do it for you.
    If you move a database by copying it, permissions can get lost and must be recreated manually.
    So these are two different issues.
    Just for my knowledge, what happens if hard disk
    names contains space ?
    Spaces in drive/directory/file names need to be escaped inside scripts/programs. Most of the time nothing happens, but sooner or later you may come across something that breaks your mail system. So it is a good and simple precaution not to use spaces at all. (mail partitions for example can sometimes cause issues)
    Alex

Maybe you are looking for