2014년 5월 8일 목요일

[Linux] How to install Oralce 11g R2 Database server on Centos 6.5

** 설치전 작업
[root@~] # yum -y groupinstall "X Window System"

1. Oracle을 설치하고 운영할 사용자 계정을 만든다.
Before installation, Oracle user account that you want to install and make operational.

[root@~] # groupadd oinstall
[root@~] # groupadd dba
[root@~] # useradd -m -g oinstall -G dba oracle
[root@~] # passwd oracle


2. Install Packages Check's
http://docs.oracle.com/cd/E11882_01/install.112/e24323/toc.htm#CEGHFFGG

binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
sysstat-7.0.2

## Install/Update & Check
[root@~] #yum -y install compat-libstdc++-33.x86_64 binutils elfutils-libelf elfutils-libelf-devel
[root@~] #yum -y install glibc glibc-common glibc-devel glibc-headers gcc gcc-c++ libaio-devel
[root@~] #yum -y install libaio libgcc libstdc++ libstdc++ make sysstat unixODBC unixODBC-devel
[root@~] #yum -y install unzip



3. Environment Configuration

[root@~] # su - root
[root@~] # cd /etc/yum.repos.d
[root@~] # wget --no-check-certificate https://public-yum.oracle.com/public-yum-ol6.repo
[root@~] # wget --no-check-certificate https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

[root@~] # yum install oracle-rdbms-server-11gR2-preinstall

[root@~] # mkdir -p /home/oracle//app/oracle/product/11.2.0/dbhome_1
[root@~] # chown -R oracle.oinstall /home/oracle/app
[root@~] # chmod -R 775 /home/oracle/app

##SELINUX 설정 해제
[root@~] # vi /etc/selinux/config
SELINUX=disabled

##Hostname 변경
[root@~] # vi /etc/sysconfig/network
HOSTNAME=oracle

[root@~] # vi /etc/hosts
127.0.0.1   oracle


## Oracle 계정으로 변경
[root@~] # su - oracle

[oracle@~] # vi .bash_profile

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=ora.saf.com;
export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB11G;
export ORACLE_UNQNAME
ORACLE_BASE=/home/oracle/app;
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;
export ORACLE_HOME
ORACLE_SID=ORCL;
export ORACLE_SID

PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH;
export PATH

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


[oracle@~] # source .bash_profile


3. Oracle Download and install

* Oracle Database Download URL - Down(must Login)

[oracle@~] # uzip *****.zip
[oracle@~] # ./runInstaller 


-- 설치 모드 화면에서 한글이 깨지는 경우는 아래와 같이 설정 한다. Font Error case 
[oracle@~] # export LANG=C


.... 중간 설치 화면은 생략 한다.


Configuration scripts need to be executed as the “root” user.
Go to the path given in the screen and execute the scripts one by one. Click on ‘OK‘ once scripts is executed.

[oracle@~] # su - root
[root@~] # cd /home/oracle/app/oraInventory
[root@ oraInventory ] # ./orainstRoot.sh

[root@~] # cd /home/oracle/app/product/11.2.0/dbhome_1
[root@ oraInventory ] # ./root.sh




설치가 완료된 오라클을 서비스로 등로하여 자동화 처리 하기 하기 위해 하단의 내용을 추가 진행 한다.

[oracle@~] vi /etc/oratab

 DB11G:/home/oracle/app/product/11.2.0/dbhome_1:Y


[oracle@~] # vi /home/oracle/scripts/ora_start.sh

#!/bin/bash

# script to start the Oracle database, listener and dbconsole

. ~/.bash_profile

# start the listener and the database
$ORACLE_HOME/bin/dbstart $ORACLE_HOME

# start the Enterprise Manager db console
$ORACLE_HOME/bin/emctl start dbconsole

exit 0



[oracle@~] # vi /home/oracle/scripts/ora_stop.sh

#!/bin/bash

# script to stop the Oracle database, listener and dbconsole

. ~/.bash_profile

# stop the Enterprise Manager db console
$ORACLE_HOME/bin/emctl stop dbconsole

# stop the listener and the database
$ORACLE_HOME/bin/dbshut $ORACLE_HOME

exit 0


스크립트에 실행할 수 있는 권한을 줍니다.
[oracle@~] #  chmod u+x ora_start.sh ora_stop.sh

[oracle@~] # su  -root
[root@~] # vi /etc/init.d/oracle

#!/bin/bash
ORA_OWNER=oracle
RETVAL=0

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "/home/oracle/scripts/ora_start.sh"
        touch /var/lock/subsys/oracle
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "/home/oracle/scripts/ora_stop.sh"
        rm -f /var/lock/subsys/oracle
        ;;
    *)
        echo $"Usage: $0 {start|stop}"
        RETVAL=1
esac
exit $RETVAL


생성한 스크립트의 권한을 변경하고 서비스에 등록한다.

[root@~] # chmod 750 /etc/init.d/oracle
[root@~] # chkconfig --add oracle



댓글 없음:

댓글 쓰기

언제 부터 였던가 생각해보니 아르바이트 겸 외부 컨설팅을 의뢰 받고 맥북 프로를 처음 써봤을 때 부터 였던 것 같다. 지금은 거의 대부분의 작업을 맥으로 작업을 하다 보니 윈도우에서만 실행되는 일부 프로그램들 때문과 회사 내부 ERP프로그램이 윈도우 ...