Monday, October 6, 2014

Oracle Database 11g R2 installation On OEL5.5 using ASM Storage

Physical Machine     rhel7.localdomain  CentOS 7 x86_64                                 10.0.5.1
Virtual Machine  db112srv6.localdomain      Oracle Enterprise Linux 5.5 x86_64       10.0.5.6
Oracle Database 11g Release 2 (11.2.0.1.0) x86_64
VirtualBox              3.4.16

- Set Hostname & IP Address for Virtual Machine

# vim /etc/hosts
10.0.5.6        db112srv6.localdomain   db112srv6

# vim /etc/redhat-release
redhat-4

# vim /etc/sysconfig/netwrok
HOSTNAME=db112srv6.localdomain

# hostname db112srv6.localdomain
# /etc/init.d/network restart

- Creating Required Operating System Groups and Users

# /usr/sbin/groupadd -g 501 oinstall
# /usr/sbin/groupadd -g 502 dba
# /usr/sbin/groupadd -g 503 oper
# /usr/sbin/groupadd -g 504 asmadmin
# /usr/sbin/groupadd -g 505 asmdba
# /usr/sbin/groupadd -g 506 asmoper
# /usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
# /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle
# passwd oracle
# passwd grid

- Creating Required Directories

# mkdir -p /u01/app/oracle/product/11.2.0/db_1
# mkdir -p /u01/app/grid/product/11.2.0/grid
# chown -R oracle:oinstall /u01
# chown -R grid:oinstall /u01/app/grid
# chmod -R 775 /u01


- Create .bash_profile for user grid

[root@db112srv6 ~]# vim /home/grid/.bash_profile
# Oracle Settings
export TMP=/tmp
export ORACLE_HOSTNAME=db112srv6.localdomain
export ORACLE_UNQNAME=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid
export ORACLE_SID=+ASM
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

[root@db112srv6 ~]# source /home/grid/.bash_profile

- Create .bash_profile for user oracle

[root@db112srv6 ~]# vim /home/oracle/.bash_profile
# Oracle Settings
PATH=$PATH:$HOME/bin
export PATH
# Oracle Settings
export TMP=/tmp
export ORACLE_HOSTNAME=db112srv6.localdomain
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
umask 022

[root@db112srv6 ~]# source /home/oracle/.bash_profile

- Change kernel parameters to /etc/sysctl.conf

vim /etc/sysctl.conf

# kernel parameters for 11g installation
kernel.shmmni = 4096
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128

fs.aio-max-nr = 1048576
fs.file-max = 6815744
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

- Apply kernel parameters
# /sbin/sysctl -p

- Set shell limits in file /etc/security/limits.conf

vim /etc/security/limits.conf
## shell limits for users oracle and grid 11gR2
grid    soft    nproc    131072
grid    hard    nproc    131072
grid    soft    nofile   131072
grid    hard    nofile   131072
grid    soft    core     unlimited
grid    hard    core     unlimited
grid    soft    memlock  50000000
grid    hard    memlock  50000000

oracle   soft   nproc    131072
oracle   hard   nproc    131072
oracle   soft   nofile   131072
oracle   hard   nofile   131072
oracle   soft   core     unlimited
oracle   hard   core     unlimited
oracle   soft   memlock  50000000
oracle   hard   memlock  50000000

- Packages Enterprise Linux 5 from DVD

# cd /media/Enterprise Linux dvd 20100405/Server
rpm -Uvh binutils-2.*
rpm -Uvh compat-libstdc++-33*
rpm -Uvh compat-libstdc++-33*.i386.rpm
rpm -Uvh elfutils-libelf*
rpm -Uvh gcc-4.*
rpm -Uvh gcc-c++-4.*
rpm -Uvh glibc-2.*
rpm -Uvh glibc-common-2.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers-2.*
rpm -Uvh ksh*
rpm -Uvh libaio-0.*
rpm -Uvh libaio-devel-0.*
rpm -Uvh libgomp-4.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh make-3.*
rpm -Uvh sysstat-7.*
rpm -Uvh unixODBC-2.*
rpm -Uvh unixODBC-devel-2.*
rpm -Uvh numactl-devel-*
rpm -Uvh elfutils-libelf-devel-0.97*
rpm -Uvh pdksh-5.2.14*
rpm -Uvh --nodeps elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm
rpm -Uvh elfutils-libelf-devel-0.137-3.el5.x86_64.rpm
 cd /
eject

- Disable SELinux & Firewall and reboot server

vim /etc/selinux/config
SELINUX=disabled

setup



chkconfig iptables off
chkconfig --list iptables
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off
/etc/init.d/iptables stop
/etc/init.d/iptables status
Firewall is stopped.
reboot

- Setup Oracle ASM

http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html
Library and Tools
oracleasm-support-2.1.8-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm

Drivers for kernel 2.6.18-194.el5
oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.x86_64.rpm
oracleasm-2.6.18-194.el5debug-2.0.5-1.el5.x86_64.rpm
oracleasm-2.6.18-194.el5-debuginfo-2.0.5-1.el5.x86_64.rpm
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm

root@db112srv6 asm-pkgs]# rpm -Uvh oracleasmlib-2.0.4-1.el5.x86_64.rpm \
oracleasm-support-2.1.8-1.el5.x86_64.rpm
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm

- Prepare disks to ASM

- Adding 3 Disks to Virtual Machine  to be sdb,sdc,sdd




ll /dev/sd*
brw-r----- 1 root disk 8,  0 Oct  5 11:50 /dev/sda
brw-r----- 1 root disk 8,  1 Oct  5 11:51 /dev/sda1
brw-r----- 1 root disk 8,  2 Oct  5 11:50 /dev/sda2
brw-r----- 1 root disk 8, 16 Oct  5 11:50 /dev/sdb
brw-r----- 1 root disk 8, 32 Oct  5 11:50 /dev/sdc
brw-r----- 1 root disk 8, 48 Oct  5 11:50 /dev/sdd

