Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2006
    Posts
    97

    Unanswered: Can Some one can help me in Shell script

    We have database name Progress.

    We will restore prod back files to UserServer on Sunday. Except all other days We will keep apply AI(trsaction log files kind in db2) files of that day. I have appy the log files in SEQUENTIAL order by timestamp which is part of file name.

    *********************************

    #set -x
    DATE=`date "+%y%m%d%H%M%S"`

    ########## MAIN FUNCTION
    myfunc ()
    {
    ls -ltr /archive/testdb/|grep progress|cut -c67-78>unc
    while read ai
    do
    echo $ai is getting Verifified by If clause
    if [ "${ai}" -le "${DATE}" ]; then
    echo $ai "<" $DATE
    $DLC/bin/rfutil dbname -C roll forward -a /archive/testdb/$ai
    #####I will write another if clause for check the command run sucessfully or not####
    else
    echo ""
    echo "Can't apply Log File $ai is >= 080214121500"
    fi
    done < unc
    rm unc
    }

    ################ MAIN

    date > wekday
    while read d1 rest_of_file
    do
    wd=${d1%}
    case $wd in
    Mon)
    echo $wd;
    myfunc $DATE ;;
    Tue)
    echo $wd;
    myfunc $DATE ;;
    Wed)
    echo $wd;
    myfunc $DATE ;;
    Thu)
    echo $wd;
    myfunc $DATE ;;
    Fri)
    echo $wd;
    myfunc $DATE ;;
    Sat)
    echo $wd;
    myfunc $DATE ;;
    Sun)
    echo "Full Restore"
    echo $wd;;
    *)
    print "Invalid day for Applying AI files To Report Server" ;;
    esac
    done < wekday
    rm wekday



    i wrote this one. Can Some can give me some more suggestions
    Last edited by smith43017; 02-15-08 at 16:09.

  2. #2
    Join Date
    Sep 2006
    Posts
    97
    It's not working. Some How I don't know where I am doing mistake can some body can help or guide me. Please

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    What error message do you get?
    What does the log filenames look like?
    You say restore prod to user but the ls is on test
    ls -ltr /archive/testdb

    You seem to make thing unnecessary complex
    Code:
    wd=`date +%a`
    if [ "$wd" = "Sun" ]
    then 
      echo "Full Restore"
    else
      echo "Log restore"
    fi
    It seems you do not specify the file name for the log restore
    ls -ltr /archive/testdb/|grep progress|cut -c67-78>unc
    while read ai
    ...
    $DLC/bin/rfutil dbname -C roll forward -a /archive/testdb/$ai
    And you prbably don't need the grep and cut commands
    And on Tue you don't want to reload Mon logs do you?

  4. #4
    Join Date
    Sep 2006
    Posts
    97
    Thank for replying pdreyer

    Log filenames are like this


    ai.080212001500
    ai.080212061500
    ai.080212121500
    ai.080212181501
    ai.080212181523
    ai.080213001500
    ai.080213061500
    ai.080213121500
    ai.080213181500
    ai.080213181524
    ai.080214001500
    ai.080214061500
    ai.080214121500
    ai.080214181501
    ai.080214181521
    ai.080215001501
    ai.080215061500
    ai.080215121501


    And Applying logs failed. I need to determin which log is first one and after that sequential order By time.

    Error message is Inccorect log file trying to apply.
    Last edited by smith43017; 02-19-08 at 09:52.

  5. #5
    Join Date
    Sep 2006
    Posts
    97
    Thanks for replay pdreyer .

    The reseson I kept all the days is, I need to add some more functionality on perticular week day.

    Quote Originally Posted by pdreyer
    What error message do you get?
    What does the log filenames look like?
    You say restore prod to user but the ls is on test
    ls -ltr /archive/testdb

    I coped in my test directory I am trying from ther. I don't want touch prod log files.


    You seem to make thing unnecessary complex
    Code:
    wd=`date +%a`
    if [ "$wd" = "Sun" ]
    then 
      echo "Full Restore"
    else
      echo "Log restore"
    fi
    It seems you do not specify the file name for the log restore
    ls -ltr /archive/testdb/|grep progress|cut -c67-78>unc
    while read ai

    You are right, I modified script. and posting in next post
    ...
    $DLC/bin/rfutil dbname -C roll forward -a /archive/testdb/$ai
    And you prbably don't need the grep and cut commands

    What are the best options to get time time stamp and compare.
    And on Tue you don't want to reload Mon logs do you?

    Yes On every weekday I need to apply all Monday, Tue, Wed ... apply and then previous day logs as last set.
    Last edited by smith43017; 02-19-08 at 09:53.

  6. #6
    Join Date
    Sep 2006
    Posts
    97
    Still getting the same error.


    #set -x
    DATE=`date "+%y%m%d%H%M%S"`

    ########## MAIN FUNCTION
    myfunc ()
    {
    ls -ltr /archive/testdb/|grep progress|cut -c67-78>unc
    while read ai
    do
    echo $ai is getting Verifified by If clause
    #if [ "${ai}" -le "${DATE}" ]; then
    if [ "${ai}" -le 080214121500 ]; then
    echo $ai "<" 080214121500
    #echo $ai "<" $DATE
    $DLC/bin/rfutil dbname -C roll forward -a /archive/testdb/ai.$ai
    else
    echo ""
    echo "Can't apply Log File $ai is >= 080214121500"
    fi
    done < unc
    rm unc
    }
    ################ MAIN

    date > wekday
    while read d1 rest_of_file
    do
    wd=${d1%}
    case $wd in
    Mon)
    echo $wd;
    myfunc $DATE ;;
    Tue)
    echo $wd;
    myfunc $DATE ;;
    Wed)
    echo $wd;
    myfunc $DATE ;;
    Thu)
    echo $wd;
    myfunc $DATE ;;
    Fri)
    echo $wd;
    myfunc $DATE ;;
    Sat)
    echo $wd;
    myfunc $DATE ;;
    Sun)
    echo "Full Restore"
    echo $wd;;
    *)
    print "Invalid day for Applying AI files To Report Server" ;;
    esac
    done < wekday
    rm wekday
    Last edited by smith43017; 02-19-08 at 13:02.

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Stupid question, maybe: doesn't your DBMS figure out by itself which backup and log files it needs?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  8. #8
    Join Date
    Sep 2006
    Posts
    97
    Can somebody can have look at this let me now what I am doing wrong

  9. #9
    Join Date
    Sep 2006
    Posts
    97
    It knwos Which file It needs but If we pass location It didn't apply in right manner and sequential order. When DB2 if mentioned location and end of the log files is good enough. Manuvally needs to apply the log file.

    Thanks For replay Stolze

Posting Permissions

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