OS/Linux 2015. 12. 8. 19:14

CentOS... 센토스? 센트오에스? 센토에스? Cent오에스 ? 센트OS ? 쎈토스? 쎈트오에스? 쎈트OS ? 쎈토에스 ?




///// 설치 전 설정

1. 환경 설정

# vi /etc/sysctl.conf

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


# /sbin/sysctl -p


# vi /etc/security/limits.conf

oracle   soft   nproc    131072

oracle   hard  nproc    131072

oracle   soft   nofile    131072

oracle   hard  nofile    131072

oracle   soft   core     unlimited


# vi /etc/hosts/
<IP-address> <fully-qualified-machine-name> <machine-name>

# vi /etc/pam.d/login

session    required    pam_limits.so


# vi /etc/selinux/config

SELINUX=disabled


2. 계정 생성

# groupadd oinstall

# groupadd dba

# groupadd oper

# useradd -g oinstall -G dba,oper oracle

# passwd oracle


3. 설치 폴더 생성

# mkdir /oracle

# mkdir /oracle/

# mkdir /oracle/product/

# mkdir /oracle/product/11.2

# mkdir /oraInventory

# chown -R oracle.oinstall /oracle

# chown -R oracle.oinstall /oraInventory

# chmod -R 775 /oracle

# chmod -R 775 /oraInventory


4. 한 번 재부팅

# reboot

# systemctl mask tmp.mount


5. 계정 접속

# su - oracle

$ cd ~


6. 환경 변수 설정

$ vi .bash_profile

export ORACLE_BASE=/home/data/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2

export ORACLE_SID=orcl

export ORACLE_TERM=xterm

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export LANG=C


$ source .bash_profile




///// 설치하기

1. 필요 패키지 설치 확인 (복붙하자)

$ rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \

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


2. 필요 패키지 설치 (복붙하자)

1) 설치하기

$ sudo yum install binutils-2* compat-libstdc++-33* elfutils-libelf* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* ksh* libaio-0.* libaio-devel-0.* libgomp-4.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.* pdksh*


2) 다시 설치 확인

위 1. 필요 패키지 설치 확인을 참조


3) 설치되지 않은 것은 다음과 같이 수동으로 모두 설치한다.

$ sudo yum install 패키지명


모두 설치 될 때까지 2)와 3)을 반복한다.


3. Oracle 깔기

- responseFile 설정

$ vi ~/database/response/db_install.rsp

oracle.install.option=INSTALL_DB_AND_CONFIG

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/home/oracle/oraInventory

SELECTED_LANGUAGES=en,ko

ORACLE_HOME=/home/data/oracle/product/11.2

ORACLE_BASE=/home/data/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.isCustomInstall=false
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.password.ALL=Oracle123
oracle.install.db.config.starterdb.password.SYS=Oracle123
oracle.install.db.config.starterdb.password.SYSTEM=Oracle123
oracle.install.db.config.starterdb.password.SYSMAN=Oracle123
oracle.install.db.config.starterdb.password.DBSNMP=Oracle123
oracle.install.db.config.starterdb.control=DB_CONTROL

oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/data/oracle/oradata

DECLINE_SECURITY_UPDATES=true



- 조용히 설치

$ ~/database/runInstaller -silent -responseFile ~/database/response/db_install.rsp


- 억지로 깔기

$ ~/database/runInstaller -silent -ignorePrereq -responseFile ~/database/response/db_install.rsp


- 명령행에서 바로 설치(response파일 없이 설치)

$ ~/database/runInstaller -silent -debug -force \

FROM_LOCATION=/home/data/oracle/stage/database/stage/products.xml \

oracle.install.option=INSTALL_DB_SWONLY \

UNIX_GROUP_NAME=oinstall \

INVENTORY_LOCATION=/home/oracle/oraInventory \

ORACLE_HOME=/home/data/oracle/product/11.2 \

ORACLE_BASE=/home/data/oracle \

oracle.install.db.InstallEdition=EE \

oracle.install.db.isCustomInstall=false \

oracle.install.db.DBA_GROUP=dba \

oracle.install.db.OPER_GROUP=oper \

DECLINE_SECURITY_UPDATES=true


< 설치했다고 끝난 게 아니다. >

$ /home/oracle/oraInventory/orainstRoot.sh 

$ /home/data/oracle/product/11.2/root.sh


< ORACLE이 깔렸는지 확인 후, $ORACLE_HOME/bin으로 이동한다.>

경우에 따라서는 DBCA와 NETCA도 설치


4. dbca 설치 (database 구성을 위한)

$ $ORACLE_HOME/bin/dbca -silent -responseFile ~/database/response/dbca.rsp


5. netca 설치 (외부에서 접속을 위한) 

$ $ORACLE_HOME/bin/netca /silent /responsefile ~/database/response/netca.rsp

! 주의 ! 옵션이 대쉬'-'가 아니라 슬러쉬'/'다

