Monday, June 28, 2010

How to compare same user in 2 Different Database environment

Hi,
We had a problem where some package consisting of several procedures were used to execute in few seconds in one DEV1 environment and the same one was taking more time in the other DEV2 environment.?

Soln: In this scenario :
Step 1:
-----------
I used the TOAD tool to compare the two schema i.e one in DEV1 and other in DEV2.

Step 2:
---------
In the TOAD tool we need to go to =>DBA tab and then use compare schema option.
Open the two schemas from the different Databases you want to compare.Select the objects type to compare =>indexes ,functions,...

Step 3:
-----------
Select the compare tab.This will compare the selected objects.I found few indexes were missing.I recreated the missing indexes by taking the script from the sync sript tab.

Now when I asked our developer to reexecute thee it executed with the lesser time.Hence the issue was resolved.I found the TOAD tool to be useful in many ways in helping DBA getting scripts easliy.


Best regards,

Rafi.

2 comments:

  1. Hi Rafi,
    I am balaji workiing as a linux system admin in bangalore.yoour blog which is very useful for me like a beginners in oracle dba.
    In my office setup we have Oracle RAC, now i have a requirement like need to setup a automatic email alert when the alert.log file which have any new ORA err.
    I am tried with some of shell script from google,But i thought you guys have a very much experience to achieve this.
    Please can you guide me to setup the same.
    FYI, my personal email is : skjbalaji@gmail.com
    Expecting the valuable reply from you.

    ReplyDelete
  2. Hi Balaji,

    Thanks for the compliment.
    Here is the script which might be helpful to you.

    Here's a script I use for our 9i databases.

    #
    #
    --------------------------------------------------------------------------------
    # Set environment
    #
    --------------------------------------------------------------------------------
    #

    . $HOME/.profile

    #
    #
    --------------------------------------------------------------------------------
    # get a list of all Oracle DB's running and check their alert log for errors
    # The 'end of monitoring' string is added to the end of the alert log after each run
    # and only the messages after that are processed. Used so we don't double-check
    # the same messages.
    #
    --------------------------------------------------------------------------------
    #

    for SID in `ps -ef | grep pmon | grep -v grep | awk '{print $NF}' | sed 's/_/ /g' | awk '{print $3}'`
    do

    export ALERT_LOG=$ORACLE_BASE/admin/$SID/bdump/alert_$SID.log
    export LASTLINE=`tail -1 $ALERT_LOG | cut -c1-5`
    if [ "$LASTLINE" != "#####" ]; then
    sed '/##### end of monitoring #####/,$ !d' $ALERT_LOG > /tmp/work.tmp
    grep ORA- /tmp/work.tmp
    if [ $? -eq 0 ]; then
    mailx -s "Errors found in $SID alert log" dbaemail@work.com < /tmp/work.tmp
    fi
    sed '/##### end of monitoring #####/d' $ALERT_LOG > $ALERT_LOG.work
    mv $ALERT_LOG.work $ALERT_LOG
    echo "##### end of monitoring #####" >> $ALERT_LOG
    fi
    done
    rm /tmp/work.tmp
    #
    #

    Start off by inserting a comment at the end of the alert log. I use ##### end of monitoring #####

    Next the script will check to see if that is the last line in the alert log. If it is then nothing has been written to the alert log since the last time the script was run...
    If there is something, the script grabs everything after the '##### end of monitoring #####' and checks if it includes errors.
    If it does it emails them to the dba. If not (ie: just informational messages) then it appends the '##### end of monitoring #####' line to the end of the alert log for the next run.

    ReplyDelete