Results 1 to 5 of 5

Thread: scripting

  1. #1
    Join Date
    Aug 2011
    Posts
    11

    Unanswered: scripting

    Hi,

    my requirement is to automate one DB refresh using scritping.here am attaching the steps to be automated for refresh and the script am adjusted for some of its process...Basically am not shell scripter..so only basic ideas...
    steps to automate.txt is the orginal one and script.txt is the one am trying to creat part by part.please review the script wat i tried and help me to make it functional one...
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    What user id are you using (going to use) ?
    The line numbers include blank lines.
    On line 5:
    "cd path in DEV/" is not a valid statement, have you just masked this?
    On line 6:
    "rm -rf *" will unconditionally and recursively delete everything! You had better be in the right directory.
    On lines 10 and 11:
    There is a significant difference between the use of the apostrophe ', and the use of the backtick ` character.

    You can run lines 7 thru 11 individually at a $ prompt to see if each works.
    Use "cat temp.data" to display the contents of the file.

  3. #3
    Join Date
    Aug 2011
    Posts
    11
    running as oracle user and line 5 instead of /DEV,will put the correct path.PLan is to enter that DEV directory and delete all the files in that directory,what all are the files in that directory are not needed,so can delete all without checking..and in step 7,
    scp -r oracle@PRD:/backup/oracle/PRFN/rman/Sun/* /backup--(DEV location),
    here if we run this script in monday,it has to go and scp files from Sun directory from PRD to DEV and if TUE need to chekc in MOn directory ..like that..that am not aware how to code..

    And i ran seperately the scripts as you told,but this step:-
    restore archivelog low sequence $low high sequence $high; not taking low and high value which already stored in low and high variables(these are numbers)..whaat may be the issue..please

  4. #4
    Join Date
    Aug 2011
    Posts
    11
    executed steps 7-11 seperately and its working fine.....in the sql part
    LOG="/path/a.log"
    export ORACLE_SID=abcd
    sqlplus -s '/ as sysdba' <<! 1>>${LOG} 2>&1
    @/data/export/sql.sql
    quit
    !
    here sql.sql am edited as
    echo "select 'rm -rf '||name from v\$datafile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file1
    echo "select 'rm -rf '||name from v\$controlfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file2
    echo "select 'rm -rf '||name from v\$tempfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file3
    echo "select 'rm -rf '||MEMBER from v\$logfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file4
    here need to execute these four files to remove files,how will it possible to execute these 4 files in script and also need to get an idea about how script will move to the directory automatically and scp files from that directory..that in step 7
    scp -r oracle@PRD:/backup/oracle/PRFN/rman/Sun/* /backup--(DEV location)

    please help to ...

  5. #5
    Join Date
    Sep 2011
    Posts
    1

    As i am new to this site i dont know where to post.....that is why i am posting here

    Two RAR file are coming namely A, B in ZIP format in a particular location each file contains 3 column (x, x1, x2) Unzip both the file and place the file in a location. Create zero byte file and copy (x1) second column from both the file to that zero byte file in a single column. After copy delete the duplicate record from that file. Then add another column say (DateTime) to that new file and insert column data values i.e (sysdate) to that file.

    How to automate this using Linux Schell script

    Example:-
    A
    x X1 X2
    1 1 3
    6 2 4
    5 4 6
    This is file A


    B
    x X1 X2
    6 6 5
    5 2 2
    5 5 5
    This is file B


    C
    X1
    1
    2
    4
    6
    2
    5
    This the new file and data should be like this.

    After deleting the duplicate new file should be like this
    C
    X1
    1
    2
    4
    6
    5





    Now add a column in this new file and insert values i.e(sysdate)

    C
    X1 Date_time
    1 02-Sep-2011
    2 02-Sep-2011
    4 02-Sep-2011
    6 02-Sep-2011
    5 02-Sep-2011

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •