Thursday, 1 October 2015

oracle home cloning

Cloning of Oracle Binaries from Source DB to Target DB.
1. Amer:- 192.168.1.111-- SOURCE DB
2. Euro:-192.168.1.112-- TARGET DB


Create directory structure in Target server similar to  source server  , installation of package for Oracle 11gR2, oracle user creation on Host  and setting of limits
1.Installation  Of Oracle 11g On Linux Host.
1. check host  details and dowload the Oracle 11g software that support your  operating system.
[root@localhost ~]# uname -a
Linux amer.localhost 2.6.18-308.el5 #1 SMP Fri Jan 27 17:21:15 EST 2012 i686 i686 i386 GNU/Linux

2. Check Rman , Memory And /Tmp Space
2.1. Physical Memory ( for Oracle 11g RMAN should be at least 1 GB, Here we have 2 GB)
[root@localhost etc]# grep MemTotal /proc/meminfo
MemTotal:      2075036 kB

2.2.Swap Memory
RAM between 1GB and 2GB then Swap = 1.5 times the size of RAM
 RAM between 2GB and 16GB then Swap = equal to the size of RAM
 RAM more than 16GB then Swap Size = 16GB
 Since my RAM is 2GB, so I have 3GB of Swap Size.
[root@localhost etc]# grep SwapTotal /proc/meminfo
SwapTotal:     314412 kB

2.3 check tmp and other space in file system.( You need to have at least 1GB of space in the /tmp directory.)
[root@localhost etc]# df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              21G  2.5G   17G  13% /
/dev/sda2             3.9G   73M  3.7G   2% /tmp
tmpfs                1014M     0 1014M   0% /dev/shm

2.4> To install Oracle 11g Release 2 your system should be running on at least 1024x768 screen resolution.
[root@localhost etc]# xdpyinfo | grep 'dimensions:'
  dimensions:    1162x590 pixels (394x200 millimeters)



2.5>To install Oracle 11g Release 2 on RHEL 5 you should be running a kernel version 2.6.18 or later.
[root@localhost etc]# uname -r
2.6.18-308.el5

3. User Creation
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -m -g oinstall -G dba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
[root@localhost ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


4> Check The Hosts Entry  And Make The Host Entry In This If Not Exists.
[root@euro ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.1.112 euro.localdomain euro

5.> Set Oracle Kernal Parameter For Oracle 11g R2.
vi /etc/sysctl.conf 
# Oracle settings
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304



6.> Make The Above Kernal  Parameter Changes In  Effective Immedidately

 [root@localhost etc]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304

7> Create Oracle Directories To Save Oracle Binaries.

mkdir -p /u01/app/oracle/product/11.2.0/
chown -R oracle:oinstall /u01
chmod -R 0775 /u01

8> Make Other Directories.

mkdir -p /u02/euro/redologcontrol          ---- For Redo log file and Control file
mkdir -p /u03/euro/archivelog              -- for archive log file
mkdir -p /u04/euro/backup                  -- for Backup
mkdir -p /u05/euro/oradata/                     -- for database file
chown -R oracle:oinstall /u02 /u03 /u04 /u05
chmod -R 0775 /u01 /u02 /u03 /u04 /u05

9> Now Set The Shell Limits For The User Oracle. Open /etc/security/limits.Conf And Add These Lines.
vi /etc/security/limits.conf
oracle           soft    nproc   2047
oracle           hard    nproc   16384
oracle           soft    nofile  1024
oracle           hard    nofile  65536



10> Open /etc/pam.d/login And Add The Following Line If It Is Already Not There.
[root@localhost /]# cat /etc/pam.d/login
session    required     pam_limits.so
11> Disable Secure Linux By Editing The /etc/selinux/config File, Making Sure The Selinux Flag Is Set As Follows:
[root@localhost /]# cat /etc/selinux/config
SELINUX=disabled

12>Check Shell
                                                   
[root@localhost /]# echo $SHELL
/bin/bash

13> Setting The Profile

[oracle@localhost /]# cat ~/.bash_profile
# Oracle settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME= euro.localhost; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=euro; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH

if [ $USER = "oracle" ]; then
   if [ $SHELL = "/bin/ksh" ]; then
     ulimit -p 16384
     ulimit -n 65536
   else
     ulimit -u 16384 -n 65536
   fi
fi

umask 022


14> Apply Patch Is Recommeded By Oracle For 11gr2

-bash-3.2# yum install binutils-2.* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* ksh-2* libaio-0.* libaio-devel-0.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.*


15>Create copy Oracle home Binaries from Source server to target server.

15.1> Check Patch details on Source server and also ORACLE_HOME_NAME which we will use later in cloning script.

[oracle@amer ~]$ . oraenv
ORACLE_SID = [oracle] ? amer
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@amer ~]$ cd $ORACLE_HOME/OPatch/

[oracle@amer OPatch]$ ./opatch lsinventory -all
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-10-01_12-59-06PM.log

Patch history file: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2015-10-01_12-59-06PM.txt

--------------------------------------------------------------------------------
List of Oracle Homes:
  Name          Location
   OraDb11g_home1         /u01/app/oracle/product/11.2.0/dbhome_1

Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.1.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.

15.2>check size of ORACLE_HOME

[oracle@amer 11.2.0]$ du -sh *
3.7G    dbhome_1
[oracle@amer 11.2.0]$ pwd
/u01/app/oracle/product/11.2.0

15.3>check the ownership of Oracle_home and directories.

15.4> On source execute tar command  to tar oracle_home directory and source server

$cd /u01/app/oracle/product/11.2.0/

$tar -cvf dbhome_1.tar dbhome_1

Now copy Oracle home tar file from source to target server.

bash-3.2# scp dbhome_1.tar root@192.168.1.112:/u01/app/oracle/product/11.2.0/
root@192.168.1.112's password:
dbhome_1.tar           25%  909MB   7.3MB/s   06:11 ETA

16> Login to Target server and perform the following activity

16.1> cd to location where you have scp the tar file and untar oracle binaries.

[oracle@euro u01]$ cd /u01/app/oracle/product/11.2.0/
[oracle@euro 11.2.0]$ ls -lrth
total 3.6G
-rwxrwxrwx 1 root root 3.6G Oct  1 12:16 dbhome_1.tar


16.2>untar the Oracle_home binaries
cd /u01/app/oracle/product/11.2.0/
$tar -xvf dbhome_1.tar

17>Run the clone script.
                                     
[oracle@euro OPatch]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/oui/bin/
[oracle@euro bin]$ ./runInstaller -clone -silent -ignorePreReq ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1/" ORACLE_HOME_NAME="OraDb11g_home1" ORACLE_BASE="/u01/app/oracle" OSDBA_GROUP=oracle OSOPER_GROUP=oinstall

Note:- ORACLE_HOME_NAME is put from step-15

Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 2047 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-10-01_05-21-02PM. Please wait ...[oracle@euro bin]$ Oracle Universal Installer, Version 11.2.0.1.0 Production
Copyright (C) 1999, 2009, Oracle. All rights reserved.

You can find the log of this install session at:
 /u01/app/oraInventory/logs/cloneActions2015-10-01_05-21-02PM.log
.................................................................................................... 100% Done.



Installation in progress (Thursday, October 1, 2015 5:21:36 PM IST)
..............................................................................                                                  78% Done.
Install successful

Linking in progress (Thursday, October 1, 2015 5:22:01 PM IST)
Link successful

Setup in progress (Thursday, October 1, 2015 5:23:37 PM IST)
Setup successful

End of install phases.(Thursday, October 1, 2015 5:25:22 PM IST)
Starting to execute configuration assistants
Configuration assistant "Oracle Configuration Manager Clone" succeeded
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script '/u01/app/oraInventory/orainstRoot.sh' with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.
The following configuration scripts need to be executed as the "root" user.
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/dbhome_1//root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts
   
The cloning of OraDb11g_home1 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2015-10-01_05-21-02PM.log' for more details.



18. >Run root.sh and orainstRoot.sh script using Root user.

[oracle@euro bin]$ su - root
Password:
[root@euro ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@euro ~]# /u01/app/oracle/product/11.2.0/dbhome_1//root.sh
Check /u01/app/oracle/product/11.2.0/dbhome_1//install/root_euro.localdomain_2015-10-01_17-27-42.log for the output of root script
[root@euro ~]# cat /u01/app/oracle/product/11.2.0/dbhome_1//install/root_euro.localdomain_2015-10-01_17-27-42.log

Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_1/

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
]

