Cloning A Database Home And Changing The User/Group That Owns It

个人总结
Oracle® Database Administrator's Guide 10g Release 2 (10.2)的时候文档中Tasks of a Database Administrator有提到DBA的一个task 是 Roll Out to Additional Hosts.里面有提到这样操作的大致方法.但没有详细操作.所以查到这个文档贴出来.以备后期使用.这里只给出了single DB的clone.
20111013 后期实验中发现此文档有不足的地方.实验不通过,还在探索ing,待续.
步骤
注意 tar解压缩添加 -p 参数.用以保存解压后的权限.



Cloning A Database Home And Changing The User/Group That Owns It [ID 558478.1]

  Modified 07-SEP-2011     Type BULLETIN     Status PUBLISHED  

In this Document
  Purpose
  Scope and Application
  Cloning A Database Home And Changing The User/Group That Owns It
  References


Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.7 - Release: 10.2 to 11.1
Information in this document applies to any platform.
The information supplied in this bulletin is applicable to Oracle10g Release 2 (10.2) and Oracle11g Release 1 (11.1) installations on any Unix/Linux platform.

It is not applicable to Oracle on any Windows platform.

Purpose

Support previously created Note:300062.1 to help customers to clone their Oracle database installations. This bulletin is an extension to the above note.

The purpose of this bulletin is to provide a list of the steps required to clone an Oracle10g Release 2 (10.2) or Oracle11g Release 1 (11.1) installation from a source home to a target location (on the same server, or on another server) and simultaneously change the user/group that owns the software installation.

Oracle Development have reviewed these steps and confirmed that the procedure is supported.

Scope and Application

This bulletin is intended for anyone responsible for installing/cloning Oracle software on a Unix/Linux server

The procedure below assumes that Oracle10g Release 2 (10.2) or Oracle11g Release 1 (11.1) is already installed in a source home on a server.

If you are cloning to a separate server, verify that the server meets all of the defined requirements (see Note:169706.1 for a list of these)

If you are cloning to an AIX server that has not previously had any Oracle software installed on it, download patch 6613550 and run the supplied rootpre.sh script. so that the server is configured ready for the Oracle software.

Cloning A Database Home And Changing The User/Group That Owns It

1. Create a tarball of the source home

% cd
% tar cvf /tmp/source.tar .

NOTE: Do not use the command "tar cvf /tmp/source.tar $ORACLE_HOME" because the full path for the $ORACLE_HOME will be included in the source.tar file and this will cause problems in step 3

2. Optionally, use binary transfer to move /tmp/source.tar to the target server. If you are cloning on the same server, go to step 3.

3. Unpack the tarball into the target location

% cd
% tar xvf /tmp/source.tar

NOTE: Check that any symbolic links in the target home have been preserved so that they link to the same locations as they did in the source home. If necessary, re-create the links.

4. As the 'root' user, use the 'chown' command to change the ownership of any files owned by user A to be owned by user B

% find . -user -exec chown {} \;

NOTE: Do not use "chown -R $ORACLE_HOME" because this will change the ownership of some files that were not previously owned by . For example, $ORACLE_HOME/bin/oradism 

5. As the 'root' user, use the 'chgrp' command to change the group ownership of any files owned by group A to be owned by group B

% find . -group -exec chgrp {} \;

NOTE: Do not use "chgrp -R $ORACLE_HOME" because this will change the ownership of some files that were not previously owned by . For example, $ORACLE_HOME/bin/extjob

6. Rename the $ORACLE_HOME/rdbms/lib/config.o file

% cd $ORACLE_HOME/rdbms/lib
% mv config.o config.o_backup

7. The next step is dependant on which Operating System (OS) is being used

On Linux and HPUX, edit the $ORACLE_HOME/rdbms/lib/config.c file to change the group that owns the installation

% vi config.c

Find the following lines at the end of the file:

    #define SS_DBA_GRP "dba"
    #define SS_OPER_GRP "dba"

Replace "dba" with the name of the group that will own the target installation

Save the changes to the config.c file

On Solaris, edit the $ORACLE_HOME/rdbms/lib/config.s file:

% vi config.s

Find the following lines within the file:

    /* 0x0008 15 */ .ascii "dba\0"
    :
    /* 0x0014 22 */ .ascii "dba\0"

Replace "dba" with the name of the group that will own the target installation

Save the changes to the config.s file

On AIX, edit the $ORACLE_HOME/rdbms/lib/config.s file:

% vi config.s

Find the following lines within the file:

    .csect H.12.NO_SYMBOL{RO}, 3
    .string "dba
    :
    .csect H.14.NO_SYMBOL{RO}, 3
    .string "dba"

Replace "dba" with the name of the group that will own the target installation

Save the changes to the config.s file

See Note:50507.1 for further details

8. Set any environment variables (for example, LD_LIBRARY_PATH) to point to the target home rather than the source home

9. Optionally, regenerate config.o and relink the 'oracle' binary

% make -f ins_rdbms.mk config.o
% make -f ins_rdbms.mk ioracle

These commands are also executed during the relinking phase at the end of the cloning process (step 10)

NOTE: On Sun SPARC Solaris (64-bit), the command to regenerate config.o may fail with the following errors:

/usr/ccs/bin/as -P -K PIC -o config.o config.s
/usr/ccs/bin/as: "config.s", line 12: error: cannot use v9 instructions in a non-v9 target binary
/usr/ccs/bin/as: "config.s", line 14: error: cannot use v9 instructions in a non-v9 target binary
*** Error code 1
make: Fatal error: Command failed for target `config.o'

To workaround this problem, rename $ORACLE_HOME/rdbms/lib/config.o (if it exists) and just relink the 'oracle' binary. Relinking the 'oracle' binary should also regenerate the config.o file.

10. Run the $ORACLE_HOME/clone/bin/clone.pl script. (or ./runInstaller -clone) to clone the installation

% cd $ORACLE_HOME/clone/bin
% perl clone.pl ORACLE_HOME="" ORACLE_HOME_NAME=""

or

% cd $ORACLE_HOME/oui/bin
% ./runInstaller -clone -silent -ignorePreReq ORACLE_HOME="" ORACLE_HOME_NAME=""

If you wish to use an oraInst.loc file in a non-default location, update the "clone_command_line" in $ORACLE_HOME/clone/config/cs.properties so that it includes "-invPtrLoc /oraInst.loc"

See Note:559304.1 and Note:559305.1 for further details about the cloning process

11. Run the $ORACLE_HOME/root.sh script. as the 'root' user

12. Optionally, run the $ORACLE_HOME/install/changePerm.sh script. to relax permissions on the home

13. DB Console users may need to refer to Note:467598.1 and/or Note:278100.1 to enable them to startup the console on the new server

References

NOTE:278100.1 - How To Drop, Create And Recreate the Database Control (DB Control) Release 10g and 11g
NOTE:300062.1 - How To Clone An Existing RDBMS Installation Using OUI
NOTE:467598.1 - The Database Console Fails to Start After a Change in the Hostname
NOTE:50507.1 - SYSDBA and SYSOPER Privileges in Oracle
NOTE:559304.1 - Cloning An Existing Oracle10g Release 2 (10.2.0.x) RDBMS Installation Using OUI
NOTE:559305.1 - Cloning An Existing Oracle11g Release 1 (11.1.0.x) RDBMS Installation Using OUI
PATCH:6613550 - ROOTPRE.SH CHANGE FOR AIX 6.1 (UPDATED AIO CONFIG STEPS)


请使用浏览器的分享功能分享到微信等