http://openness.tistory.com/119
1) 각종 환경변수 값 설정
< /etc/redhat-release >
[root@mycent ]# cp /etc/redhat-release /etc/redhat-release.backup
[root@mycent ]# vi /etc/redhat-release
"CentOS release 6.2 (Final)" -> "redhat-4"로 변경
< /etc/hosts >
[root@mycent ]# vi /etc/hosts
"172.20.22.100 mycent" 추가
< /etc/sysctl.conf >
[root@mycent ]# cp /etc/sysctl.conf /etc/sysctl.conf.backup
[root@mycent ]# vi /etc/sysctl.conf
있는 항목은 값 수정
kernel.shmall = 2097152
kernel.shmmax = 536870912
없는 항목은 값 추가
kernel.shmmni = 4096
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mycent ]# /sbin/sysctl -p
추가한 내용에 문제가 없는지 확인
< /etc/security/limits.conf >
[root@mycent ]# cp /etc/security/limits.conf /etc/security/limits.conf.backup
[root@mycent ]# vi /etc/security/limits.conf
아래내용 추가
#@student - maxlogins 4
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# End of file
< /etc/selinux/config >
[root@mycent ]# cp /etc/selinux/config /etc/selinux/config.backup
[root@mycent ]# vi /etc/selinux/config
"SELINUX=enforcing" -> "SELINUX=disabled"로 변경
< /etc/pam.d/login >
[root@mycent ]# cp /etc/pam.d/login /etc/pam.d/login.backup
[root@mycent ]# vi /etc/pam.d/login
아래내용 추가
session required pam_limits.so
2) 필수 패키지 설치
[root@mycent ]# 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*
3) 오라클 계정 및 그룹 생성
[root@mycent ]# groupadd oinstall
[root@mycent ]# groupadd dba
[root@mycent ]# groupadd oper
[root@mycent ]# groupadd asmadmin
[root@mycent ]# useradd -g oinstall -G dba,oper,asmadmin oracle
[root@mycent ]# passwd oracle
[root@mycent ]# mkdir -p /opt/oracle/product/10.2.0/db_1 (설치대상경로)
[root@mycent ]# chown -R oracle:oinstall /opt/oracle
[root@mycent ]# chmod -R 775 /opt/oracle
4) 오라클 계정 환경변수 설정
[root@mycent ]# su - oracle
[oracle@mycent ]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PATH=$PATH:$HOME/bin
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME
ORACLE_BASE=/opt/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
TSHLIB_PATH=$ORACLE_HOME/lib:/usr/lib:/lib:/usr/local/lib; export TSHLIB_PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib:/usr/local/lib; export LD_LIBRARY_PATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
5) 오라클 설치 프로그램 구동
oralce 계정으로 X-window 로긴
터미널 열고 export LANG=c 수행 (안그러면 설치 프로그램 글자가 다 깨짐)
오라클 설치 프로그램 경로에서 ./runInstaller 실행
설치하는 중간에 두개 정도의 쉘 스크립트를 수동으로 실행해줬던것 같음 (화면에 안내나옴)
X-window 상에서의 설치과정 완료
6) 오라클 자동 시작/종료 설정
oracle 계정으로 수정
vi /etc/oratab
orcl:/opt/oracle/product/10.2.0/db_1:Y
7) 일반 사용자 계정 환경설정
[userid@mycent ]$ vi .bash_profile
# ORACLE 10g Env
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export TORA_NLS10=$ORACLE_HOME/nls/data
export TNLS_LANG=American_america.KO16KSC5601
export TSHLIB_PATH=$ORACLE_HOME/lib:/usr/lib:/lib:/usr/local/lib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib:/usr/local/lib
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
8) 오라클 기동
oracle 계정을 이용하여 실행
< 오라클 리스너 구동 >
[oracle@mycent ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 27-JAN-2012 12:27:46
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /opt/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mycent)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 27-JAN-2012 12:27:48
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mycent)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
< 오라클 DBMS 구동 및 종료 >
[root@mycent ]# sqlplus /nolog
SQL> connect orcl as sysdba
SQL> startup ( 오라클 구동 )
SQL> shutdown immediate ( 오라클 종료 )
* 일반계정에서 sqlplus 실행 안되는 현상 발생시 권한 설정
< 에러 메시지 >
[userid@mycent ]$ sqlplus /nolog
sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
< 해결책 >
root 권한을 이용하여 수행
[root@mycent ]# chmod -R a+rX /opt/oracle/product/10.2.0/db_1
9) 클라이언트의 tnsnames.ora 내용 추가
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 오라클 서버 IP주소)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
10) 오라클 서버 접속 후 기본동작 확인
< scott 계정으로 접속 후 샘플 테이블 확인 >
select * from all_tab_columns
where owner not in ('XDB')
and owner not like '%SYS%'
;
=> BONUS, DEPT, EMP, SALGRADE 테이블이 보이는지 확인
< 한글 입출력 테스트 >
create table test_table (
num number
, id varchar2(20)
, name varchar2(50)
, address varchar2(100)
);
insert into test_table values(1, 'userid1', '홍길동', '서울');
insert into test_table values(2, 'userid2', '심형래', '부산');
insert into test_table values(3, 'userid3', '콩쥐', '대전');
insert into test_table values(4, 'userid4', '흥부', '광주');
commit;
select * from test_table;
* 한글이 깨져서 보일 경우 캐릭터 셋 변경
[oracle@mycent ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 27 15:09:21 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn orcl as sysdba
Enter password:
Connected.
SQL> select userenv('LANGUAGE') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.WE8ISO8859P1
SQL> update props$ set value$='KO16KSC5601' where name='NLS_CHARACTERSET';
1 row updated.
SQL> commit;
Commit complete.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 360710144 bytes
Fixed Size 1219424 bytes
Variable Size 113247392 bytes
Database Buffers 243269632 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> select userenv('LANGUAGE') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.KO16KSC5601
캐릭터 셋이 변경된 것을 확인한 후 다시 한번 < 한글 입출력 테스트 >를 수행해 본다