shell script for oracle alert.log file

Hi gurus,

I want to write the shell script to know the last timing 10 stop of the database of the alerts log file. I'm working on oracle 9i.

Could someone please advice on that.

Thanks in advance

Kind regards
Shaan

Published by: Shaan_dmp on January 5, 2009 13:27

Published by: Shaan_dmp on January 5, 2009 13:28

Use awk. I have not at hand a 9i but here is a very simple version for 10g XE

My awk file (line numbers for the notes below - don't include them):

01:BEGIN { prevline = "";} 02:03:/Completed: alter database close/ {print prevline,FS,$0;}04:05:{prevline = $0;}

The command line and the results (from my alert log 300 k)

$ awk -f alert.awk.txt alert_xe.logFri Apr 11 18:08:40 2008   Completed: alter database close normalFri May 16 18:53:21 2008   Completed: alter database close normalTue May 20 17:28:23 2008   Completed: alter database close normalThu Jul 17 19:08:52 2008   Completed: alter database close normalFri Aug 15 15:12:48 2008   Completed: alter database close normalWed Nov 05 08:52:59 2008   Completed: alter database close normalFri Nov 14 16:36:03 2008   Completed: alter database close normalTue Dec 09 10:46:23 2008   Completed: alter database close normalMon Jan 05 11:12:22 2009   Completed: alter database close normal

What it means:

(1) section START line 01 defines the variable to contain the previous line
(2) the /search chain / line 03 search marker in the file for a stop, and then performs the requested action (print the time that was in the previous line and then this line; use FS (the field to the awk - space normally separator) as a separator
(3) on line 05 is a statement that we do on each line - is remembered in case it is the timestamp for the closure.

Now, you can include several cases corner for closures by adding several models of research etc. For more information, google for examples of awk.

AWK is really good at this sort of thing!

HTH

Nigel cordially

Tags: Database

Similar Questions

  • alert log file notification e-mail

    Hi all

    A DBA, you should check the alert log file again and again for troubleshoting,
    Is there a method to make self as each time that no matter what error / warning encountered in file alert log a mailbox on my Inbox? No matter what script that I put with cron which monitor log file and I would like to know if the log file is good or not...



    Please suggest is possible to do?

    Hello
    You can do this in

    (1) ORACLE ENTERPRISE MANAGER GRID CONTROL OR
    (2) IN WRITING SCRIPTS

    Described by the links below:

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b25159/monitor.htm
    http://www.my-Whiteboard.com/Perl-script-Oracle-database-alert-log-parser-send-email-notification-if-error-is-found/

    Best regards

    Rafi.
    http://rafioracledba.blogspot.com/

  • Why my alert log file is not updated

    Dear all,

    Please find below my workplace

    OS - Windows server 2012

    version - 11.2.0.1.0

    Server: production server

    I checked my alert log file, there is no entry in recent day. He finally stopped on August 31. Please find entry line last two in the alert log file

    Mon Aug 31 10:30:23 2015

    Archived journal 72088 extra for each sequence 1 79292 0x38b3fdf6 dest ID thread entry 1:

    Why it is not updated after August 31.

    Please help me on the rest of my points

    (1) is there a way to know why he is not up-to-date.

    (2) If an order wrongly manually to alert the log entry, so how can I take to update as usual.

    Please make sure that you review the correct alerts log by using the following query:

    SELECT THE VALUE

    V $ diag_info

    WHERE name = "Diag Trace"

    If this is the right place, then perhaps there is no activity that should be recorded in the log of alert since August 31.

    You can manually print something for journal alerts to check this using:

    Exec DBMS_System.ksdwrt(2, 'TEST');

    Alternatively, you can manually run the command of journal and see if new lines are written to the log of alerts using the following command:

    alter system switch logfile;

  • Alerts log files...

    Hello

    It is really very difficult to go through the alerts log files.

    Y at - it no tool or any method is there to play the the alerts in a simple way log files.

    do not read the whole alert log all the time...
    Use the tail command, it will give you the last line as...

    alert_database.log tail - 50 (for the last 50 lines...)

    A new ADRCI command is also there, but I think first of all learn the basics...

    Use Enterprise manager, which helps you easily get an alert.

    Published by: Christel Kumar on October 18, 2012 21:16

  • Deleted alerts log file

    What happens if alert log file is deleted?

    What happens if alert log file is deleted?

    It will be recreated again. See below

    sys@11GDEMO > show parameter background

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    background_core_dump partial string
    / oracle/11 g/diag/rdbms/11gdemo string background_dump_dest
    + / 11gdemo / trace +.
    sys@11GDEMO >! ls - ltr/oracle 11 g/diag/rdbms/11gdemo/11gdemo/trace/al *.
    -rw - r - 1 oracle oinstall 199294 16 Jul 03:11 /oracle/11g/diag/rdbms/11gdemo/11gdemo/trace/alert_11gdemo.log

    sys@11GDEMO >! RM /oracle/11g/diag/rdbms/11gdemo/11gdemo/trace/alert_11gdemo.log

    sys@11GDEMO >! ls /oracle/11g/diag/rdbms/11gdemo/11gdemo/trace/alert_11gdemo.log
    + ls: /oracle/11g/diag/rdbms/11gdemo/11gdemo/trace/alert_11gdemo.log: no such file or directory.

    sys@11GDEMO > alter system switch logfile;

    Modified system.

    sys@11GDEMO >! ls /oracle/11g/diag/rdbms/11gdemo/11gdemo/trace/alert_11gdemo.log
    */Oracle/11g/diag/RDBMS/11gdemo/11gdemo/trace/alert_11gdemo.log*

    sys@11GDEMO >

  • maxlscript for backup of log files

    Hi all
    I want the maxlscript for taking backup of the essbase server logs and after taking her delete backup files of content of the logs from the server log. After that whenever I take abackup of the logsfrom server, it should do the same process and replace the backup of newspapers that I took earlier.


    All Thankingyou
    Concerning
    User2271

    You can go about this a number of ways.

    Unix cp command to copy the log, then call a maxl script that removes the application log.

    Or you can use maxl to stop the application, use the unix cp command to copy the file, then unix command rm to delete the log file.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • KB954430 continues to appear in Windows Update, Error Message for lack of Log File during manual re - install

    I followed several other discussions about the inability to install this update, but I succumbed.

    My problem started when I did a system restore to solve a problem with a newly installed program.

    Under update history, windows update is of the opinion that this update has been successfully installed several times.

    The 954430.log log file is not present in my windows directory.

    The update is not present in the list of installed updates.

    I moved msxml4.dll and msxml4r.dll in the system32 directory.  When I try to reinstall KB954430 manually, the following error message is received: "error opening installation log file.  Verify that the specified log file location exists and is writable. »

    Thanks in advance for your help.

    Thanks for the attempt to help Umesh P.  Went before your answer.
    Something I've done has solved the problem, if I'm not 100% of the exact solution.

    So, I found some of these random number files that contains kb954430 log files in the home directory of my swap file partition.  I deleted these.

    I tried to reinstall manually, it still gave me the same "log file" error as described in my post above.  Then, I tried to install it via the automatic update service.  Then, he stated that the update was not necessary.  The update kept bugging me on this subject, but finally, after a reboot or two, I noticed he had stopped to ask.
    My computer seems to work now, as far as I know, although I do not have the patch installed in my list of updates, and the msxml dll never came back.  Is there a chance that the patch was never installed and he abandoned?
  • Directory for the frmcmp_batch log file

    Hello

    Where can I find the directory of the log file for frmcmp_batch?

    Thank you

    Nadhrah

    Hello

    If you do not specify the name of the directory, by default it will be generated in the current directory.

    Coco - M

  • Model reusable SQL Oracle to create a DDL/DML Scripts for Oracle database

    Hello


    I have an obligation to set up a model of Oracle SQL to create the Scripts DDL/DML reusable for Oracle databases.
    Only the Oracle DBA will run scripts permissions is not a problem.

    The workflow for any DOF is as follows:-

    (1) new table

    a. check whether the table exists in the views system/admin.
    b. If the table exists then give message "Table exists".
    c. If the table does not exist then run DDL code

    (2) add the column

    a. check if the column exists for a given table of the system/admin views
    b. If the column exists in the specified table.
    B1. backup table.
    B2. ALTER table alter column
    B3. check data or execute convert dml sauvegardΘ to the new change script.
    c. If the column does not exist
    C1. backup table
    C2. ALTER table add column
    C3. Run dml to populate the column with the default value.

    The DML scripts are to populate the base tables with the data required for business operations.

    (3) addition of new line

    a. check if the line exists by comparing the old values of each column with the new values to be added for the new record.
    b. If there is, to give message line is
    c. If not exists, add the new record.

    (4) update existing record (we createtime columns in these tables as well as changes can be tracked)

    a. check if the row exists using the primary key.
    b. If there is.
    B1. off the record by using the "active" column of the table
    B2. Add new record with the necessary changes.
    c. If does not exist, add the new record with the necessary changes.

    Could you please help with some ideas that can get this done with precision?
    I tried several ways, but I am not able to set up something that meets all the requirements.

    Thank you

    If it helps at all. Sometimes we have a requirement for a DDL statement to be rerunable and her only error if something completely unexpected happens.

    It's a little monstrous, but basically, we wrap all DDL in a dynamic statement and capture errors that would indicate that the DDL script has already been run:

    Here's a bit of a model:

    declare
       w_ddl varchar2(32767);
    begin
       begin
          --
          dbms_output.put_line('Creating table TABLE_NAME');
          --
          w_ddl := 'CREATE TABLE MY_SCHEMA.TABLE_NAME
                    ( COLUMN_1     DATE          NOT NULL
                     ,COLUMN_2  VARCHAR2(10)  NOT NULL
                     ,COLUMN_3  DATE
                    )';
           --
          execute immediate w_ddl;
          --
          dbms_output.put_line('Successfully created table TABLE_NAME');
          --
       exception
          when others then
             if sqlcode = -955 then
                dbms_output.put_line('Table Already exists.');
             else
                dbms_output.put_line('creation of table TABLE_NAME failed:');
                dbms_output.put_line(sqlerrm);
                raise;
             end if;
       end;
    
      begin
          --
          dbms_output.put_line('Creating unique primary key constraint for TABLE_NAME');
          --
          w_ddl := 'ALTER TABLE MY_SCHEMA.TABLE_NAME ADD (
                   CONSTRAINT TABLE_NAME
                   PRIMARY KEY
                   (TABLE_NAME_ID) USING INDEX)';
           --
          execute immediate w_ddl;
          --
          dbms_output.put_line('Successfully created primary key on TABLE_NAME_ID');
          --
       exception
          when others then
             if sqlcode = -02264 then
                dbms_output.put_line('constraint already exists.');
             else
                dbms_output.put_line('creation of primary key failed:');
                dbms_output.put_line(sqlerrm);
                raise;
             end if;
       END;   
    
    <>
    

    It works well with our scripts to autmoated and help us when we iterate through development and back in if needed test environments.

    In this way, we can add the DDL statements to the deployment script and run the script again without error to set the database to the State required without having to run the newly created statement only.

    Sometimes this approach translates into a creation followed a statement alter table statement to add a column, but the end result of the script is always the same, and the deployment script can be controlled at source between iterations of development that is without having to restore the ddl changes to test the modified DDL script.

    hope that gives you some ideas.

  • Need a script for InDesing culture pdf files

    Hello

    I have over 200 pages pdf file. I need to place pages in InDesign, jump the 4 sides about 20mm in InDesign. I did place using the script. I need to crop all pages, including at - it a script for the same... ?

    Thanks in advance.

    Hello

    You can try with the code below:

    var myDoc = app.activeDocument;
    var myGraphics = myDoc.allGraphics;
    for (var a = 0; a
    

    But make sure that your rule should be in mm.

    This is Zanelli script to put pdf in Indesign.

    Shonky

  • DBMS_SCHEDULER - trying to create and run a UNIX shell script from Oracle

    How can I run Script Shell Unix from Oracle using DBMS_SCHEDULER?

    After reading many examples online, I finished the 3 steps below.
    Create program, create jobs, run task. On my 3rd stage, I get the following error.
    How can I make sure that the work was created?

    ORA-27475: "APPS. POSPAY_FILE_CHECK_JOB' must be work

    (1) create the program
    BEGIN
      dbms_scheduler.create_program(
         program_name => 'POSPAY_FILE_CHECK_PROG',
         program_type => 'EXECUTABLE',
         program_action => '/home/ldcgroup/ldccbc/POSPAY_USC2_CHECK.sh',
         number_of_arguments => 0,
         enabled => TRUE,
         comments => 'Test Program'
         );
    END;
    (2) create jobs
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
       job_name          =>  'POSPAY_CHECK_FILE_JOB',
       program_name      =>  'POSPAY_CHECK_FILE_PROG',
       enabled           =>   TRUE);
    END;
    /
    (3) the job (not calendar, I'll run this a concurrent request of EBS)
    BEGIN
       DBMS_SCHEDULER.run_job (
         job_name => 'POSPAY_FILE_CHECK_JOB');
    END;
    /

    Of [documentation | http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/scheduse002.htm#i1009668]

    The job is created disabled. You must enable it with DBMS_SCHEDULER.ENABLE before the Scheduler will automatically run it.
    
    Jobs are set to be automatically dropped by default after they complete. Setting the auto_drop attribute to FALSE causes the job to persist.
    
  • Who writes the alert log file?

    Hi guys,.

    I tried to answer this question...

    What process (process backgroud) written in newspaper alert?

    Is not "one" but all background processes can / write for her.

    The archiver written for her. LogWriter can write (if you have log_checkpoints_to_alert).
    When a background process detects that another died, the former written to the alert log in before you panic the instance and kill him.

    An ALTER SYSTEM command issued by the server process for your database session will also write to the alert.log

    (Alternatively, you can call a specific procedure of data to write in it - but it is not documented).

    Hemant K Collette

  • What LKM must be used for oracle data to file

    Hi all
    I am new to ODI. Please help me understand this tool.
    I want to know WHAT LKM, which must be used to transfer data from oracle to a file separated by commas, etc.

    Try

    IKM SQL to the file Append

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Inconsistent timestamp in the oracle alert log

    Hello

    no idea why disconnection alert goes crazy? -bad weather all the time?

    Thu Nov 12 14:25: 58 2015

    alter database add logfile Member ' / DATA/oracle/oradata/RAC/onlinelog/redo4.log' to group 4

    Completed: alter database add logfile Member '/DATA/oracle/oradata/RAC/onlinelog/redo4.log' to group 4

    Thu 12 Nov 07:26:162015

    ALTER DATABASE BACKUP CONTROLFILE to ' / DATA/oracle/oradata/RAC/CONTROLFILE/1447313176199A0XS_5632.T'

    3038031 wrote:

    $cat /u01/app/11.2.0.4/grid/crs/install/s_crsconfig_em01db01_env.txt

    # This file can be used to change the NLS_LANG environment variable which determines the character set to use for messages.

    # For example, a new set of characters can be configured by setting NLS_LANG = JAPANESE_JAPAN. UTF8

    # Do not modify this file except to change NLS_LANG, or under the direction of Oracle Support Services

    TZ = US / Eastern

    NLS_LANG = AMERICAN_AMERICA. AL32UTF8

    TNS_ADMIN =

    ORACLE_BASE =

    can I change this file, and then restart the database cluster.

    Yes, you can change and rebounce is required for agents to get the time zone collection.

    It may be useful

    -Pavan Kumar N

  • Script for the library project files

    I want to create a library project that I can use with multiple Flex applications.  I'm moving the files from one of my apps in this new library.  However, one of the files that I brought to the wire is an actionscript file that I use in several files.  It's a bunch of generic utility methods that are nice to have.  I included it in the files like this:

    < mx:Script " source ="utilityScripts/UtilityScript.as """/ >

    Here is a small sample of code in this file:

    Import mx.rpc.events.FaultEvent;

    Import mx.controls.Alert;

    public function handleFault(event:FaultEvent):void {}

    Alert.show (event.toString (), 'Error');

    }

    In the original file, I said not yet as part of a package and it worked fine.  But now in the library project it gives me this error at the beginning:

    1114: the public attribute can only be used inside a package.

    So, if I give him a package name:

    package utilityScripts

    It then gives me a new error:

    1037: packages cannot be nested.

    How can I get this file in the library project?

    Yes, in your project library of all the files must have a package and class name,

    AFIK

Maybe you are looking for

  • Satellite Pro L - error message when I try to play a music CD

    When I try to play a music CD I get this error message > + "The version of this file is not comparable with the version of Windows you are using. Check +.+ system information from your computer to see if you need a x 86 (32 bit) or x 64 (64 bit) +.(+

  • New Satellite P850 would not start

    I recently bought a new laptop Satellite P850-32Z (Windows 8) nine only he had yesterday and now I have problem try to start the laptop. When I turn on the laptop, I get the Toshiba leading innovation screen then a message saying 'preparation auto re

  • I want to buy clip + and have several questions

    is it possible to recharge without usb cable and computer, but a simple reload you have with your mobile phone? is - it really last 15 hours battery? the sound is as good as people say?

  • How to stop those annoying pop ups of my firewall alert?

    If I click on block or allow again, it continues to appear and won't get awa, it happens all the time I'm on the computer. Then I click on "don't show me this message again", but it comes back.   How can I know which application is good anyway? "This

  • laptop wireless problem

    my computer hp laptop 255 g2 cannot connect to the wireless network.