[펌] 리눅스에서 오라클 rpm 설치 – PHP 연동 추가

출처 http://newgifted.tistory.com/entry/Oracle-10g-Express-%EC%84%A4%EC%B9%98%EB%A6%AC%EB%88%85%EC%8A%A4

오라클을 깔기전에 최소사양을 만족 하는지 확인합니다.

최소 사양은 아래와 같습니다.


Oracle 10g Express최소사양

RAM   256MB(권장 512MB)

Disk space  1.5GByte

Packages   glibc – 2.3.2
  libaio – 0.3.96

Swap Space 0~256MB (RAM의 3배 이상)
  256~512MB (RAM의 2배 이상)
  512MB 이상 (1024GB 이상)

위 사양을 만족 하지 않으면 설치 자체가 불가능 합니다.

만약 설치중 glibc나 libaio패키지 설치를 요구하면 아래와 같이 설치하시면 됩니다.


yum install glibc
yum install libaio



또는 직접 다운 받으신후 rpm -Uvh ~~~.rpm을 통해 설치 하셔도됩니다.

우선 오라클 홈페이지에서 Oracle 10g Express 를 받은 후

root계정으로 아래 명령어를 입력하시면 설치가 진행됩니다.


[root@localhost 신영재]# rpm -Uvh oracle-xe-univ-10.2.0.1-1.0.i386.rpm
준비 중…               ########################################### [100%]
   1:oracle-xe-univ         ########################################### [100%]
Executing Post-install steps…
You must run ‘/etc/init.d/oracle-xe configure’ as the root user to
configure the database.


설치가 완료된후 데이타 베이스 설정을 해야 됩니다.

아래와 같이 입력하시면 설정을 할 수 있습니다. 설정이 완료된후 언제라도 다시 설정을 바꾸고 싶다면 똑같이 입력 하시면 됩니다.



[root@localhost 신영재]# /etc/init.d/oracle-xe configure


Oracle Database 10g Express Edition Configuration
————————————————-
This will configure on-boot properties of Oracle Database 10g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press <Enter> to accept the defaults.
Ctrl-C will abort.


Specify the HTTP port that will be used for Oracle Application Express [8080]:HTTP를 통해 편리하게 데이터 베이스를 관리하기 위해 사용할 http포트를 지정합니다. 톰캣 서버와 포트가 같으므로 톰캣 서버를 사용하신다면 다른 포트를 이용하기 위해 다른 포트 번호를 입력 하십시요.


Specify a port that will be used for the database listener [1521]: 다른 서버에어서 DB서버에 접근하기 위한 포트입니다.


Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration: 암호를 입력 합니다. 이 암호로 SYS, SYSTEM유저로 로그인 가능합니다.
Confirm the password:


Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]: 부팅후 자동으로 오라클 DB를 실행할지 여부입니다.
이제 잠시기다리시면.. 설정이 완료됩니다.
Starting Oracle Net Listener…Done
Configuring Database…Done
Starting Oracle Database 10g Express Edition Instance…Done
Installation Completed Successfully.
To access the Database Home Page go to “http://127.0.0.1:8080/apex
[root@localhost 신영재]#




다음으로 오라클 환경변서 설정이 필요합니다. 다음 디렉토리로 이동합니다.


[root@localhost 10.2.0]# cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin


oracle_env.sh또는 oracle_env.csh스크립트를 실행합니다. 부팅시 계속 해서 자동으로 실행하고 자 하신다면, .bash_profile 또는 .bash_rc에 명령을 넣어 주시면 됩니다.


[root@localhost bin]# . ./oracle_env.sh




이제 설치가 완료되었습니다. 아래와 같이 입력하면 DB에 접근 가능합니다. 또는 웹브라우져에서 http://127.0.0.1:8080/apex로 접근하면 아래와 같은 GUI환경을 볼 수 있습니다.




[root@localhost ~]# sqlplus


SQL*Plus: Release 10.2.0.1.0 – Production on 목 1월 25 12:51:05 2007


Copyright (c) 1982, 2005, Oracle.  All rights reserved.


사용자명 입력:










웅파 추가 (2009. 2. 10)~~~

위 부분은 리눅스에서 rpm으로 오라클 셋팅, 설치하는 부분입니다.
아래는 php와 연동부분입니다.
예전보다 연동은 무척 간단해졌습니다.

팁 하나

==================================================================
Oracle Database 10g Express Edition Release 10.2.0.1.0 – Production
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); <= 이거 명령어다.

PL/SQL 처리가 정상적으로 완료되었습니다.

SQL>
===================================================================

–> 외부에서 아이피:8080/apex 로 접속이 가능해집니다. 설정후엔 FALSE 대신 TRUE로 바꿔주면 됩니다.

난 centos5.2에 설치했는데 php-devel이 설치 안되어있어서 phpize를 사용할 수 없었다.
그래서 yum install php-devel 후
yum install php-pear 까지 설치한후에
pecl install oci8
그리고 php.ini에 extention=oci8.so 만 추가해주고 아파치 재시작 하면 연동 끝
phpinfo(); 함수로 확인해 보니 oci8 이라고 항목이 추가됐다.

User image

mysql과 oracle 둘다 이상없이 작동.