You are on page 1of 19

ORACLE 11G SETUP AND DATABASE CREATION IN CENTOS5.

Install Oracle database 11g. X Window system is needed for it.

1-> Install some packages first for dependencies.


yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-
libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio
libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC
unixODBC-devel

2 -> Edit kernel parameter.


vi /etc/sysctl.conf
# add at the bottom
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
3 -> sysctl -p
4 -> Create users and groups and set environment for Oracle.
groupadd -g 200 oinstall
groupadd -g 201 dba
useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle
passwd oracle
chmod 755 /usr/oracle
mkdir /usr/oracle/app
chown -R oracle:oinstall /usr/oracle/app
chmod -R 775 /usr/oracle/app
mkdir /usr/oracle/oradata
chown -R oracle:oinstall /usr/oracle/oradata
chmod -R 775 /usr/oracle/oradata
5 -> vi /etc/pam.d/login
# add at the bottom
session required /lib/security/pam_limits.so
session required pam_limits.so
6 -> vi /etc/security/limits.conf
# add at the bottom
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
7 -> vi /etc/profile
# add at the bottom
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
8 -> vi /usr/oracle/.bash_profile
# add at the bottom
umask 022
export ORACLE_BASE=/usr/oracle/app
9 -> Downlodad and install Oracle 11g. Do them with a user "Oracle" that is created on section
mkdir tmp
cd tmp
unzip linux_x86_11gR1_database.zip
database/runInstaller
 Installer starts like below. uncheck "Create Starter Database"
and Click "Next".

 It's OK, Go next.


 It's OK, Go next.

 Click "Install" button and start installation.


 Installation proceeds.

 It's necessary to run config scripts that shows on the screen


below with root user. After running, come back to this screen
and Click "OK" button.
 Open a new terminal and run above picture show command
 /usr/oracle/oraInventory/orainstRoot.sh
 /usr/oracle/app/product/11.1.0/db_2/root.sh

 Installation completes. Click "Exit" button.


10 -> Set environment for Oracle user and remove temporary directory.
vi .bash_profile
# add at the bottom
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_2
export PATH=$PATH:$ORACLE_HOME/bin
11 -> . .bash_profile

CONFIGURATION FOR REMOTE CONNECTION TO ORACLE DATABASE -:


1. Login X terminal with Oracle user and input command "netca", then following screen is shown.
Go next.

2. Go next.

3. Go next. If you'd like to change settings, change and go next.


4. Go next. If you'd like to change settings, change and go next.

5. Go next. If you'd like to change settings, change and go next.

6. Go next. If you'd like to add more listener, do it and go next.


7. Go next.

8. Click "Finish".
Create Database IN ORACLE 11g (graphical)-:
1. Login X terminal with Oracle user and input command "dbca", then following screen is
shown. Go next.

2. Select "Create Database" and go next.


3. Select "Custom Database" and go next.

4. Input global database name and SID. ex: (any name you like).(domain name)
5. Go next.

6. Set password.

7. Go next.
8. Go next.

9. Go next.

10. Go next.
11. Go next.

12. Go next.
13. Go next.

14. Go next.

15. Go next.
16. Click "OK".

17. Creating database starts.

18. After creating DB, Click "Exit".


19. Access to the URL that is written in the section [18]. Then, following screen is shown and input
user name and password set in the section [6].

20. Logined.
CREATING STARTUP SCRIPT IN DATABASE ORACLE 11g.
1. Change settings like below.
1. vi /etc/oratab
testdb:/usr/oracle/app/product/11.1.0/db_1:Y # change
testdb2:/usr/oracle/app/product/11.1.0/db_1:N
2. Set ORACLE_SID
1. vi .bash_profile
# add at the bottom
export ORACLE_SID=testdb
1. Create start-script.
1. vi /etc/rc.d/init.d/dbora

#! /bin/bash#
# oracle: Starting Oracle database 11g
# chkconfig: 345 95 94
# description: Oracle Database Server
# processname: ora_

. /etc/rc.d/init.d/functions
lockfile=/var/lock/subsys/dbora
ORACLE_HOME=/usr/oracle/app/product/11.1.0/db_1
ORACLE=oracle
case "$1" in
'start')
if [ -f $lockfile ]; then
echo $0 already started.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $lockfile
;;
'stop')
if [ ! -f $lockfile ]; then
echo $0 already stopped.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $lockfile
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $lockfile ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0

 chmod 755 /etc/rc.d/init.d/dbora


 /etc/rc.d/init.d/dbora start
 chkconfig --add dbora
 chkconfig dbora on

You might also like