Cloning Oracle home and creating a new database

Oracle database Installation using binaries copied from other server (Perl clone on RHEL/Centos):

1. Make sure following rpms are installed :

binutils 
compat-libcap1 
compat-libstdc++-33
gcc 
gcc-c++ 
glibc 
glibc-devel 
ksh 
libgcc 
libstdc++ 
libstdc++-devel 
libaio 
libaio-devel 
make 
sysstat

2. Create a new user and group who will be the owner of oracle binaries.

groupadd dba
useradd -g dba oracle --> -g to add dba as primary group

3. Check ulimits (/etc/security/limits.conf)

 file descriptor setting (nofile):
 $ ulimit -Sn
 1024
 $ ulimit -Hn
 65536
 number of processes (nproc):
 $ ulimit -Su
 2047
 $ ulimit -Hu
 16384
 stack setting (stack):
 $ ulimit -Ss
 10240
 $ ulimit -Hs
 32768

4.  Create oracle directories and copy binaries

/u01/app/oracle/product -> location for oracle binaries
/u01/oradata/test -> location for datafiles
/u01/oradata/diag -> location for diagnostic dest
/u01/app/oraInventory -> oracle central inventory

5. Set System variables

ORACLE_HOME=/u01/app/oracle/product/11.2.0.3
ORACLE_SID=test
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$ORACLE_HOME/bin

6. Unzip binaries and Run perl clone

cd $ORACLE_HOME/clone/bin
perl clone.pl ORACLE_HOME="/u01/app/oracle/product/11.2.0.3" ORACLE_HOME_NAME="OraDb11gr2_home" ORACLE_BASE="/u01/app/oracle"

7. Create pfile, most important parameters mentioned below:

db_name=test
db_unique_name=test_pri
sga_target=1G
sga_max_size=1G
remote_login_passwordfile='EXCLUSIVE'
pga_aggregate_target=50M
control_files='/u01/oradata/test/control01.ctl','/u01/oradata/test/control02.ctl'
compatible='11.2.0'
db_recovery_file_dest=/u01/oradata
db_recovery_file_dest_size=1G
diagnostic_dest=/u01/oradata
db_create_file_dest=/u01/oradata/test
db_create_online_log_dest_1=/u01/oradata/test
log_archive_dest_1='location=/u01/oradata/arch mandatory'
log_archive_dest_state_1=enable
log_archive_format=test_%t_%r_%s.arc

8. Setup oracle user environment :

edit .bashrc and add below content
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=test
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
alias sysdba='sqlplus / as sysdba'

9. Connect to instance and create new database

sysdba
SQL> STARTUP NOMOUNT
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 281019576 bytes
Database Buffers 780140544 bytes
Redo Buffers 5541888 bytes

CREATE DATABASE test
USER SYS IDENTIFIED BY dev2
USER SYSTEM IDENTIFIED BY dev2
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp
UNDO TABLESPACE undotbs1
DEFAULT TABLESPACE users;

10. Create data dictionary views

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql

 

Leave a Reply

Your email address will not be published. Required fields are marked *