(참조 : https://docs.oracle.com/html/B14399_01/app_nonint.htm#BABJFJID)




///// 설치 후 설정

1. 방화벽 열기

# firewall-cmd --permanent --zone=public --add-port=1521/tcp

# firewall-cmd --reload


2. 확인 (경우에 따라 위치가 다를 수 있으므로 찾기 명령을 활용 $ find / -name '파일명' )

$ORACLE_HOME/dbs/init[SID].ora 

$ORACLE_HOME/dbs/spfile[SID].ora

$ORACLE_HOME/dbs/orapw[SID]

$ORACLE_HOME/network/admin/tnsnames.ora

$ORACLE_HOME/network/admin/listener.ora


3. 기동 상태 확인

$ tnsping IP


4. 리스너 가동 

$ lsnrctl

LSNRCTL> start

LSNRCTL> quit


5. DB MOUNT(디비 마운트)

sqlplus / as sysdba

SQL> startup

SQL> quit


6. 계정 설정하기

$ sqlplus / as sysdba

SQL> create user USERNAME identified by PASSWORD default tablespace system;

SQL> grant connect, resource to USERNAME;


///// 접속 하기

Windows 클라이언트 프로그램에서 접속

User : USERNAME

Password : PASSWORD

Host : [SERVER IP입력]

Port : 1521

SID : ORCL



///// 서버 부팅시 오라클 자동시작 설정

1. 설정

$ vi $ORACLE_HOME/bin/dbstart

ORACLE_HOME_LISTENER=$1을 $ORACLE_HOME으로 수정

ORACLE_HOME_LISTENER=$ORACLE_HOME    


$ vi /etc/init.d/oracle 

#!/bin/sh 

# chkconfig: 345 99 10 

# description: Oracle auto start-stop script

# processname : oracle


ORA_HOME="/home/oracle/oracle11/product/11.1.0/db_1"

ORA_OWNER="oracle"


if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]

then

        echo "Oracle Startup: failed"

        exit 1

fi


case "$1" in

start)

        echo -n "Oracle Start: "

        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"

        su - $ORA_OWNER -c $ORA_HOME/bin/dbstart

   su - $ORA_OWNER -c "sqlplus / as sysdba"<<EOF

startup;

quit;

EOF    * EOF를 쓸 때는 탭이나 스페이스로 공간을 두지 않습니다.

        touch /var/lock/subsys/oracle

        echo "OK"

        ;;

stop)

        echo -n "ORACLE Shutdown: "

        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"

        su - $ORA_OWNER -c $ORA_HOME/bin/dbshut

        rm -f /var/lock/subsys/oracle

        echo "OK"

        ;;

restart)

        $0 stop

        $0 start

        ;;

*)

        echo "Usage: $0 start|stop|restart"

        exit 1

esac

exit 0


$ vi /etc/rc.local

최하단에 다음 추가

/etc/init.d/oracle start


$ vi /etc/oratab

ORCL:/oracle/product/11g/:Y    [SID]:$ORACLE_HOME/:Y


# chkconfig --add oracle

# chkconfig --level 234 oracle on 

# chkconfig --list oracle


2. 확인하기

# reboot

# ps -ef | grep LISTENER









///// 에러

- ORA-01078 failure in processing system parameters

http://devmento.co.kr/devmain/contents/opentip/opentip_detail.jsp?cate_code=AAABAA&dataSeq=214


- ORA-00845: MEMORY_TARGET not supported on this system

https://www.krenger.ch/blog/ora-00845-memory_target-not-supported-on-this-system/

http://www.dblancer.com/2013/08/oracle-ora-00845-memorytarget-not.html


- ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated 

ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory

create spfile from pfile='/oracle/product/11g/dbs/init.ora';


-ORA-48108: invalid value given for the diagnostic_dest init.ora parameter

ORA-48140: the specified ADR Base directory does not exist [/oracle/product/11g/dbs/<ORACLE_BASE>]

ORA-48187: specified directory does not exist


-ORA-01507: database not mounted

http://payoff.tistory.com/307


- ORA-00205: error in identifying control file, check alert log for more info.


- ORA-01045: user USER1 lacks CREATE SESSION privilege; logon denied

http://egloos.zum.com/sangu12/v/2784064


- ORA-28000: the account is locked

http://hyunayarn.tistory.com/9


- ORA-01033:ORACLE initialization or shutdown

http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=10205&docId=65857467&qb=b3JhLTAxMDMzOg==&enc=utf8&section=kin&rank=1&search_sort=0&spq=0&pid=SECbblpySE4ssboTD0Csssssst4-178043&sid=oc3q1G0qx0u%2BsIZOzvmo8Q%3D%3D



- ORA-01079: ORACLE database was not properly created, operation aborted

http://dev-notes.com/code.php?q=40


///// 참고

Install Oracle 11G Release 2 (11.2) on Centos Linux 7 : 

http://dbaora.com/install-oracle-11g-release-2-11-2-on-centos-linux-7/

http://blog.naver.com/chae616/220332771956

Oracle 11g R2 64bit : http://nemesisx.blog.me/10077782380

entos 오라클 설치 : http://blog.naver.com/1jinguolong/80209898831

CentOS7 XWindow install : http://blog.naver.com/potar23/220267383492f


///// Oracle 11g install from command line ?

참조 : 

OEL5_11g_silent-mode DB 설치 : http://cafe.naver.com/ocmkorea/book5076090/16120

Oracle database client silent installation without response file : http://www.dadbm.com/oracle-database-client-silent-installation-response-file/


https://www.google.co.kr/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=oracle%2011g%20console%20installation

https://community.oracle.com/thread/835167?start=0&tstart=0

http://www.beyondoracle.com/2011/01/09/silent-oracle-11g-r2-install-command-line/

https://community.oracle.com/thread/995965?start=0&tstart=0

http://docs.oracle.com/cd/B28359_01/em.111/b31207/oui3_response_files.htm#i1005570

http://www.oracle.com/technetwork/java/javase/install-linux-64-self-extracting-142068.html

http://blueray21.tistory.com/21

ORACLE, DBCA, NETCA silent모드 설치(한국어 포스팅):


///// DB 관리

계정 생성 및 권한 부여 : http://blog.naver.com/jazz1234k/40131386688

Oracle 유저생성 및 권한 : http://egloos.zum.com/sangu12/v/2784064

리눅스에 오라클 설치 후 오라클 자동시작 설정하는 방법 : http://klero.tistory.com/99