fdisk /dev/sdb > n > p > 1 > Enter Key > Enter key >  w
fdisk /dev/sdc > n > p > 1 > Enter Key > Enter key >  w
fdisk /dev/sdd > n > p > 1 > Enter Key > Enter key >  w

/etc/init.d/oracleasm configure
Default user to own the driver interface [grid]: grid
Default group to own the driver interface [asmdba]: asmdba
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk:                        [  OK  ]
/etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "VOL2" as an ASM disk:                        [  OK  ]
/etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "VOL3" as an ASM disk:                        [  OK  ]

/etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]

/etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3

ll /dev/oracleasm/disks/
total 0
brw-rw---- 1 grid asmdba 8, 17 Oct  5 12:44 VOL1
brw-rw---- 1 grid asmdba 8, 33 Oct  5 12:44 VOL2
brw-rw---- 1 grid asmdba 8, 49 Oct  5 12:44 VOL3

- Install Oracle ASM software

ssh -Y grid@10.0.5.6
grid@10.0.5.6's password:
cd /tmp/grid/
./runInstaller
 /u01/app/oraInventory/orainstRoot.sh
 /u01/app/grid/product/11.2.0/grid/root.sh













[grid@db112srv6 ~]$ asmcmd -p
ASMCMD [+] > lsdsk -p
Group_Num  Disk_Num      Incarn  Mount_Stat  Header_Stat  Mode_Stat  State   Path
        1         0  3916073517  CACHED      MEMBER       ONLINE     NORMAL  ORCL:VOL1
        1         1  3916073518  CACHED      MEMBER       ONLINE     NORMAL  ORCL:VOL2
        1         2  3916073519  CACHED      MEMBER       ONLINE     NORMAL  ORCL:VOL3
ASMCMD [+] > exit

[grid@db112srv6 ~]$ sqlplus / as sysasm

SQL> select instance_name,status,version from v$instance;

INSTANCE_NAME    STATUS       VERSION
---------------- ------------ -----------------
+ASM             STARTED      11.2.0.1.0

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
DATA

SQL> exit

[grid@db112srv6 ~]$ srvctl status diskgroup -g DATA
Disk Group DATA is running on db112srv6

[grid@db112srv6 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): db112srv6

- Install Database software

[oracle@rhel7 linux.x64_11gR2]$ scp -v linux.x64_11gR2_database_*  oracle@10.0.5.6:/tmp/

[oracle@rhel7 ~]$ ssh -Y oracle@10.0.5.9

[oracle@db112srv6 database]$ cd /tmp/

[oracle@db112srv6 database]$ unzip linux.x64_11gR2_database_1of2.zip

[oracle@db112srv6 database]$ unzip linux.x64_11gR2_database_2of2.zip

[oracle@db112srv6 database]$ cd /tmp/database/

[oracle@db112srv6 database]$ ./runInstaller

[root@db112srv6 ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh











- Create Oracle Database

[oracle@db112srv6 ~]$ dbca




























- Verify Database Working Fine

[oracle@db112srv6 ~]$ sqlplus / as sysdba

SQL> select instance_name,status,database_status,version,archiver from v$instance;

INSTANCE_NAME    STATUS       DATABASE_STATUS   VERSION           ARCHIVE
---------------- ------------ ----------------- ----------------- -------
orcl             OPEN         ACTIVE            11.2.0.1.0        STARTED

SQL> select name, log_mode, created from v$database;

NAME      LOG_MODE     CREATED
--------- ------------ ---------
ORCL      ARCHIVELOG   05-OCT-14

SQL> set lines 2000
SQL> col product format a45;
SQL> col version format a15;
SQL> col status format a20;
SQL> select * from product_component_version;

PRODUCT                                       VERSION         STATUS
--------------------------------------------- --------------- --------------------
NLSRTL                                        11.2.0.1.0      Production
Oracle Database 11g Enterprise Edition        11.2.0.1.0      64bit Production
PL/SQL                                        11.2.0.1.0      Production
TNS for Linux:                                11.2.0.1.0      Production

SQL> col file_name format a65;
SQL> col tablespace_name format a20;
SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME                                                         TABLESPACE_NAME
----------------------------------------------------------------- --------------------
+DATA/orcl/datafile/users.259.860170923                           USERS
+DATA/orcl/datafile/undotbs1.258.860170923                        UNDOTBS1
+DATA/orcl/datafile/sysaux.257.860170923                          SYSAUX
+DATA/orcl/datafile/system.256.860170921                          SYSTEM
+DATA/orcl/datafile/example.269.860171393                         EXAMPLE

SQL> exit

- Startup ASM & Database instance at system boot time

[oracle@db112srv6 ~]$ vim /etc/oratab
+ASM:/u01/app/grid/product/11.2.0/grid:Y
orcl:/u01/app/oracle/product/11.2.0/db_1:Y
:wq

- Shutdown Database server

[oracle@db112srv6 ~]$ emctl stop dbconsole
[oracle@db112srv6 ~]$ srvctl stop database -d orcl
[oracle@db112srv6 ~]$ srvctl stop asm
[oracle@db112srv6 ~]$ su
[root@db112srv6 ~]$ poweroff

- Startup ASM & Database instance

[oracle@db112srv6 ~]$ srvctl start asm
[oracle@db112srv6 ~]$ srvctl start database -d orcl
[oracle@db112srv6 ~]$ emctl start dbconsole

happy oracle ..


No comments:

Post a Comment