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

Similar Messages

  • Want to create unix shell script for  Clone procedure in 11i and r12

    Want to create unix shell script for Clone procedure in 11i and r12 .Can anyone help me on this as I m new to oracle apps and scripting.
    Thanks in advance .

    user11958935 wrote:
    Thanks but I want it for application cloning ie adcfgclone and autoconfig etc .Please see old threads for similar topic/discussion.
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Automate+AND+Rapid+AND+Clone&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Automate+AND+AutoConfig&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Calling Unix shell script for some GUI interface

    Hi,
    I'm preparing a shell script, which would check for the syntax of a bteq script.
    I want this shell script to be called from a GUI interface...
    Is it possible to call this shell script from any GUI interface..
    If yes, could you please help me out.
    Thanks,
    Harshad.

    Harshad (user524171) wrote:
    I'm not aware of OEM grid control. Can i use it without Oracle or Oracle is must for this...Er.. this is an Oracle forum... and if you are not using Oracle s/w then why are you using Oracle support forums?
    I'm using teradata database and unix here...And what part of ORACLE Database General Forum+ do you not understand that makes you ask Teradata questions here?
    Teradata is not Oracle. Oracle is not Teradata. Please use the correct forum for your subject matter.

  • Need help in writinf a stop script for a production server

    can somebody help me with a stop script which stops a jrun
    production server.
    jrun -stop production
    this command should work but how do i use this in a script .
    Thanks

    Hi,
    I highly recommend that you skip VBScript and learn PowerShell instead. This is pretty trivial in PowerShell:
    If ($env:COMPUTERNAME.Length -le 15) {
    # Do stuff
    # HINT: Look into Start-Service
    Write-Host "Under limit: $env:COMPUTERNAME"
    } Else {
    # Do optional stuff
    Write-Host "Over limit: $env:COMPUTERNAME"
    (OT: jrv - happy? =])
    If you must stick with VBScript for some odd reason, here's an example to get you started:
    Set wshNetwork = WScript.CreateObject( "WScript.Network" )
    strComputerName = wshNetwork.ComputerName
    If Len(strComputerName) <= 15 Then
    'Do stuff here when the name is short enough
    WScript.Echo "Under limit: " & strComputerName
    Else
    'Do stuff here when the name is too long (only if you want to)
    WScript.Echo "Over limit: " & strComputerName
    End If
    http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/services/
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • How can I call unix shell script from database using triggers

    Hi everyone,
    can anybody help me to solve my problem.
    we have one table and records are getting inserted into table.
    when the record is inserted with 'C',I need to fetch that record-id which is primary key and then by passing that id as an argument I need to execute a shell script which is there in Unix using triggers.
    please note DB and Scripts are in different servers.

    4159efc6-cffb-4496-bd1a-68859f6ce776 wrote:
    Hi everyone,
    can anybody help me to solve my problem.
    we have one table and records are getting inserted into table.
    when the record is inserted with 'C',I need to fetch that record-id which is primary key and then by passing that id as an argument I need to execute a shell script which is there in Unix using triggers.
    please note DB and Scripts are in different servers.
    PL/SQL can only interact with objects on the local DB Server.
    PL/SQL can initiate OS local script via any of the following mechanisms: EXTERNAL PROCEDURE, JAVA, DBMS_SCHEDULER
    The local script then will need to launch the remote script.

  • Shell Script for Database access

    Hi All,
    I am trying to retrieve a some data from database using the shell script. The script that I used is :
    #!/bin/sh
    sqlplus -s $uid/$password@database @c:/query.sql
    My query file contains :
    set heading off
    set feedback off
    set verify off
    set colsep '|'
    spool on
    spool c:/out.txt
    select * from users where id =1000;
    spool off
    My problem is the spool output file contains the data in wrapped format. I want one record to be in one single line.
    Now my output looks like this :
    258092| | 10
    jj jj
    Business Development Manager
    I want it to be like :
    258092| | 10 | jj jj | Business Development Manager
    Can anybody shed some light on it????
    Thanks In Advance,
    JJ

    Hi JJ,
    Sorry for that.
    If I were you ,I would not use "set colsep '|'", and I would change the sql script like the following:
    select columna||'|'||columnb||'|'columnc from tables;
    If there are so many columns in the table, I don't think this is a good solution. So can you please also ask the question in SQL forum:
    PL/SQL
    Thanks, Bing

  • Need help in Creating a dynamic name for a file.

    I am working on FTP Put and I have a requirement where in I have to generate the file with dynamic content in its name.I dont need any time stamp.I need to create a variable for this?
    Help in this regard would be highly appreciated.

    Take a look at File tmp = File.createTempFile("aaa", ".txt");
    String name = tmp.getpath();This will create a File with a name like aaannn.txt where nnn is a system generated number guaranteed to exists only once.

  • Need Help To Create a Single  Query For it

    I am Making an Oracle Report
    Which Include 4 Formulae Columns,Each of Them Represent
    1) Qty_inWarehouse(Whose Location_code=1)
    2) Value_inWarehouse(cost_price*qty)
    3) Qty_inlocation(This will Populate Based On Used Entered Value,Means the user will enter a particular Location,Location_code is other than 1)
    4) Value_inlocaiton
    Now All these Values are Coming From Inv_stores Tables.If I use Formula for each Column Then I have to Select This
    Table 4 Times(inv_stores)
    The Structure Of Inv_stores Table is
    location_code Varcha2(3), pk
    Department_Code Varchar2(2), pk
    Product_code Varchar2(15), pk
    Qty_instock Number(6)
    I have Written Query Like This
    In This Query i Have Directly used Location_code as '1' and Another Location as '22' (Which is of One Showroom) and Tried By Testing With Department No.'10'.It is Selecting Cost Price from inv_product Table.
    Now This inv_product is Product MAster Table.Each Product is uniquely identified by Department_code and
    Product_code in this table.
    Now in this Query i Want The Value per department Wise....
    Select A.department_code,Sum(Nvl(A.qty_instock,0) - nvl(A.qty_reserved,0) + nvl(A.qty_delv_retn,0))
    STK_QTY_INLOC,
    Sum((Nvl(A.qty_instock,0) - nvl(A.qty_reserved,0) + nvl(A.qty_delv_retn,0))) STK_VALUE_INLOC,
    SUM(nvl(inv_product.qty_backorder,0)) as Qty_BO,
    Sum(Nvl(B.qty_instock,0) - nvl(B.qty_reserved,0) + nvl(B.qty_delv_retn,0)) STK_QTY_INWH,
    Sum((Nvl(B.qty_instock,0) - nvl(B.qty_reserved,0) + nvl(B.qty_delv_retn,0))*nvl(inv_product.cost_pricekd,0)) STK_VALUE_INWH
    from inv_stores A,inv_product,inv_stores B
    where B.location_code(+) = '1' and
    B.Department_Code(+) = '10' and
    A.department_code = B.department_code(+) and
    A.product_code = B.product_code(+) and
    A.location_code = '22' and
    inv_product.department_code = A.department_code and
    inv_product.product_code = A.product_code
    Group By A.department_code
    But it is Giving Useless Results
    now The 4 Diffrent Queries Which i am Uising is This
    This Will Give me Stock quantity in Location
    Select sum((nvl(qty_instock,0) - nvl(qty_reserved,0)) + nvl(qty_delv_retn,0))
    into var_qty
    from inv_stores
    where department_Code = :department_code and
    location_code = :location_code;
    This will Give me Value For That Location
    Select sum(((nvl(inv_stores.qty_instock,0) - nvl(inv_stores.qty_reserved,0)) +
    nvl(inv_stores.qty_delv_retn,0))*nvl(inv_product.cost_price,0))
    into var_stk_value
    from inv_stores,inv_product
    where inv_stores.department_Code = :department_code and
    inv_stores.location_code = :location_code and
    inv_product.department_code = inv_stores.department_Code and
    inv_product.product_code = inv_stores.product_code;
    This Will Give me Qty in W/H
    Select sum((nvl(qty_instock,0) - nvl(qty_reserved,0)) + nvl(qty_delv_retn,0))
    into var_qty
    from inv_stores
    where department_Code = :department_code and
    location_code = '1';
    This Will Give me Value in W/H
    Select sum(((nvl(inv_stores.qty_instock,0) - nvl(inv_stores.qty_reserved,0)) +
    nvl(inv_stores.qty_delv_retn,0))*nvl(inv_product.cost_price,0))
    into var_stk_value
    from inv_stores,inv_product
    where inv_stores.department_Code = :department_code and
    inv_stores.location_code = '1' and
    inv_product.department_code = inv_stores.department_Code and
    inv_product.product_code = inv_stores.product_code;
    These 4 Queries is Selecting Data from inv_stores Table,I want to Combine Them Into One........
    Suppose if we take for location 22 whose name is 'SHL'(It is s showroom)
    Sample Data Will Be Something Like
    Dept W/H(qty) W/h(Value) SHL(qty) SHL(Value)
    00 3 90 1 30
    10 0 0 2 50
    12 5 100 1 20

    This forum is for issues with the SQL Developer tool. You'd get more response in the SQL And PL/SQL forum (where you cross-posted already).
    Regards,
    K.

  • Shell script for creating,altering, etc ., a database

    hi there,
    Please help me to find shell scripts for creating,altering, etc a database..
    Thanks & Regards,
    Balu.

    Thanks to all , but dbca generates XML files :
    <DatabaseTemplate name="MYDB" description="" version="10.2.0.0.0">
       <CommonAttributes>
          <option name="ISEARCH" value="false"/>
          <option name="OMS" value="false"/>
          <option name="JSERVER" value="true"/>
          <option name="SPATIAL" value="true"/>
          <option name="ODM" value="true">
             <tablespace id="SYSAUX"/>
          </option>
          <option name="IMEDIA" value="true"/>
          <option name="XDB_PROTOCOLS" value="true">
             <tablespace id="SYSAUX"/>
    ..................I need a file.sql script to launch in sqlplus. Something like the following :
    CREATE DATABASE MYDB
    USER SYS IDENTIFIED BY ***
    USER SYSTEM IDENTIFIED BY ***
    LOGFILE GROUP 1 ('/home/oracle/oracle/instances/oradata/MYDB/redo1/redo01.log') SIZE 15M,
    GROUP 2 ('/home/oracle/oracle/instances/oradata/MYDB/redo2/redo02.log') SIZE 15M,
    GROUP 3 ('/home/oracle/oracle/instances/oradata/MYDB/redo3/redo03.log') SIZE 15M
    ......................

  • Call a UNIX shell script from an oracle stored procedure

    We need to call a UNIX shell script from an oracle stored procedure
    i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?

    There are various ways in achieving this.
    For Example, you can call a PRO*C-Library residing on the database server.
    This requires a PL/SQL library to be generated and some changes to the Listener configuration.
    It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
    In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
    The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
    Be careful with this, because it really works ;)
    Refer to :
    http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    Message was edited by:
    user434854

  • Java exec() of UNIX shell script

    I have a java application that uses:
    p = Runtime.getRuntime().exec( cmdLine);
    to execute a UNIX shell script, for example:
    #!/bin/ksh
    . /export/pc112477/freeware/work1/wsEnv
    export PATH=/opt/sfw/bin:/usr/ccs/bin:/usr/bin:/usr/ucb:$PATH
    cd /export/pc112477/freeware/work1/usr/src/pkgdefs/SFWnmap
    /usr/ccs/bin/make -e ROOT=$ROOT install
    RESULT=$?
    if [ $RESULT = 0 ]
    then
    echo "Package source"
    cd /export/pc112477/freeware/work1/usr/src/pkgdefs/SFWnmapS
    /usr/ccs/bin/make -e ROOT=$ROOT install
    RESULT=$?
    fi
    exit $RESULT
    Some times the running of the script locks up depending on how much work the script has to, eg. if the make calls pkgmk for a small package it runs okay but if its a large package it locks up in pkgmk.
    The script itself works okay if run directly
    Does anyone have any ideas on why this locks up and how I could stop it doing it.
    Thanks

    For anyone who stumbles across this and needs an answer:
    To empty the standard error and output, you need to use getErrorStream() and getInputStream() on the Process object created when you execed your command. Create new InputStreamReaders with the streams from the process, then wrap those with BufferedReaders and read each line with a while loop. This is the basic thing you need to do:
    try{
    Process proc = Runtime.getRuntime().exec(command);
    InputStreamReader isr = new InputStreamReader(proc.getErrorStream());
    BufferedReader errReader = new BufferedReader(isr);
    String line;
    while((line = errReader.readLine()) != null)
    <do something with each line of error>
    } //end try
    catch(<errors>) {
    <do something with errors>
    } //end catch
    What you really should do is put the stream handling in a separate class that extends Thread, create an instance for the error and output streams, and start each one. There is a class called StreamGobbler that does this sort of thing. Look at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html to find out more about it and read a detailed explanation of different problems with exec().

  • Please provide me unix shell script (export and import of database schema)

    please i am new in unix
    \please give me sample unix shell script (export and import of database schema)

    please i am new in unix
    \please give me sample unix shell script (export and import of database schema)Instead of providing you the readymade unix shell script for your requirement, I will give you the hints to prepare the same at your own.
    Create a file with .sh extension.
    # Specify and set all required Environment variables.
    ORACLE_HOME, PATH, NLS_LANG, etc.,
    # Use the export command with all clauses
    export scott/tiger@orcl file=scott.dmp log=scott_emp.log
    # Compress it.
    compress scott.dmp
    Refer any unix/linux documents for scripting basics.
    http://www.bijoos.com/ora7/oracle_unix.htm
    Regards,
    Sabdar Syed.

  • How to prepare for Converting UNIX shell scripts to PL/SQL

    Hi All
    I was said, that i may have to convert a lot of unix shell script to PL/SQL, what are the concepts i need to know to do it efficently,
    what are the options PL/SQL is having to best do that.
    I know the question is little unclear, but I too dont have much inputs about that i'm sorry for that, just its a question of how
    to prepare myself to do it the best way. What are the concepts i have to be familiar with.
    Many Thanks
    MJ

    Just how much work is involved, is hard to say. Many years ago I also wrote (more than once) a complete ETL system using a combination of shell scripts, SQL*Plus and PL/SQL.
    If the PL/SQL code is fairly clean, uses bind variables and not substitution variables, then it should be relatively easy to convert that PL/SQL code in the script to a formal stored procedure in the database.
    There is however bits and pieces that will be difficult to move into the PL/SQL layer as it requires new software - like for example FTP'ing a file from the production server to the ETL server. This can be done using external o/s calls from within PL/SQL. Or, you can install a FTP API library in PL/SQL and FTP that file directly into a CLOB and parse and process the CLOB.
    Think of Oracle as an o/s in its own right. In Oracle we have a mail client, a web browser, IPC methods like pipes and messages queues, cron, file systems, web servers and services, etc. And PL/SQL is the "shell scripting" (times a thousand) language of this Oracle o/s .
    In some cases you will find it fairly easy to map a Unix o/s feature or command to one in Oracle. For example, a Unix wget to fetch a HTML CSV file can easily be replaced in Oracle using a UTL_HTTP call.
    On the other hand, techniques used in Unix like creating a pipe to process data, grep for certain stuff and awk certain tokens for sed to process further... in Oracle this will look and work a lot different and use SQL.

  • Help on preparing shell script for setting the listener password

    Hi All,
    I am working on checking all my DB servers listeners and if the password is not set for the listener then I need to set the password for that.
    As we have many servers, I am planning to prepare the shell script for doing this task.
    I am familiar with setting up the listener password manually, but strucked up to prepare the shell script to do the same task.
    Can any one kindly help me on this.
    Thanks in advance,
    Mahi

    815537 wrote:
    Could any body please help me.
    Thanks,
    MahiPatience, Grasshopper
    This forum is not a chat line, and it is not paid support.
    No one is responsible for monitoring it and giving a quick response.
    Furthermore, it is a global forum. The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours.
    Your original post went up in the middle of the night for half the world.
    No one with the information you seek is deliberately withholding it until you sound sufficiently desperate.

  • Need Help to create new screen for RF Sapconsole

    Hi Guru's
    I'm new on RF (but some years in ABAP) since last week.
    I need help to create new screens for RF (SAPLLMOB).
    Can someone explain me the procedure to create screen (with ABAP code after) or perhaps someone have an exemple (simple or not) ?
    I have to develop 2 new screens with really few time.
    And, another subsidiary question :
    how SAP can transfert information between the flash gun and the screen i have developped.
    Is there some code to add to enable this functionality or it is include in SAPLLMOB on standard fields ????
    It's a new strange world for me today...
    Many thanks to everyone who can explain me
    Alain

    hi,
    I am facing this problem as well. Is there any reference to create the new screen?
    Hope someone can help! Thanks!
    Regards,
    Darren

Maybe you are looking for