19. Check the directory permission on Oracle Home

[oracle@euro bin]$ cd /u01/app/oracle/product/11.2.0/dbhome_1
[oracle@euro dbhome_1]$ ls -lrth
total 328K
drwxr-xr-x  3 oracle oinstall 4.0K Sep 27 23:26 wwg
drwxr-xr-x  4 oracle oinstall 4.0K Sep 27 23:26 uix
drwxr-xr-x  3 oracle oinstall 4.0K Sep 27 23:26 sqlj
drwxr-xr-x  3 oracle oinstall 4.0K Sep 27 23:26 slax
drwxr-xr-x  4 oracle oinstall 4.0K Sep 27 23:26 scheduler
-rwxr-x---  1 oracle oinstall   10 Sep 27 23:26 root.sh.old.1
drwxr-xr-x  7 oracle oinstall 4.0K Sep 27 23:26 precomp
drwxr-xr-x  4 oracle oinstall 4.0K Sep 27 23:26 owm
drwxr-xr-x  8 oracle oinstall 4.0K Sep 27 23:26 ord
drwxr-xr-x  4 oracle oinstall 4.0K Sep 27 23:26 oracore
drwxr-xr-x  5 oracle oinstall 4.0K Sep 27 23:26 ons
drwxr-xr-x  5 oracle oinstall 4.0K Sep 27 23:26 olap
drwxr-xr-x  6 oracle oinstall 4.0K Sep 27 23:26 odbc
drwxr-xr-x  6 oracle oinstall 4.0K Sep 27 23:26 nls
drwxr-xr-x  6 oracle oinstall 4.0K Sep 27 23:26 md
drwxr-xr-x  4 oracle oinstall 4.0K Sep 27 23:26 jdev
drwxr-xr-x  8 oracle oinstall 4.0K Sep 27 23:26 javavm
drwxr-xr-x  8 oracle oinstall 4.0K Sep 27 23:26 ide
drwxr-xr-x  3 oracle oinstall 4.0K Sep 27 23:26 has
drwxr-xr-x  3 oracle oinstall 4.0K Sep 27 23:26 emcli
drwxr-xr-x  4 oracle oinstall 4.0K Sep 27 23:26 dv
drwxr-xr-x  3 oracle oinstall 4.0K Sep 27 23:26 diagnostics

20>run Opatch utility to check all the details



[oracle@euro ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@euro ~]$
[oracle@euro ~]$ cd $ORACLE_HOME/OPatch
[oracle@euro OPatch]$ ./opatch lsinventory
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-10-01_17-33-27PM.log

Patch history file: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2015-10-01_17-33-27PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.1.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.
[oracle@euro OPatch]$


No comments:

Post a Comment