Checking database availability with shell script

can anyone help with a script that checks for database availability before 10 P.M and 7 A.M at 5 minites interval and starts a SQL Load of a table once the db is available.
I have no Shell script experience at all but I can amend an already written script.
Please Help !!

Dear Timothy,
Within the Oracle software you have installed on your machine, there is a script called "dbstart" within the <ORACLE_HOME>/bin directory. This script provided by Oracle can be easily modified to check whether the server is up and should help solve your problem.
Ciao!

Similar Messages

  • SQL in Connection with shell scripts

    Hello everyone,
    I have a conceptual question:
    If people like to implement their SQL-Scripts attached on a shell script(Ruby, Perl, or even OS-Shell), what are actually the benefits doing this? Can someone please give me a szenario, which is very effectively if we do it with combination with shell-script.
    My second question: does oracle sql developer support this shell combination?
    Thank you..

    Wrapping sql script in a shell script provides flexibility. Shell can provide better parameter validation than SQL, better output handling, and better error trapping. Personally I would have the sql script separately for purist modularisation reasons, but you can merge the two.
    e.g.
    getdate.sql
    select sysdate from dual;getdate.sh can look like this
    sqlplus user/pwd @getdateor
    sqlplus user/pwd <<EOSQL
    @getdate
    EOSQLor
    sqlplus user/pwd <<EOSQL
    select sysdate from dual;
    exit
    EOSQLMy preference would be for either of the first two.
    You can use various shell facilities to capture the output of the sql statement for use elsewhere. Variations of the above example can be use to get the current database date and time into the shell environment for use in other queries, or in the shell itself.
    You can run SQL Developer from the command line, but the tool of choice for command line is SQL Plus.

  • Need to enable Usage Tracking With Shell Script

    Hi All
    I have patch 11.1.1.6.7 installed in system. I have Redhat linux 6 sytem
    Can we enable usage tracking with shell script ? if yes how ?
    Thanks
    Samit Baghla

    Hi Samit,
    No you can not as per my info because everything to be configured for the usage tracking is via repository and enterprise manager. You need to invoke it in em and rpd you need to do modelling. I still did not understand that why you want to create the shell script !!
    Thanks,
    Amol
    (Please mark this answer, if you found correct)

  • Issues with shell script

    Hi,
    I am executing on procedure using the shell script. The Shell script would the spool the output of the procedure into Status.txt file and send the condents through the mail. I am getting correct output when i run the job manually. But it is not giving the output when the job is scheduled in Crontab. Please find the below my shell script.
    ORACLE_SID=ora
    export TNS_ADMIN=/oracle/11.2.0/network/admin
    export ORACLE_HOME=/oracle/11.2.0
    export PATH=/oracle/11.2.0/bin:$PATH
    export LIBPATH=/oracle/11.2.0/lib32:$LIBPATH
    sqlplus -s test/test@test << EOFSQL
    SET HEAD off
    SET LINESIZE 8000
    SET feedback OFF
    SET pagesize 0
    SET termout OFF
    SET SERVEROUTPUT ON
    SPOOL Status.txt
    begin JobStatus();
    end;
    SPOOL off
    SET termout ON
    exit;
    EOFSQL
    TO='EmailID'
    file=/myFolder/Status.txt
    cat $file|mailx -s "Status" ${TO}

    The only PATH a user cron job knows by default is "/usr/bin" and "/bin", hence it won't find any Oracle applications. ORACLE provides a tool named "oraenv" to setup the required Oracle shell environment. oraenv reads /etc/oratab to setup $ORACLE_HOME, etc. It is by default installed in /usr/local/bin. The following example should work:
    #!/bin/sh
    # Filename: /home/oracle/scripts/sqlplus_sample.sh
    # Author: dude
    PATH=/usr/local/bin:$PATH
    export $PATH
    ORACLE_SID='orcl'
    ORAENV_ASK=NO
    . oraenv -s
    oradate=`sqlplus -s /nolog <<-EOF
      set pages 0 feed off
      connect / as sysdba
      select sysdate from dual;
    exit
    EOF
    `
    echo "`date`: Oracle $oradate" >> /tmp/sqlplus_sample.output
    [oracle@vm10]$ chmod 755 /home/oracle/scripts/sqlplus_sample.sh
    [oracle@vm10]$ crontab -l
    * * * * * /home/oracle/scripts/sqlplus_sample.sh
    [oracle@vm10]$ cat /tmp/sqlplus_sample.output
    Mon Dec 12 11:27:01 CET 2011: Oracle 12-DEC-11
    Mon Dec 12 11:28:01 CET 2011: Oracle 12-DEC-11
    Mon Dec 12 11:29:01 CET 2011: Oracle 12-DEC-11
    Mon Dec 12 11:30:01 CET 2011: Oracle 12-DEC-11Btw, exporting a shell variable means to make it available to sub-shells or child processes.
    Also, depending on how you connect, you don't need to export TNS_ADMIN. If you establish a local connection you will be connecting to the oracle database process directly using the BEQ protocol, in which case you don't even need a listener process running. For instance:
    $ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 12-DEC-2011 12:10:29
    Copyright (c) 1991, 2010, Oracle.  All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       Linux Error: 111: Connection refused
    $ sqlplus scott/tiger
    SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 12 15:05:57 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

  • Need help with shell scripting and Patching

    Hello all,
    I am a very new Oracle DBA and I just have an interview where i have been ask two questions that i have no idea of what it is
    1/ What is shell scripting and how do you do shell scripting?
    2/ What is Patching and how do you do patching?
    Can some one help to have a very good understanding of these tow questions?
    Thanks a lot

    1/ What is shell scripting and how do you do shell scripting?shell accept command from you (via keyboard) and execute them. But if you use command one by one (sequence of 'n' number of commands) , the you can store this sequence of command to text file and tell the shell to execute this text file instead of entering the commands. This is know as shell script.
    Shell script defined as:
    "Shell Script is series of command written in plain text file. Shell script is just like batch file in MS-DOS
    for example:- for taking backup, health check and doing some task Operating system level or Oracle database level we can create shell script and schedule a cron job
    2/ What is Patching and how do you do patching?for example ,in windows while using sometimes you might face an issue/error and it gives pop up error message would like to send/report this error to microsoft? microsoft will send you a fix for that. lot of fixes for errors/bugs are released as patches.( n number of patches with newer features are releases as new version)
    likewise in oracle for resolving bugs we should have to apply patch.
    patch is basically a fix for a bug/bugs. we need to use opatch utility to apply the paches.
    hope, this helps you

  • Pl/sql procedure with shell script

    Hi Guys,
    I will be updating some of the columns in the database thru SQL UPDATE stament. I want to make this process automatic. I.e instead of running manually this uodate process, i want to write a unix script which run on cron job. In the update stament I have to compare date like e_create_date > to_date (........, 'yymmdd') and date should be 2 days previous then to date and I would ike to create the spool file which I would like to send through mail.the script will run automatically.
    I am confused how to write shell script & sql procedure and how to call it inside the shell script. How can this be done.
    Help Appreciated.
    Thanks
    sonu

    save the Store procedure as a create_SP.sql in OS
    save another testrun.sql
    as follows
    begin
    sp_test('&p_test');
    end;
    If you are on a Unix or Solaris OS then
    open a Shell Script as follows :
    and name as test.sh or test.ksh
    var='SYSTEM'
    export var
    sqlplus username/password
    @create_SP.sql
    -- this created a store procedure on the database
    @testrun.sql $var
    This will execute the SP with parameter from OS Variable.

  • Java with Shell Scripts

    How can I include shell scripts in a java program?
    I want to create a GUI with Java and when I click a button or check a check box or choose something from a drop down list , I want a shell program to be called each time.For example, If i click a jbutton or check a jcheckbox, I want to execute something like this:
    sed 's/\([0-9]*\)\([-]\)\([0-9]*\)\([-]\)\([0-9]*\)\([-]\)\([0-9:.]*\)\(.*\)/\5\2\3\4\1\6\7/' $file >>temp;exit;;
    How can show the results on the GUI?
    All the graphical environment will be implemented with Java but underneath the job will be made by the scripts.
    I thank you in advance.
    I am looking forward to your answers.
    Lazaros

    Runtime#exec() returns a Process where you can call getInputStream().

  • Packagemaker with shell-script?

    I pulling my hair here. Trying to make a package with a shell-script, postinstall. When i try to choose it its greyed out so i cant select it at all. permissions are root:admin and 0555, i have no clue whats wrong anymore and i have searched the whole internet!
    Using Tiger with Xtools 2.1.
    Happy for all suggestions.
    thx

    1) If you have access to a Windows machine , run the problematic query in windows 'rwrun' and see whether there is any output That way we can find out whether this a 'shell' related problem . [ ie the way cmd lines are passed ]
    2) Backup and Edit the rwrun.sh script . There you can see
    rwrun $* # or something to this effect
    Instead of '$*' , put your command line args inside directly .
    Then just simply run using rwrun.sh < no args >
    Again , this is to see whether this problem is due to the way shell handles parameters
    3) You can even try setting env variables [ as in reports.sh ] and trying 'rwrun' in shell prompt itself
    rwrun <.....> # no .sh
    4) Please consult SuSe shell docs and see whether % [ or may be ' and \ ] has any special meaning.
    Thanks
    The Oracle Reports Team

  • How to skip password demands during DB creation with shel scripts from DBCA

    When Generating a Database automatically with scripts from DBCA passwords are asked 2 times 1 at begining and 1 at ora.ini DB initialization.
    Should I replace lines like
    connect "SYS"/"&&sysPassword" as SYSDBA
    with the real password since its a public password for testing databases.
    P.S.
    If such small questions are not apropriate and a burden to the cmmunity you may inform me.
    Till now if I can't find something on common search keywords, I add it, believing its a contribution to the Oracle communities knowledge base

    I found the solution. As MarkDPowell pointed out, the input prompt happens cause of ACCEPT so have to comment it out.
    And I can pass my own public password as a variable with DEFINE - http://docs.oracle.com/cd/B10501_01/server.920/a90842/ch13.htm#1008884
    P.S.
    I try not leaving non-Answered threads.

  • Help with shell script

    Can anyone here help me (getting my feet wet) with an addition to a profile (applmgr) that I am trying to make - in the form of a shell script.
    I have the following lines in the profile file - but each time I log into the server as applmgr, I get the error following
    if $HOSTNAME=hostname1
    tnen
    . /u01/xxees/EBST/apps/apps_st/appl/APPSEBST_$HOST.env
    fi
    if $HOSTNAME=hostname2
    ./u01/xxees/EBST2/apps/apps_st/appl/APPSEBST_$HOST.env
    fi
    The error message I am getting us
    -bash: /local/ebsuser/applmgr/.profile: line 39: syntax error near unexpected token `fi'
    -bash: /local/ebsuser/applmgr/.profile: line 39: `fi'
    Thank you all.
    Edited by: 864641 on Jun 13, 2012 1:49 PM

    From the Error Message at line Number 38, I feel that, the file /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOST.env (where $HOST can be "hostname01" or "hostname02") has been modified and has unmatched if.
    Also, If you are using the variable HOSTNAME, I feel that the env file should be like /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env in which case your script will be like:
    if [$HOSTNAME == "hostname01"]; then
    . /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
    fi
    if [$HOSTNAME == "hostname02"]; then
    . /u01/xxees/EBSTEST2/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
    fi
    Hope that this two things will help in resolving the issue.

  • Threads in java with Shell script

    hello
    I have shell script program which prints continuous number upto infinate.
    that shell script program is running or not i want to see by using threads in java can any one help me out.
    thanx
    mahen

    mark1971 wrote:
    You have to keep in mind that once a Thread finishes the run method you must not reuse it.Perfectly said. I believe sleep() can be replaced with wait() n notify(), if it is based on pre defined condition.
    For example, when input value read ( from kbd or socket etc) is "start", or time is between 2 pm and 3pm, this thread has to be executed.
    Once thread done its work, it can be again moved to wait() state.
    1. No need of stopping thread here.
    2. I think wait() may cause to latency.
    Please correct me if I am wrong.

  • HELP with Shell scripting!!!

    Hello all,
    I'm very new to shell scripting and I'm trying to learn a little more as I go on. I'm trying to write a shell script to create a symbolic link to an application and have it moved to the current user's desktop. I've been doing some testing with the default applications installed on Leopard here is what I have so far...
    ls -s /Applications/Chess.app
    I've trying using cp commands, but I continue to get error messages. The above script does create a symbolic link to my home directory, but I want to then move it from the home directory to the current user's desktop. Can anyone lead me any further?
    Thanks in advance for any help!

    I'm also having a problem making my shell script unix executable. I have tried chmod +x path/to/script and then I killall Finder but nothing happens. Am I doing something wrong?
    Are you trying to make your script "Double-Clickable"?
    Then you still need to do the
    chmod +x /path/to/script
    But that will just make it something you can run from a shell.
    If you want double-clickable, you can create an Automator app
    Applications -> Automator -> Run Shell Script
    Or you can download the free Platypus utility that will make any script a double-clickable applications.
    Or you can name your script
    myscript.command
    where the .command is the important part, which the Finder will treat as something it should execute as a shell script when double-clicked.
    And no killing Finder. They will work without messing with the Finder.
    Personally, I prefer the Automator app or Platypus. Well I also work a lot in the shell, and I execute scripts as script in the shell all the time, so I only create a lot more scripts that get executed as commands than I do double-clickable scripts.

  • Automatic Database Backup using Shell script

    Hi,
    Can anybody share a sample shell script to take automatict backup of database.So, that It help preparing the same in our enviroment.
    Thanks,
    Sami

    Hi,
    Thanks for your inputs. But here are the details
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    Platform 86_64 linux.-redhat-release-4ES-7.
    Can you please suggest taking automatic backup as a sample script. so that a demo can be created and tested in development environment.
    --sami                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • [SOLVED] Change environment variables with Shell scripts

    How can I change the "BROWSER" environment variable with a shell script; so I can change it on the fly?
    Last edited by oldtimeyjunk (2012-10-31 12:57:42)

    If you just want to do it for BROWSER so that you can change your default web browser on the fly, you could set BROWSER to e.g. ~/bin/mybrowser and create a symlink to the browser you want at ~/bin/mybrowser. Then you could change the symlink at will.
    EDIT: man xdg-settings
    Last edited by cfr (2012-10-31 02:20:16)

  • Control SAP Services with shell script?

    Hi,
    I want to write a shell script which do atomatically stop and start all sap services which are shown in the sap mmc console.
    Does anybody knoe the command??
    Regards,
    Stefan

    Stefan,
    First you should login as <SYSID>adm and the command for startup is <b>startsap</b> and for stopping <b>stopsap</b>
    Regards
    Shravan

Maybe you are looking for

  • Clicking in flash objects partly crashes Opera 10.60

    System: Arch Linux 64bit Opera version: 10.60 64bit Flash version: 10.1.53.64 (32bit) Hi, I have a problem with flash since upgrading to the new Opera version. Flash stuff works fine, until I click on a flash applet for the first time (like hitting '

  • Problems with mobile projects with apache flex 4.8 and an overlay of the latest air sdk

    Using flash builder 4.7 beta, apache flex 4.8 and an overlay of the latest air sdk, i got resolution problems while testing the mobile app (windows version on windows 7) with the air (ipad)emulator. That means the emulator is much bigger than my scre

  • Why do we apply patches

    Dear all, I am very new to Oracle database, so question arise and I post them. I need to know that why do we apply patches and what is DBA's advice regarding applying patches. Thanks to all ben

  • Hey how do i get movies on my IPOD?

    Hey I was wondering if there is anyway to get my legitamently purchesed DVDs onto my iPOD? I woulsd really love to watch a movie I have already paid for on my iPOD. Can I use iTunes to import the DVD like a CD or do I need another program to get the

  • What iPhone app does this to photos?, What iPhone app does this to photos?

    The effect is like light streaks I've seen it a lot on instagram but idk how to get it??  The link below shows what it looks like if anyone knows please show me! Thank u so much Example link http://www.photoshopessentials.com/photo-effects/light-stre