[HPADM] Summary: Cloning Oracle SID software ($ORACLE_HOME) with BCVs

From: Abramson, Stuart (SAbramson_at_Wabtec.com)
Date: 11/26/03

  • Next message: Whittemore, Dale: "[HPADM] SUMMARY:Cron help"
    To: "Hpux-Admin (hpux-admin@dutchworks.nl)" <hpux-admin@dutchworks.nl>, "EMC List (E-mail) (emc_list@yahoogroups.com)" <emc_list@yahoogroups.com>
    Date: Wed, 26 Nov 2003 10:21:25 -0500
    
    

    Thanks to:
     
        Denny Koovakattu
        Dan Copeland
            IlicR@stentor.ca <mailto:IlicR@stentor.ca>
            Lynn Sattler
     
    We're cloning Oracle BCVs to another server, and changing the:
        hostname
        SID Name
        Mount Point names
        Listener Ports
     
    The "clone rules" are:
     

            1. Edit Files to point to proper locations/values:
                            initSID.ora
                            tnsnames.ora
                            listener.ora
            2. Replace symbolic links under ORACLE_HOME with new path.

            3. Need to relink binaries to (if path has changed.). (See
    above.)
            4. mv $ORACLE_HOME/admin/SID to the new SID name.

            5. Edit Apache files (above) if we use the Oracle bundled
    Apache.
            6. Reset the Oracle passwds with "orapwd" utility, if
                    initSID.ora:"remote_login_passwordfile" = "exclusive",
                    which ours is.
            7. If you use "Oracle Intelliget Agent", then edit:
                            snmp_ro.ora
                            snmp_rw.ora
                            services.ora
            8. If you use "Oracle Enterprise Manager", then edit:
                            OEMclient.properties.
     

    The followin code will do that:
     

    # 1. Rename files in Oracle Software directory from $OLD_SID
    # to $NEW_SID.
    find $NEW_MP_SW -name "*${OLD_SID}*" | while read FILE
    do
            NEWFILE=$( echo $FILE | sed "s/${OLD_SID}/${NEW_SID}/g" )
            mv $FILE $NEWFILE
            chown oracle:dba $NEWFILE
    done
    # Do it TWICE!
    find $NEW_MP_SW -name "*${OLD_SID}*" | while read FILE
    do
            NEWFILE=$( echo $FILE | sed "s/${OLD_SID}/${NEW_SID}/g" )
            mv $FILE $NEWFILE
    done
    # 2. Edit key files:
    # The key files are:
    KEY_FILES=" $ORA_HOME/dbs/init${NEW_SID}.ora
                    $ORA_HOME/network/admin/listener.ora
                    $ORA_HOME/network/admin/tnsnames.ora "
    # The key "values" to replace are:
    for FILE in $KEY_FILES
    do
            # Host, Oracle SID name, Port
            sed "s/$OLD_HOST/$NEW_HOST/g" $FILE \
                    | sed "s/$OLD_SID/$NEW_SID/g" \
                    | sed "s/$OLD_PORT/$NEW_PORT/g" > $FILE.new1
            # Mount Points:
            set -A OLD_DIRS $OLD_MPS
            set -A NEW_DIRS $NEW_MPS
            CNT=${#OLD_DIRS[@]}
            #
            (( I=0 ))
            while (( I < CNT ))
            do
                    sed "s?${OLD_DIRS[$I]}?${NEW_DIRS[$I]}?g" $FILE.new1
    >$FILE.new2
                    mv $FILE.new2 $FILE.new1
                    (( I=I+1 ))
            done
            mv $FILE.new1 $FILE
            chown oracle:dba $FILE
    done
    # 3. Relink symbolic-linked files
    find $NEW_MP_SW -type l | while read LINK
    do
            FILE=$( ll $LINK | awk -F">" '{print $2}' )
            NEW_FILE=$( echo $FILE | sed "s?$OLD_MP_SW?$NEW_MP_SW?" )
            echo $FILE | grep -q $OLD_MP_SW
            if (( $? == 0 ))
            then
                    # This is a soft link to the Old Mount Point Name
                    rm $LINK
                    ln -s $NEW_FILE $LINK
                    ll $LINK
            fi
    done

     
     

           

      _____

    From: Abramson, Stuart
    Sent: Friday, November 21, 2003 5:10 PM
    To: 'Denny Koovakattu'
    Subject: RE: [HPADM] Cloning Oracle SID software ($ORACLE_HOME) with BCVs

    Denny:
     
    Here are some files that I'm looking at either because they reference
    "hostname", "SID name" or contain the host or SID in their names.:
     
    (Asterisk indicate files you mentioned below.)
     
            /u1001/app/oracle/product/9.2.0/Apache/Apache/conf/httpd.conf
     
    /u1001/app/oracle/product/9.2.0/Apache/Apache/conf/httpd.conf.default
            /u1001/app/oracle/product/9.2.0/Apache/Apache/setupinfo.txt
            /u1001/app/oracle/product/9.2.0/admin/HOTB*
            /u1001/app/oracle/product/9.2.0/dbs/initHOTB.ora*
            /u1001/app/oracle/product/9.2.0/dbs/lkHOTB
            /u1001/app/oracle/product/9.2.0/dbs/orapwHOTB
            /u1001/app/oracle/product/9.2.0/network/admin/listener.ora*
            /u1001/app/oracle/product/9.2.0/network/admin/snmp_ro.ora
            /u1001/app/oracle/product/9.2.0/network/admin/snmp_rw.ora
            /u1001/app/oracle/product/9.2.0/network/admin/tnsnames.ora*
            /u1001/app/oracle/product/9.2.0/network/agent/services.ora
            /u1001/app/oracle/product/9.2.0/sysman/config/OEMClient.properties
     
    What do you think?
     
        Stuart

      _____

    From: Denny Koovakattu [mailto:groups@koovakattu.com]
    Sent: Friday, November 21, 2003 4:52 PM
    To: Abramson, Stuart
    Subject: Re: [HPADM] Cloning Oracle SID software ($ORACLE_HOME) with BCVs

    I am not aware of any Oracle utilities to do this. I am assuming you have
    the cloning part covered, i.e., recovering the DB. If the path to
    $ORACLE_HOME is changing I would suggest relinking the Oracle binaries (even
    though it might work without relinking.) In the past some utilities have
    failed due to embedded paths to shared libraries. I make it a point to set
    LDOPTS=+s while linking Oracle. Else chatr them later. What we have done in
    the past is to keep a template of the initSID.ora, listener.ora and the
    tnsnames.ora and overwrite the copy of the PROD files with that.

    - You might already have it covered, but check if the REPORT server is using
    a password file.
    - Rename the directory SID under $ORACLE_BASE/admin or create a new
    directory structure (Assuming you are using OFA)

    Regards,
    Denny

    Abramson, Stuart wrote:

    Hpux-admins:

    We used to "clone" our Production Oracle Instance to a BCV Reporting
    Instance by only "BCV-ing" the data files.

    We set up the oracle software on the BCV server for a SID called REPORT, and
    we left it there. Over time, REPORT didn't get patched, etc, and wasn't an
    exact copy of PROD.

    We now want to BCV the Oracle software, in $ORACLE_HOME as well as the data.

    So, I'm looking at changing SID names, port numbers, hostnames, file system
    names in the Oracle software directories from PROD to REPORT, every time I
    split the Oracle software:

                      $ORACLE_HOME/dbs/initSID.ora

                      $ORACLE_HOME/network/admin/listener.ora
              $ORACLE_HOME/network/admin/tnsnames.ora

    Is there an Oracle utility that does this for you?:

              OracleClone OLDSID NEWSID

    Does anyone have a list of the places that you have to change?

    Hasn't someone done this before?

            Stuart

            

    Stuart Abramson | Off: 412/825-1434 | Cell: 412/417-1567 | email:
    sabramson@wabtec.com <mailto:sabramson@wabtec.com>

    ***** CONFIDENTIALITY NOTE *****
    The content contained in this e-mail transmission is legally privileged and
    confidential information intended only for the use of the individual or
    entity named herein. If the reader of this transmission is not the intended
    recipient, you are hereby notified that any dissemination, distribution, or
    copying of this transmission is strictly prohibited.

    ***** CONFIDENTIALITY NOTE *****
    The content contained in this e-mail transmission is legally privileged and confidential information intended only for the use of the individual or entity named herein. If the reader of this transmission is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this transmission is strictly prohibited.

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Whittemore, Dale: "[HPADM] SUMMARY:Cron help"

    Relevant Pages

    • Re: Starting 2 instances of the same Oracle database on the same machine
      ... I create an Oracle database with SID, say, 'myOracle' and start it ... is it possible to start another instance of 'myOracle' with the ...
      (comp.databases.oracle.server)
    • Re: Connecting to Oracle Instances - N00B
      ... > I'm trying to connect to a specific Oracle instance on my localhost. ... > - sqlplus connect as system/passwd@instance as sysdba ... do you insist upon using SQL*Net for a local connection? ... is your SID. ...
      (comp.databases.oracle.server)
    • Paging space utilized... Why?
      ... My box has a lot of memory still free. ... I have a lot of paging space ... which appears to be my Oracle sga area. ... SID: ...
      (AIX-L)
    • Re: Rails + Oracle
      ... there are SO many ways to configure Oracle. ... database: SID ... (I believe 'database' isn't actually used.) ... HOST = localhost because I tunnel the database ...
      (comp.lang.ruby)
    • Re: instant client RH EL 4.4 sqlplus
      ... Actually there is no other Oracle software on the box. ... This gateway requires the installation of the Oracle Instant Client - ... I am pretty sure an sqlplus prompt is going to be helpful! ...
      (comp.databases.oracle.server)