Run SQL script every 5 minutes

Hi:
I have a script which monitor the database. I want to make it to reflsh every 5 minutes on Linux. How to do it?
Thank you.

Hi,
Here is the small example.
Open the crontab in editing mode
$crontab -e
Insert following line.
*/5 * * * * /home/oracle/scripts/monitor.sh
This will schedule monitor.sh script to run every 5 minutes.
You can write any of your type in monitoring. For example following script will monitor alert.log errors...
#!/bin/ksh
. /etc/oracle.profile
for SID in `cat $ORACLE_HOME/sidlist`
do
cd $ORACLE_BASE/admin/$SID/bdump
if [ -f alert_${SID}.log ]
then
mv alert_${SID}.log alert_work.log
touch alert_${SID}.log
cat alert_work.log >> alert_${SID}.hist
grep ORA- alert_work.log > alert.err
fi
if [ `cat alert.err|wc -l` -gt 0 ]
then
mailx -s "${SID} ORACLE ERRORS" [email protected] < alert.err
fi
rm -f alert.err
rm -f alert_work.log
done
Note- Above is just for exmaple.
Regards

Similar Messages

  • Can my mac run a script every 15 minute?

    I have osx 10.7 and indesign CS5, and I use a script I run several times a day.  Would it be possible to have my mac start this script automatically - maybe every 15 minute?

    Hans!
    I have been testing this script for many times, and every time it fails to close the indesign-document! The original script you wrote (the small one that did not kill Apple-script-popup) did manage to close indesign-documents.
    Any idea why?
    I have changed my Indesign script so it does not end the job with a jolly popup message, so that problem is solved.
    The only problem left is the timeout message from Applescript.
    property pathToScript : ""
    on idle
              if pathToScript is "" then set pathToScript to (choose file with prompt "Please choose the Javascriptfile") as text
              my clickAlertButton()
              with timeout of 60 seconds
                        try
                                  tell application "Adobe InDesign CS5" --<<<<<<<YOUR APP!!!
      do script pathToScript language javascript
                                  end tell
                        on error e
      activate
      display dialog e giving up after 3
                        end try
              end timeout
              return 30
    end idle
    on clickAlertButton()
              tell application "System Events"
                        set namesOfCurrProcesses to name of every process
                        if namesOfCurrProcesses contains "Adobe InDesign CS5.5" then --<<<<<<<YOUR APP!!!
                                  try
                                            tell process "Adobe InDesign CS5" --<<<<<<<YOUR APP!!!
                                                      if accessibility description of window 1 is "alert" then
                                                                click button "OK" of window 1
                                                      end if
                                            end tell
                                  on error e
      activate
      display dialog e giving up after 3
                                  end try
                        end if
              end tell
    end clickAlertButton

  • Run sql script

    Hi,
    run sql script through command line(CMD). IS it possiple.
    Thanks.

    user638559,
    Do I miss something else ? Are you the OP ?
    Nicolas.
    And also, it's a dup thread
    run sql script
    Message was edited by:
    N. Gasparotto

  • Where to running SQL Scripts after install of ODAC for Oracle Client?

    I just installed ODAC for Oracle Client on a windows server, that runs a sql server database, for developers to connect a web app to an Oracle/Unix database. The install states to run SQL scripts located in the $ORACLE_HOME\ASP.NET\SQL directory after the install. I'm not sure where to run them? On the ORACLE DB on the Unix server? If someone could bring me up to speed I would appreciate it. Thanks.

    If I do run the scripts, do you know what user they should be run as? The developer are using ASP.NET for connectivity.
    Why there is no Oracle Expert answer this simple question? ?
    After ODAC 11.1.0.7.20 installation completed, there is a message in the last screen:
    *"Run the SQL script located in c:\app\Administrator\product\11.1.0\client_1\ASP.NET\SQL directory for a new installation or an upgrade of Oracle Providers for ASP.NET"*
    The question is: How to run these 9 SQL scripts ?
    In SQL*Plus, which oracle user should I connect to in order to run these 9 scrips, including:
    InstallAllOracleASPNETProviders.sql
    InstallOracleASPNETCommon.sql
    InstallOracleMembership.sql
    InstallOraclePersonalization.sql
    InstallOracleProfile.sql
    InstallOracleRoles.sql
    InstallOracleSessionState.sql
    InstallOracleSiteMap.sql
    InstallOracleWebEvents.sql

  • Is it Possible to Run SQL Script from Java prog

    Hello
    Is there any API by which we can run SQl Script file ,
    Just by giving database configration parameters and SQL Script file Path ,it will execute that script automatically

    You can excute SQL statemetns throught JDBC, but that doesn't have a facility to read those statements from a file. You'd have to write code to read the file and create and execute statements through JDBC. That should be pretty straightforward though.
    It's conceivable that there's a third party library out there that does it, if you know what to look for.
    If you're not familiar with JDBC, check out http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • How can I run script every 10 minutes

    Hello ,
    I just wondering if oracle application server has a way to run a normal java class,servlet or JSP for every (for example) 10 minutes.
    I mean I want to automate a java class for a spesific time like running a script on UNIX using CRON JOB
    Regards

    Mr. user510124,
    Please try to be as specific as possible. Mr. Raghavendra has given you a very good solution, which you can use. Other possible solution would be to schedule it with crontab (Unix) or using Oracle Grid Control.
    Regards,
    Martin

  • Running SQL script at a certain time

    Please suggest in application express what I need to do to run a sql script say 6.00 AM every day

    Hello,
    Take a look at DBMS_SCHEDULER, here's a good link with more information -
    http://www.oracle-base.com/articles/10g/Scheduler10g.php
    John.
    http://jes.blogs.shellprompt.net
    http://apex-evangelists.com

  • Run a script every workday

    Hello,
    I have several scripts I need to run every workday. During weekends I need to skip these scripts. I can't figure from launchd and launchd.plist man pages how could I make only one property list for each of these scripts. So I tried this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.justme.workdaystest</string>
    <key>ProgramArguments</key>
    <array>
    <string>/scripts/workdaystest.command</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>11</integer>
    <key>Minute</key>
    <integer>30</integer>
    <key>Weekday</key>
    <integer>1</integer>
    <key>Weekday</key>
    <integer>2</integer>
    <key>Weekday</key>
    <integer>3</integer>
    <key>Weekday</key>
    <integer>4</integer>
    <key>Weekday</key>
    <integer>5</integer>
    </dict>
    <key>WatchPaths</key>
    <array/>
    </dict>
    </plist>
    That didn't work. Do I need to maintain 5 x plist for each script?
    Juha

    J.Otava wrote:
    Hello,
    From the other topic I found need for arrays. Problem is I'm not sure how to create valid arrays. After some trials and errors I managed to create a valid XML-file, at least launchctl loads it without error messages. But nothing happens.
    Here's the code if someone is interested, should run a script on mondays and tuesdays:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.memyselfandi.ldaemontest3</string>
    <key>ProgramArguments</key>
    <array>
    <string>/scripts/ldaemontest.command</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>StartCalendarInterval</key>
    <array>
    <dict>
    <key>Hour</key>
    <integer>12</integer>
    <key>Minute</key>
    <integer>0</integer>
    <key>Weekday</key>
    <integer>2</integer>
    </dict>
    <dict>
    <key>Hour</key>
    <integer>12</integer>
    <key>Minute</key>
    <integer>0</integer>
    <key>Weekday</key>
    <integer>3</integer>
    </dict>
    </array>
    <key>WatchPaths</key>
    <array/>
    </dict>
    </plist>
    The array you've made is constructed correctly. if it's not working something else is wrong. check your console messages at the times when the script has to run. see anything? also, check that you load the plist properly.
    P.S. why do you have that empty Watch Path there? it's not doing anything.
    and you have an incorrectly constructed array that starts after QueueDirectories
    and ends after Watchpath. what is it doing there? perhaps that's what's creating the problem?
    My best
    Juha
    Message was edited by: V.K.

  • Running sql script files to re create database

    We have having around 10 sql script file that has sql statments inside it (example insert .... delete...update.... etc).Right now what we do is that in jdbc we open each script file, and read each line ,and then make jdbc call run jdbc for each sql statement inside the file.
    Wondering if there is a better way to do this.
    Right now the challenges are
    1)The process goes wrong if there is an extra semi colon ...or extra space after a statments...etc...Basically I find this way of creating data odd...
    2)it is slow because of the network traffic between application server and database server for every sql statements that gets executed.The solution for this issue is to do a batch update....But still I dont like this solution.
    Can someone give me any better idea.
    I am thinking to have all this sql script moved to a store procedure (rather than inside the sql script file) .JDBC then can pick this store procedure sql file ,and create this store procedure via jdbc, and then execute this store procedure.
    This will be faster because all the sql will be running in the databsase.Only one trip to database to call this store procedure.
    Is this a good idea ?
    thx
    m

    Manjit wrote:
    We have having around 10 sql script file that has sql statments inside it (example insert .... delete...update.... etc).Right now what we do is that in jdbc we open each script file, and read each line ,and then make jdbc call run jdbc for each sql statement inside the file.
    Wondering if there is a better way to do this.
    Right now the challenges are
    1)The process goes wrong if there is an extra semi colon ...or extra space after a statments...etc...Basically I find this way of creating data odd...
    2)it is slow because of the network traffic between application server and database server for every sql statements that gets executed.The solution for this issue is to do a batch update....But still I dont like this solution.
    Can someone give me any better idea.
    I am thinking to have all this sql script moved to a store procedure (rather than inside the sql script file) .JDBC then can pick this store procedure sql file ,and create this store procedure via jdbc, and then execute this store procedure.
    This will be faster because all the sql will be running in the databsase.Only one trip to database to call this store procedure.
    Is this a good idea ?
    thx
    mI'm not 100% sure i follow (it's Friday and i have a mild case of ADD).
    Are you suggesting having the Java application create procedures in the database on the fly? If so i would say that's not a good idea.
    Create the stored procedures in the database, have Java call them as needed to process data.
    If you need to load copious amounts of data, look in to external tables, it's possible they could come in handy for what you are doing .... or not ... again, it's hard to say given i find your description of what's currently happening somewhat confusing.

  • Clearing sequences, running sql script

    Hi,
    I'm using OWB 10.1.0.4.0 and I use a sequence to create a surrogate key in my tables. For the tabels that are deleted during the proces I want these sequences set to 1 again.
    Is there a possibility to run a sql script in a mapping or in the proces flow (with a drop, create, grant statement for the sequence) ?
    Thanks in advance,
    Arjan

    Thx, I'll try that on monday. If I'm correct I can import a .sql in a custom procedure?
    I'll update the thread on monday.

  • Running sql script from pl/sql

    Is there any standard way to run an external sql script from pl/sql
    I really appreciate any assistance.

    If you want, I did start writing a function reading and executing statements out of sql script with utl_file.
    can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';
    the function could be extended for DDL, session setting, etc...
    Regards
    Laurent

  • Running labview program every five minutes

    I am very inexperienced with Labview, but I am attempting to build a program.  This program is to get measurements of frequency (can be used to determine strain) and resistance (can be used to measure temperature).  I got the program to work when I push a button on the front panel to start the process and then process data when I push another button.  I need to get this process to be automated because it needs to run for a long time.  I want to take measurements (frequency and temperature) every five minutes. Also, I need to have some delay (maybe 10 sec) before the data is processed because it take time for the data to be received.  Any help is appreciated. I attached the .vi Thanks! 
    Attachments:
    VW DAQ.vi ‏266 KB

    GerdW wrote:
    Hi laplanmd,
    well, you didn't read the style guide before?
    That is the understatement of the year!    Hidden wires everywhere.  I would love to see the tracing with highlite execution on.  SampleCount is a race condition just waiting to happen.
    To the OP:  Please think of us poor volunteers that have to waddle through this mess to try to help you.  We can't decipher code that has hidden wires, right to left wires, structures put on top of controls/indicators.  Please try to clean things up before posting.  In your case, a total re-write using a state machine is very appropriate.
    - tbob
    Inventor of the WORM Global

  • How to run sql scripts using batch file for a web dynpro data dictionary

    Hi,
    I want to develop a sql script to be executed on the server alongwith the installation of a product to pre-populate web dynpro data dictionary tables required for the application.
    I further require to make the scripts independent of the database name,so that it can be run at any client environment.
    Your help will be appreciated and rewarded.

    See shoblock's answer
    call sql script from unix
    masterfile.sql:
    @file1 &1
    @file2 &2
    @file3 &3
    @file4 &4
    then just call the master script:
    sqlplus userid/password @masterfile <p1> <p2> <p3> <p4>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Jdeveloper-Running SQL Script Problem

    Hi
    Iam new bee to Jdeveloper.
    I have developed sample datbase application in jdeveloper;
    Can any one explain me how to excute Sql script??
    Thanx in advance
    smile

    Ziqew,
    you configure a database connection in JDeveloper where you specify the database connect information in the non-tnsnames form of server, port and SID.
    Running a scritp against SWL*Plus, you select the SQL script in JDeveloper and choose SQL*PLus from teh context menu. I am doing this all the time and don't get problems.
    Maybe your misunderstanding is that you add TNS names to where database SID is expected
    Frank

  • Running  sql scripts from different directory

    Hi
    I have sql scripts in different directories as follows:
    D:\myapp\sql
    - load.sql
    - init.sql
    D:\myapp\sql\schema
    -users.sql
    -structure.sql
    D:\myapp\sql\populate\
    - data1.sql
    - data2/sql
    load.sql call all the other scripts as below:
    @init.sql
    @schema\users.sql
    @schema\structure.sql
    @populate\data1.sql
    @populate\data2.sql
    All my scripts run correctly when I run load.sql from D:\myapp\sql on comand prompt.
    I need a way to run this script from a different directory say D:\ or C:\
    I am writing a installer which will execute from a different directory.
    Right now I get a file not found error for scripts within schema an populate folder.
    Please let me know how can I make this work from a different directory.
    Thanks
    kelvin

    Hi peter. i think you cannot run files spread across different locations.
    --the method which u specified always looks to the defined path                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • HELP please! my macbook keeps lagging after i transferred fonts into my comp.

    i got my macbook about 2 weeks ago and recently i transferred fonts into my mac and after that when i would use InDesign, it would take forever to open up like 1 min + and when i would go and change fonts or scroll through fonts it would lag. the rai

  • OS X freezes

    Hello - I want to see if anyone else is experiencing this issue I've been experiencing for almost two weeks now. After the system update last week, my MBP OSX freezes up randomly. My mouse is still available but everything else (dock, finder, everyth

  • Startup Disk Memory Inexplicably Low/Missing

    I normally keep a close eye on the amount of info going into my partitioned Mac HD (presently: capacity 29.88 GB, 27.64 Used, 2.23 Available), but I received a message today to the effect that "your startup disk is low in available memory..." while o

  • OS discs - wrong ones?

    Well, was loving my new refurb Mac until two nights ago...did a software update, during which i got a message saying the update had unexpectedly terminated. so i surfed a bit then switched my Mac off. Went back to it about 30 mins later, tried to tur

  • Safari 3.0.4 stalls when opening an address (URL)

    I installed the upgrade from 10.4.10 to 10.4.11 which includes Safari 3.0.4. I typed in an address (URL) to be opened. Safari 3.0.4 began the connection but then stalled part way through. I tried a couple of other addresses with the same result. Fire