Shell scripting for oracle DBs

looking for good source for shell scripting for oracle DBs

Just buy 'Classic Shell Scripting' and 'the Unix Desktop Reference' both published by O'Reilly and you have it all.
But if you want a platform agnostic scripting language use Perl. Comes with Oracle.
However both bash and kornshell are a lot easier compared to Perl.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Can anybody provide AIX shell script for Oracle Apps R12 instance backup

    Hi
    Can anybody provide AIX shell script for Oracle Apps R12 instance backup? Manually, i am able to backup but i donot have shell script to schedule through crontab.
    Help me please.
    Thanks

    Rman can be used for Database, not for Application tier. Again, I assumed you are looking for a script to backup the database. For the application tier, you can simply do a filesystem backup.
    I still do not understand your concern? Is it about using crontab? If so, then check here --> man crontab <--

  • Shell script for oracle alert.log file

    Hi Gurus,
    I wanted to write shell script to know the last 10 shutdown timings of the database from alert log file. I'm working on oracle 9i.
    Could anyone please advice on this.
    Thanks in advance
    regards,
    Shaan
    Edited by: Shaan_dmp on Jan 5, 2009 1:27 PM
    Edited by: Shaan_dmp on Jan 5, 2009 1:28 PM

    Use awk. I don't have a 9i to hand but here is a very simple version for 10g XE
    My awk file (the line numbers are 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 results (from my 300k alert log)
    $ awk -f alert.awk.txt alert_xe.log
    Fri Apr 11 18:08:40 2008   Completed: alter database close normal
    Fri May 16 18:53:21 2008   Completed: alter database close normal
    Tue May 20 17:28:23 2008   Completed: alter database close normal
    Thu Jul 17 19:08:52 2008   Completed: alter database close normal
    Fri Aug 15 15:12:48 2008   Completed: alter database close normal
    Wed Nov 05 08:52:59 2008   Completed: alter database close normal
    Fri Nov 14 16:36:03 2008   Completed: alter database close normal
    Tue Dec 09 10:46:23 2008   Completed: alter database close normal
    Mon Jan 05 11:12:22 2009   Completed: alter database close normalWhat it means:
    1) the BEGIN section at line 01 defines the variable to hold the previous line
    2) the /search string/ at line 03 finds the marker in the file for a shutdown, then does the required action (print the time which was in the previous line, and then this line; use FS (the awk field separator - normally space) as a separator
    3) at line 05 is an instruction we do on every line - so we remember it in case it is the timestamp for the shutdown.
    Now, you can include more of the corner cases for shutdowns by adding more search patterns etc. For more information, google for awk examples.
    Awk is really good at this sort of thing!
    HTH
    Regards Nigel

  • Shell Scripts for Oracle monitoring????????????

    Hi All
    I am planning to monitor oracle through Unix scripts.Can anybody tell me where can i find such readymade scripts e.g. to check if Instance is up and running,listener is up and running,error in alert log,space in tablespace etc...
    Thanx
    Gagan

    I think asm is in an early adoption phase, as there are few sites that reference to asm administration scripts, but a couple can be found, just to start:
    http://halisway.hifichoice.com/oraasm
    and a sample asm to list files:
    ##### list_all_files.sql
    ##### generate a list of all the asm files / directories / aliasses for a given database
    column full_alias_path format a70
    column file_type format a15
    select concat('+'||gname, sys_connect_by_path(aname, '/')) full_alias_path,
           system_created, alias_directory, file_type
    from ( select b.name gname, a.parent_index pindex, a.name aname,
                  a.reference_index rindex , a.system_created, a.alias_directory,
                  c.type file_type
           from v$asm_alias a, v$asm_diskgroup b, v$asm_file c
           where a.group_number = b.group_number
                 and a.group_number = c.group_number(+)
                 and a.file_number = c.file_number(+)
                 and a.file_incarnation = c.incarnation(+)
    start with (mod(pindex, power(2, 24))) = 0
                and rindex in
                    ( select a.reference_index
                      from v$asm_alias a, v$asm_diskgroup b
                      where a.group_number = b.group_number
                            and (mod(a.parent_index, power(2, 24))) = 0
                            and a.name = '&DATABASENAME'
    connect by prior rindex = pindex;~ Madrid.

  • Shell script for export backup in oracle 11g

    Hi,
    Oracle version 11.2.0..
    O/S-AIX
    How to write shell script for export full backup in oracle 11g and also need to remove 2 days of old backup.
    Regards,
    Raju

    How to write shell script for export full backup in oracle 11g
    Do you mean that export is your backup strategy ? is your database running in noarchivelog mode ? if so, then why ? if not so, then why not RMAN ?
    need to remove 2 days of old backup.
    If that mean remove files older than 2 days, you can use something like this :
    $ find <absolute directory path> -mtime +2 -exec rm {} \;

  • Need Help in creating Unix Shell Script for database

    Would be appreciable if some one can help in creating unix shell script for the Oracle DB 10,11g.
    Here is the condition which i want to implement.
    1. Create shell script to create the database with 10GB TB SPACE and 3 groups of redo log file(Each 300MB).
    2. Increase size of redolog file.
    3. Load sample schema.
    4. dump the schema.
    5. Create empty db (Script should check if db already exists and drop it in this case).
    6. Create backup using rman.
    7. restore backup which you have backed up.

    This isn't much of a "code-sharing" site but a "knowledge-sharing" site.  Code posted me may be from a questioner who has a problem / issue / error with his code.   But we don't generally see people writing entire scripts as responses to such questions as yours.  There may be other sites where you can get coding done "for free".
    What you could do is to write some of the code and test it and, if and when it fails / errors, post it for members to make suggestions.
    But the expectation here is for you to write your own code.
    Hemant K Chitale

  • Shell script for archive log transfer

    hi
    I dont want to reinvent the wheel.
    I am looking for shell script for log shipping to provide standby db.
    What I want to do is, get the last applied archived log number from alert.log
    Copy the files from archive destination according to this value.
    Cheers

    If you don't want to re-invent the wheel you use Dataguard, no scripts.
    And your script should use the dictionary, instead of some bs method to read the alert.
    v$archived_log has all information!
    Also as far as I know, the documentation describes manual standby.
    So apparently you not only don't want to reinvent the wheel, but you want the script on a silver plate on your doorstep!
    Typical attitude of most DBAs here. Use OTN for a permanent vacation.
    Sybrand Bakker
    Senior Oracle DBA

  • Shell script for batch compilation of forms 10g on AIX 5.3L AS

    Hi All,
    Can anybody provide me the Shell script for batch compilation of forms 10g and reports 10g on AIX 5.3L AS?
    Regards,
    SAM

    Hi Alex,
    I tried with the below script as well as the one you had posted.
    ORACLE_HOME=/opt/oracle/OraHome_3
    export ORACLE_HOME
    TNS_ADMIN=$ORACLE_HOME/network/admin
    export TNS_ADMIN
    LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/jdk/jre/bin:$ORACLE_HOME/jdk/jre/bin/cla
    ssic:$LIBPATH
    export LIBPATH
    cd ../forms
    for i in `ls *.pll`
    do
    echo Compiling Library $i ....
    $ORACLE_HOME/bin/frmcmp module=$i userid=mydbuser/mydbuser@mydb
    batch=yes module_type=library
    compile_all=yes window_state=minimize
    done
    export ORACLE_HOME=/opt/oracle/OraHome_3
    export ORACLE_TERM=vt220
    export LD_LIBRARY_PATH=/opt/oracle/OraHome_3/lib:/opt/oracle/OraHome_3/jdk/jre/l
    ib:/opt/oracle/OraHome_3/jdk/jre/lib/i386:
    cd ../forms
    for i in `ls *.pll`
    do
    echo "Compiling Library $i ...."
    /opt/oracle/OraHome_3/bin/frmcmp module_type=form userid=mydbuser/mydbuser@mydb
    module=$i batch=yes compile_all=no
    window_state=minimize upgrade=no
    done
    echo "PLL Compilation done"
    But there was a same kind of error thst turning up all the time.
    Compiling Library Agf.pll ....
    Forms 10.1 (Form Compiler) Version 10.1.2.0.2 (Production)
    Forms 10.1 (Form Compiler): Release - Production
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.0 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE 10.1.0.4.0 Production
    FRM-10043: Cannot open file.
    Form not created
    I hence updated the permissions on the pll as below
    -rwxrwxrwx 1 oracle oinstall 335872 May 19 16:31 Agf.pll
    But the problem is still persisting.
    My environment details are as below.
    I am working on Win XP machine. Connected to my AS via telnet and xmanager. I have set my DISPLAY to my local IP.
    Is there any thing more that I need to do? If so then let me know.
    Regards,
    SAM

  • Shell script for DB backup

    HI,
    i have written some java code Database backup but there are some problems with that so now i need to write shell script for db backup.
    what i was doing in java code i was running command like that
    /usr/local/bin/tar cvzf /export/home/monitor/FILE_20091005.tar.gz FILES/*20091005.*which compress the all *20091005* files (myisam table files)
    but after compression file doesn't extract
    so i have to write shell script for that ..... can any body guide me how can i write that kind of script and put it in cron job.
    thanks

    soundar wrote:
    Hi all,
    I have migrated database from 8i to 10gr2.For Backup in 8i, we used a RMAN shell script (scheduled uding cron tab) to backup the database to Tape.(VERITAS BACKUP).
    I am new to 10G.I checked out the options to backup the database using Oracle Enterprise manager DB console.
    http://www.oracle.com/technology/obe/10gr2_db_single/ha/rman/rman_otn.htm#t1d
    I am planning to take a test backup using the steps mentioned inthe above url.Could any one suggest whcih is the best option for database backup,eiether to use Oracle Enterprise manager DB console or thru RMAN shell script for backup..?
    Edited by: soundar on Mar 9, 2010 10:53 PMDear soudar
    I woudn't suggest you to work with EM if you want to be a professional DBA. Start learning RMAN and use CLI instead of GUI
    Those who live by the GUI, die by the GUI

  • Shell script for export and import

    Hi,
    I want to run exp command in background since i need to export 40gb database of other database
    if i won't use & my session will die.
    appreciated any inputs.
    i need to run this line from shell script.
    /oracle/bin/exp pin@voipdbstg/pin file=voip.dmp owner=pin log=voip.log
    bash-2.05$ more export.sh
    #!/bin/sh
    /oracle/bin/exp pin@voipdbstg/pin file=voip.dmp owner=pin log=voip.log
    bash-2.05$ sh export.sh &
    [10] 13352
    bash-2.05$
    Export: Release 8.1.7.0.0 - Production on Fri Dec 4 22:51:09 2009
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Password: pin
    bash: pin: command not found
    [10]+ Stopped sh export.sh
    input appreciated
    thanks
    Prakash

    Hi,
    /oracle/bin/exp pin@voipdbstg/pin file=voip.dmp owner=pin log=voip.log
    should be
    /oracle/bin/exp pin/pin@voipdbstg file=voip.dmp owner=pin log=voip.log
    Also for running the script is background and you should be able to log out of shell scriptthen run the command in nohup mode.
    $nohup export.sh&
    Regards

  • Shell Script  for Startup and Shutdown the database

    Hi,
    i want Shell Script for Startup and Shutdown the database in Solaries.
    could any one can hep me where i can get this script. or send to me to [email protected]
    Thanks & Regards,
    Gangi reddy

    SHUTDOWN
    SHUTDOWN ABORT]
    Shuts down a currently running Oracle instance, optionally closing and dismounting a database.
    Terms
    Refer to the following list for a description of each term or clause:
    ABORT
    Proceeds with the fastest possible shutdown of the database without waiting for calls to complete or users to disconnect.
    Uncommitted transactions are not rolled back. Client SQL statements currently being processed are terminated. All users currently connected to the database are implicitly disconnected and the next database startup will require instance recovery.
    You must use this option if a background process terminates abnormally.
    IMMEDIATE
    Does not wait for current calls to complete or users to disconnect from the database.
    Further connects are prohibited. The database is closed and dismounted. The instance is shutdown and no instance recovery is required on the next database startup.
    NORMAL
    NORMAL is the default option which waits for users to disconnect from the database.
    Further connects are prohibited. The database is closed and dismounted. The instance is shutdown and no instance recovery is required on the next database startup.
    TRANSACTIONAL [LOCAL]
    Performs a planned shutdown of an instance while allowing active transactions to complete first. It prevents clients from losing work without requiring all users to log off.
    No client can start a new transaction on this instance. Attempting to start a new transaction results in disconnection. After completion of all transactions, any client still connected to the instance is disconnected. Now the instance shuts down just as it would if a SHUTDOWN IMMEDIATE statement was submitted. The next startup of the database will not require any instance recovery procedures.
    The LOCAL mode specifies a transactional shutdown on the local instance only, so that it only waits on local transactions to complete, not all transactions. This is useful, for example, for scheduled outage maintenance.
    Usage
    SHUTDOWN with no arguments is equivalent to SHUTDOWN NORMAL.
    You must be connected to a database as SYSOPER, or SYSDBA. You cannot connect via a multi-threaded server. For more information about connecting to a database, see the CONNECT command earlier in this chapter.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013607
    Joel Pérez

  • Pls give some shell scripting for sql/plsql

    pls give some shell scripting for sql/plsql

    794244 wrote:
    pls give some shell scripting for sql/plsqlNeither SQL or PL/SQL are shell script languages. Both are server side languages that executes inside an Oracle database server process.
    This is an important concept to understand when using SQL*Plus for example to "script" interaction with an Oracle database.

  • Run Shell script from oracle plsql

    OS--> Linux
    Version--Oracle 10g
    I want to run a shell script from oracle PL/sql. I know dbms_scheduler can be used to create job , enable job and run it .
    But I have a requirement where I need to know if my script ran successfully or not. Something like a return code back to oracle.
    So that I can run appropriate code depending on return code of executed Script.
    Kindly help !!

    Online documentation was invented for a reason.
    And this reason was not would look it, as a volunteer, on your behalf, and post it in this forum.
    All procedures are documented. There are examples for most facitlities on Asktom, and there is Morgan's Library at [http://www.psoug.org]
    Sybrand Bakker
    Senior Oracle DBA

  • Shell Scripts in oracle Apps on Windows

    Hi Experts,
    Usually we are using shell scripts on Linux, but here i am using windows for Oracle applications, how can i write Shell scripts for concurrent program, is there any way to achieve this. Please suggest me.
    Thanks,
    RED.

    Please see these docs/links.
    How Do You Run A Unix Host Script From Concurrent Managers On MS Windows Platform? [ID 412392.1]
    https://forums.oracle.com/forums/search.jspa?threadID=&q=host+AND+Concurrent+AND+Windows&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Can we call shell script from oracle 9i?

    Hi experts,
    I wanted to know can we call shell script from oracle 9i procedures? If yes,how
    Thanks
    Shaan

    No. I can't think of a way to do this...
    If you want you can use DBMS_SCHEDULER to call OS SHELL scripts within.
    For e.g.
    CREATE PROGRAM
    begin
    dbms_scheduler.create_program
    program_name => 'CHECK_TIME',
    program_type => 'EXECUTABLE',
    program_action => '/opt/oracle/chk_date.sh',
    enabled => TRUE,
    comments => 'Check the Time'
    end;
    CREATE A SHELL SCRIPT
    opt/oracle> cat chk_date.sh
    #!/usr/bin/ksh
    echo "The date is :`date`"
    CREATE SCHEDULE
    begin
    dbms_scheduler.create_schedule
    schedule_name => 'EVERY_30_MINS',
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',
    comments => 'Every 30-mins'
    end;
    CREATE JOB
    begin
    dbms_scheduler.create_job
    job_name => 'RUN_CHECK_TIME',
    program_name => 'CHECK_TIME',
    schedule_name => 'EVERY_30_MINS',
    comments => 'Run the program CHECK_TIME every 30 minutes',
    enabled => TRUE
    end;
    MANUALLY RUN A JOB
    exec dbms_scheduler.run_job('RUN_CHECK_TIME');

Maybe you are looking for

  • Photoshop will not open/create new files, cannot resize images etc

    Hi to all. So I'll start with the basics; I am using Photoshop 7 (And yes, I am using it for a specific reason, I'm not interested in migrating to this new $1000 Creative Cloud rubbish), us Australians are getting ripped a new one and I'm happy with

  • JSF Converter how to use property in faces-config

    I have made an Converter for my listbox, and it is working. Now I want to use a property to change the behavior of the converter. My faces-config looks like this: <!-- Converters -->      <converter> <converter-for class>model.PacemakerBranche</conve

  • ScrollBars not showing up for the JPanel [urgent]

    Hi, I have a frame in which i have two nested split panes i.e one horizontal splitpane and in that i am having one more split pane on the right side and a JTree on the left side.In the second split pane (which is a vertical split) ,as a top component

  • BI and Reporting

    A few years ago I managed a development shop that created many custom applications for the company. We also used Crystal Reports that ran stand alone or we embedded them into our .NET apps. With the demand of users wanting to see their data easier an

  • Computer Freezes After iPhoto Album Mosaic Screen Saver

    After using the Mosaic screen saver, my Mac will freeze, therefore resulting in me having to perform a hard shutdown, and reboot my Mac. When my Mac turns back on and I log in, Crash Reporter reports that AdobeResourceSychronizer crashed. The log is