This article presents how to install Oracle on Centos 5.
Read following article howto install Centos 5 Linux: Install Centos 5 (for comfort set 2G memory for your virtual machine before proceeding with Oracle software installation).
Installation software is available on OTN version 11.2.0.1 or metalink 11.2.0.3. In this installation I’m presenting installation for 11.2.0.3 but for previous version 11.2.0.X it shouldn’t be different.
Software
Binaries 11.2.0.3
p10404530_112030_Linux-x86-64_1of7.zip - database software p10404530_112030_Linux-x86-64_2of7.zip - database software p10404530_112030_Linux-x86-64_3of7.zip - grid software
OS configuration and preparation – as root user
Add groups
--required groups /usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 503 oper
Add users
/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle
Modification and verification for user and groups can be done in graphical mode -run from menu: System->Administration->Users and Groups
Change password for users
passwd oracle
Add kernel parameters to /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
Add following line for user grid and oracle shell limits in file /etc/security/limits.conf
--shell limits for users oracle and grid 11gR2 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
The “/etc/hosts” file must contain a fully qualified name for the server.
<IP-address> <fully-qualified-machine-name> <machine-name>
For example.
127.0.0.1 centos5 centos5.dbaora.com localhost localhost.localdomain
Create profile .bash_profile_grid for ASM grid software in home directory /home/oracle of user oracle
# Oracle Settings export TMP=/tmp export ORACLE_HOSTNAME=centos5.dbaora.com export ORACLE_UNQNAME=+ASM export ORACLE_BASE=/ora01/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; alias cdob='cd $ORACLE_BASE' alias cdoh='cd $ORACLE_HOME' alias tns='cd $ORACLE_HOME/network/admin' alias envo='env | grep ORACLE'
Create profile .bash_profile_database for database software in home directory /home/oracle of user oracle
# Oracle Settings export TMP=/tmp export ORACLE_HOSTNAME=centos5.dbaora.com export ORACLE_UNQNAME=ORA11G export ORACLE_BASE=/ora01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID=ORA11G 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; alias cdob='cd $ORACLE_BASE' alias cdoh='cd $ORACLE_HOME' alias tns='cd $ORACLE_HOME/network/admin' alias envo='env | grep ORACLE' umask 022
in case you created both profiles as root change owner and group of both bash profiles
chown oracle:oinstall /home/oracle/.bash_profile_grid chown oracle:oinstall /home/oracle/.bash_profile_database
Modify main profile .bash_profile of user oracle in /home/oracle
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH alias genv='. /home/oracle/.bash_profile_grid;envo' alias denv='. /home/oracle/.bash_profile_database;envo' . /home/oracle/.bash_profile_database envo
So next time you do su to oracle user you should have environment prepared for database software
[root@centos5 ~]# su - oracle ORACLE_UNQNAME=ORA11G ORACLE_SID=ORA11G ORACLE_BASE=/ora01/app/oracle ORACLE_HOSTNAME=centos5.dbaora.com ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1 [oracle@centos5 ~]$
Number of aliases are defined in profiles to quickly managed environment
genv – sets environment for grid software
alias genv=’. /home/oracle/.bash_profile_grid;envo’
[oracle@centos5 oracle]$ genv ORACLE_UNQNAME=+ASM ORACLE_SID=+ASM ORACLE_BASE=/ora01/app/grid ORACLE_HOSTNAME=centos5.dbaora.com ORACLE_HOME=/ora01/app/grid/product/11.2.0/grid
denv – sets environment for database software
alias denv=’. /home/oracle/.bash_profile_database;envo’
[oracle@centos5 oracle]$ denv ORACLE_UNQNAME=ORA11G ORACLE_SID=ORA11G ORACLE_BASE=/ora01/app/oracle ORACLE_HOSTNAME=centos5.dbaora.com ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1
cdob – change directory to $ORACLE_BASE
alias cdob=’cd $ORACLE_BASE’
cdoh – change directory to $ORACLE_HOME
alias cdoh=’cd $ORACLE_HOME’
tns – change directory to $ORACLE_HOME/network/admin
alias tns=’cd $ORACLE_HOME/network/admin’
envo – displays current environments settings and filters by ORACLE word
alias envo=’env | grep ORACLE’
[oracle@centos5 oracle]$ envo ORACLE_UNQNAME=ORA11G ORACLE_SID=ORA11G ORACLE_BASE=/ora01/app/oracle ORACLE_HOSTNAME=centos5.dbaora.com ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1
Check which packages are installed and which are missing
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \ compat-libstdc++-33 \ elfutils-libelf \ elfutils-libelf-devel \ gcc \ gcc-c++ \ glibc \ glibc-common \ glibc-devel \ glibc-headers \ ksh \ libaio \ libaio-devel \ libgcc \ libstdc++ \ libstdc++-devel \ make \ sysstat \ unixODBC \ unixODBC-devel
Install missing packages
--it's just example yum install unixODBC yum install unixODBC-devel
Install pdksh package
yum install pdksh
Create directory structure
mkdir -p /ora01/app chown oracle:oinstall /ora01/app chmod 775 /ora01/app
oracle_base for grid software
mkdir -p /ora01/app/grid chown -R oracle:oinstall /ora01/ chmod 775 /ora01/app/grid
oracle_base for database software
mkdir -p /ora01/app/oracle chown oracle:oinstall /ora01/app/oracle chmod 775 /ora01/app/oracle
Create ORACLE_HOME directories for grid and database software
mkdir -p /ora01/app/oracle/product/11.2.0/db_1 chown oracle:oinstall -R /ora01/app/oracle mkdir -p /ora01/app/grid/product/11.2.0/grid chown oracle:oinstall -R /ora01/app/grid
Disable secure linux by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows. It requires REBOOT to be effective !!!
SELINUX=disabled
Disable Firewall
Run firewall graphical manager “System”->”Administration”->”Security Level and Firewall” and click “Disable” button and “Apply” button. As you can notice you can change SELinux on second tab as well.
ASM devices configuration
it’s time to add ASM disks to our host as root user. There are 2 options I present here in this article:
- create dummy loopback device to simulate our drive
- add new drive to virtual machine dedicated for ASM
Option number 1 – add loopback device
--create directory for loopback devices mkdir /asmdisks
--create dummy files dd if=/dev/zero of=/asmdisks/disk1 bs=1024k count=5120 dd if=/dev/zero of=/asmdisks/disk2 bs=1024k count=5120
--change owner and group for grid user chown -R oracle:oinstall /asmdisks
--check privileges ls -la /asmdisks total 10496036 drwxr-xr-x 2 grid asmadmin 4096 Oct 16 15:20 . drwxr-xr-x 28 root root 4096 Oct 16 15:19 .. -rw-r--r-- 1 grid asmadmin 5368709120 Oct 16 15:20 disk1 -rw-r--r-- 1 grid asmadmin 5368709120 Oct 16 15:21 disk2
--create loopback devices and check them losetup /dev/loop1 /asmdisks/disk1 losetup /dev/loop2 /asmdisks/disk2 losetup -a /dev/loop1: [fc00]:655363 (/asmdisks/disk1) /dev/loop2: [fc00]:655364 (/asmdisks/disk2)
Configure public YUM repository described in following article for Enterprise Linux 5:
Add Oracle public YUM server for Oracle RPMs
Once it’s done install asm library drivers
yum install oracleasm-support oracleasmlib oracleasm-`uname -r`
Configure and install ASM library
--configure ASM lib driver /etc/init.d/oracleasm configure Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface []: oracle Default group to own the driver interface []: oinstall Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done Initializing the Oracle ASMLib driver: [ OK ] Scanning the system for Oracle ASMLib disks: [ OK ]
--create asm devices oracleasm createdisk DISK1 /dev/loop1 oracleasm createdisk DISK2 /dev/loop2
--check asmdisks oracleasm listdisks DISK1 DISK2
Add the following entries to the file “/etc/rc.local”
/sbin/losetup /dev/loop1 /asmdisks/disk1 /sbin/losetup /dev/loop2 /asmdisks/disk2 #/etc/init.d/oracleasm createdisk DISK1 /dev/loop1 #/etc/init.d/oracleasm createdisk DISK2 /dev/loop2 /etc/init.d/oracleasm scandisks
Option number 2 – add dedicated disks
I assume you can add disk to virtual machine and you can find it under unix. For my tests I added new 20G disk to my virtual machine. It’s visible in Linux as /dev/sdb device.
--add 2 new partitions to /dev/sdb fdisk /dev/sdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-2610, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +10240M Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (1247-2610, default 1247): Using default value 1247 Last cylinder or +size or +sizeM or +sizeK (1247-2610, default 2610): Using default value 2610 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
--List new partitions fdisk -l /dev/sdb Device Boot Start End Blocks Id System /dev/sdb1 1 1246 10008463+ 83 Linux /dev/sdb2 1247 2610 10956330 83 Linux
--Map new partitions to asm library oracleasm createdisk DISK3 /dev/sdb1 Writing disk header: done Instantiating disk: done oracleasm createdisk DISK4 /dev/sdb2 Writing disk header: done Instantiating disk: done
--List all ASM disks oracleasm listdisks DISK1 DISK2 DISK3 DISK4 ll /dev/oracleasm/disks/ total 0 brw-rw---- 1 grid asmadmin 7, 1 Oct 16 15:31 DISK1 brw-rw---- 1 grid asmadmin 7, 2 Oct 16 15:31 DISK2 brw-rw---- 1 grid asmadmin 8, 17 Oct 16 15:35 DISK3 brw-rw---- 1 grid asmadmin 8, 18 Oct 16 15:35 DISK4
Install grid software
Start grid installation as user oracle, remember to run command xhost+ as root. Remember to set environment for grid software using alias genv.
xhost + access control disabled, clients can connect from any host
su - oracle --use genv alias to set environment for grid software [oracle@centos5 ~]$ genv ORACLE_UNQNAME=+ASM ORACLE_SID=+ASM ORACLE_BASE=/ora01/app/grid ORACLE_HOSTNAME=centos5.dbaora.com ORACLE_HOME=/ora01/app/grid/product/11.2.0/grid --run alias command cdob and cdoh to check ORACLE_BASE, ORACLE_HOME [oracle@centos5 ~]$ cdob [oracle@centos5 grid]$ pwd /ora01/app/grid [oracle@centos5 grid]$ cdoh [oracle@centos5 grid]$ pwd /ora01/app/grid/product/11.2.0/grid --run installation form directory where you have grid software ./runInstall
1. Select “Skip software updates” and click “Next” button.
2. Select “configure Oracle Grid Infrastructure for Standalone Server” and click “Next” button.
3. Select language and click “Next” button.
4. It’s time to create ASM diskgroup DATA. So first you need to make visible ASM devices. Click “Change Discovery Path” button.
5. Enter new discovery path: /dev/oracleasm/disks/* and click “OK” button.
6. You should see 4 ASM devices. Select “External” Redundancy for new diskgroup and check checkbox for one device /dev/oracleasm/disks/DISK3. Click “Next” button.
7. From security point of view you should specify separate password for user SYS and ASMSNMP. I set for both user the same password. Click “Next” button.
8. In case your password is simple Oracle display following screen. Just ignore it and click “Yes” or “No” to change password to more complex.
9. You can change assignment of groups to ASM roles here. When it’s done click “Next” button. Ignore errors there is no separation for grid software and database software so groups can be the same.
10. Just click “Next” button.
11. Just click “Next” buton.
12. Oracle makes checks before installation begin. It’s the last moment to verify OS settings. In my case Oracle detected that swap is “too small”. You can change it and click “Check Again” or like in my case check checkbox “Ignore All” and click “Next” button. 2GB of ram and almost 2GB of swap is more than enough to proceed with installation.
13. Summary screen just before installation begin. Click “Install” button.
14. Boring installation …
15. In the “middle” of installation you will be asked to run 2 scripts as user root. when scripts are executed just click “OK” button. Installation will proceeed.
--execute scripts /ora01/app/oraInventory/orainstRoot.sh /ora01/app/grid/product/11.2.0/grid/root.sh
16. Installation completed. Just click “Close” button.
After this installation you can increase swap to 4GB.
Install database software
Let’s start with database software installation as oracle user. Remember to set environment for database software using denv alias.
su - oracle --use denv alias to set environment for database software [oracle@centos5 ~]$ denv ORACLE_UNQNAME=ORA11G ORACLE_SID=ORA11G ORACLE_BASE=/ora01/app/oracle ORACLE_HOSTNAME=centos5.dbaora.com ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1 --run alias command cdob and cdoh to check ORACLE_BASE, ORACLE_HOME [oracle@centos5 ~]$ cdob [oracle@centos5 oracle]$ pwd /ora01/app/oracle [oracle@centos5 oracle]$ cdoh [oracle@centos5 db_1]$ pwd /ora01/app/oracle/product/11.2.0/db_1 --run installation form directory where you have grid software ./runInstall
1. Uncheck checkbox “I wish to receive security updates via My Oracle Support” and click “Next” button.
2. Ignore this message and click “Yes”
3. Select “Skip software updates” and click “Next” button.
4. Select “Install database software only” and click “Next”. You can of course create database here but I want to have control how this database is created.
5. Select “Single instance database installation” and click “Next” button.
6. Select language and click “Next” button.
7. Just click “Next”
8. Just click “Next”
9. Just click “Next”
10. I ignored messages about swap by checking “Ignore All”. Then click “Next” button.
11. Ignore this message and click “Yes”
12. Start installation click “Install” button.
13. Installation in progress …
14. You need to run one script as user root. When it’s done click “OK” button.
[root@centos5 ]# /ora01/app/oracle/product/11.2.0/db_1/root.sh
15. Installation database software completed
ASM configuration assistant – ASMCA
So far we have created only one ASM group DATA. I want to show you how quickly you can add extra group to ASM instance.
As user oracle start ASMCA. Remeber to start xhost + as user root to enable run graphical tools from other users like oracle. Remember to set environment to point to grid software.
[root@centos5 ~]# su - oracle [oracle@centos5 ~]$ genv [oracle@centos5 ~]$ asmca
1. ASMCA started just click “Create” button.
2. Enter group name BACKUP, check checkbox for “/dev/oracleasm/disks/DISK4″ device and click “OK” button. Other devices we can use later.
3. You should see following screen. Click “OK”.
4. Now you should see we have 2 ASM groups “BACKUP” and “DATA”. Click “Exit” button.
Now you can verify in sqlplus you have 2 ASM groups.
[oracle@centos5 ~]$ sqlplus SQL*Plus: Release 11.2.0.3.0 Production on Sun Oct 14 22:39:11 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter user-name: / as sysasm Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Automatic Storage Management option SQL> select name from v$asm_diskgroup; NAME ------------------------------ DATA BACKUP
Database configuration assistant – DBCA
As user oracle start DBCA. Remeber to start xhost + as user root to enable run graphical tools from other users like oracle. Remember to set environment for database software using denv alias.
[root@centos5 ~]# su - oracle [oracle@centos5 ~]$ denv [oracle@centos5 ~]$ dbca
1. Click “Next” button.
2. Just click “Next” button.
3. Just click “Next” button
4. Enter global database name and sid name.
5. Just click “Next” button.
6. From security point of view you should set separate passwords for user SYS, SYSTEM, DBSNMP, SYSMAN. You can set the same password for all users like below.
7. In case password is too simple you see below screen. You can ignore by clicking “Yes” button.
8. Select as Storage Type “Automatic Storage Management (ASM)” then click “Browse” button for Database Area.
9. Select DATA diskgroup and click “OK” button.
10. Click “Next” button.
11. You should see following screen to enter ASMSNMP password then click “OK”.
12. On this screen check checkbox “Specify fast Recovery Area” and “Enable Archiving”. It will create flashback area and turn on archivlog on database. Click “Browse” button to select ASM diskgroup for flashback.
13. Select diskgroup “BACKUP” then click “OK” button.
14. Click “Next” button.
15. Check checkbox “Sample Schemas” to install extra shemas. It’s very usefull for developers.
16. Following 4 screens shows information about our new database. You can change some settings for the database like memory settings, initial parameters, character set of your database, change default connection type(dedicated server, shared server). Then click “Next” button.
17. Summary screen. You can review storage layout for our new database. Click “Next” button.
18. This screen enables 3 options. Select 1 and 3 option and click “Finish” button.
- Create Database – it will create database in graphical mode.
- Save as Database Template – it will create template which can be later used by DBCA to create similar database.
- Generate Database Creation Scripts – it will generate scripts which can be used later to install the database in silent mode.
19. Summary screen. Click “OK” button to start installation.
20. First script for silent mode is generated. Click “OK” button to progress with installation.
21. Boring installation …
22. When it’s done you can see some interesting details for our new database.
23. You can verify new database in Database Control
Have a fun 🙂
Tomasz