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

From: Abramson, Stuart (SAbramson@Wabtec.com)
Date: Wed Nov 26 2003 - 10:21:25 EST


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)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:36 EDT