วันจันทร์ที่ 20 พฤษภาคม พ.ศ. 2556

ติดตั้งฐานข้อมูลออราเคิล (Oracle) 11gR2 บน OEL6

วันนี้เรามาลองติดตั้งฐานข้อมูลออราเคิล 11gR2 บนออราเคิล Linux 6.4 กัน ก่อนอื่นเราสามารถอ่านเพิ่มเติมจาก Oracle Documents ในส่วนของการเตรียมระบบปฏิบัติการ และอื่นๆ ก่อนทำการติดตั้ง
http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm

จากนั้นเราสามารถดาวน์โหลดซอฟแวร์ออราเคิล 11.2.0.1 ได้ที่ http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
[surachart@oralearning ~]$ cat /etc/oracle-release
Oracle Linux Server release 6.4
[surachart@oralearning ~]$
 หมายเหตุ บน Oracle Linux 6 เราจะพบ oracle-rdbms-server-11gR2-preinstall package ที่ใช้ในการช่วยสำหรับทำหน้าที่ในส่วนของ Pre-Install RPM package สำหรับฐานข้อมูลออราเคิล 11gR2

ดังนั้นสิ่งแรกที่ควรต้องติดตั้ง หลังจากเราเตรียมพร้อมระบบปฏิบัติการเสร็จแล้วคือ  oracle-rdbms-server-11gR2-preinstall package :)
[root@oralearning ~]# yum list oracle-rdbms-server-11gR2-preinstall
Loaded plugins: security
Available Packages
oracle-rdbms-server-11gR2-preinstall.x86_64                                         1.0-7.el6                                         ol6_latest
[root@oralearning ~]# yum install oracle-rdbms-server-11gR2-preinstall
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-7.el6 will be installed
--> Processing Dependency: xorg-x11-utils for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: gcc for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: glibc-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: xorg-x11-xauth for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: libaio-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: ksh for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Processing Dependency: compat-libcap1 for package: oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-1 will be installed
---> Package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 will be installed
---> Package gcc.x86_64 0:4.4.7-3.el6 will be installed
--> Processing Dependency: cpp = 4.4.7-3.el6 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-3.el6.x86_64
---> Package gcc-c++.x86_64 0:4.4.7-3.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-3.el6.x86_64
---> Package glibc-devel.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.107.el6 for package: glibc-devel-2.12-1.107.el6.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.107.el6.x86_64
---> Package ksh.x86_64 0:20100621-19.el6_4.3 will be installed
---> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed
---> Package libstdc++-devel.x86_64 0:4.4.7-3.el6 will be installed
---> Package xorg-x11-utils.x86_64 0:7.5-6.el6 will be installed
--> Processing Dependency: libXxf86misc.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
--> Processing Dependency: libdmx.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
--> Processing Dependency: libXxf86dga.so.1()(64bit) for package: xorg-x11-utils-7.5-6.el6.x86_64
---> Package xorg-x11-xauth.x86_64 1:1.0.2-7.1.el6 will be installed
--> Processing Dependency: libXmuu.so.1()(64bit) for package: 1:xorg-x11-xauth-1.0.2-7.1.el6.x86_64
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-3.el6 will be installed
---> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
---> Package libXmu.x86_64 0:1.1.1-2.el6 will be installed
---> Package libXxf86dga.x86_64 0:1.1.3-2.el6 will be installed
---> Package libXxf86misc.x86_64 0:1.0.3-4.el6 will be installed
---> Package libdmx.x86_64 0:1.1.2-2.el6 will be installed
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
--> Running transaction check
---> Package kernel-uek-headers.x86_64 0:2.6.32-400.26.2.el6uek will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================
 Package                                            Arch                 Version                                 Repository                Size
================================================================================================================================================
Installing:
 oracle-rdbms-server-11gR2-preinstall               x86_64               1.0-7.el6                               ol6_latest                15 k
Installing for dependencies:
 cloog-ppl                                          x86_64               0.15.7-1.2.el6                          ol6_latest                93 k
 compat-libcap1                                     x86_64               1.10-1                                  ol6_latest                17 k
 compat-libstdc++-33                                x86_64               3.2.3-69.el6                            ol6_latest               183 k
 cpp                                                x86_64               4.4.7-3.el6                             ol6_latest               3.7 M
 gcc                                                x86_64               4.4.7-3.el6                             ol6_latest                10 M
 gcc-c++                                            x86_64               4.4.7-3.el6                             ol6_latest               4.7 M
 glibc-devel                                        x86_64               2.12-1.107.el6                          ol6_latest               973 k
 glibc-headers                                      x86_64               2.12-1.107.el6                          ol6_latest               604 k
 kernel-uek-headers                                 x86_64               2.6.32-400.26.2.el6uek                  ol6_latest               729 k
 ksh                                                x86_64               20100621-19.el6_4.3                     ol6_latest               686 k
 libXmu                                             x86_64               1.1.1-2.el6                             ol6_latest                65 k
 libXxf86dga                                        x86_64               1.1.3-2.el6                             ol6_latest                24 k
 libXxf86misc                                       x86_64               1.0.3-4.el6                             ol6_latest                17 k
 libaio-devel                                       x86_64               0.3.107-10.el6                          ol6_latest                13 k
 libdmx                                             x86_64               1.1.2-2.el6                             ol6_latest                20 k
 libstdc++-devel                                    x86_64               4.4.7-3.el6                             ol6_latest               1.6 M
 mpfr                                               x86_64               2.4.1-6.el6                             ol6_latest               156 k
 ppl                                                x86_64               0.10.2-11.el6                           ol6_latest               1.3 M
 xorg-x11-utils                                     x86_64               7.5-6.el6                               ol6_latest                94 k
 xorg-x11-xauth                                     x86_64               1:1.0.2-7.1.el6                         ol6_latest                34 k

Transaction Summary
================================================================================================================================================
Install      21 Package(s)

Total download size: 25 M
Installed size: 61 M
Is this ok [y/N]: y
Downloading Packages:
(1/21): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm                                                                              |  93 kB     00:02
(2/21): compat-libcap1-1.10-1.x86_64.rpm                                                                                 |  17 kB     00:00
(3/21): compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm                                                                      | 183 kB     00:01
(4/21): cpp-4.4.7-3.el6.x86_64.rpm                                                                                       | 3.7 MB     00:30
(5/21): gcc-4.4.7-3.el6.x86_64.rpm                                                                                       |  10 MB     01:18
(6/21): gcc-c++-4.4.7-3.el6.x86_64.rpm                                                                                   | 4.7 MB     00:35
(7/21): glibc-devel-2.12-1.107.el6.x86_64.rpm                                                                            | 973 kB     00:10
(8/21): glibc-headers-2.12-1.107.el6.x86_64.rpm                                                                          | 604 kB     00:10
(9/21): kernel-uek-headers-2.6.32-400.26.2.el6uek.x86_64.rpm                                                             | 729 kB     00:00
(10/21): ksh-20100621-19.el6_4.3.x86_64.rpm                                                                              | 686 kB     00:03
(11/21): libXmu-1.1.1-2.el6.x86_64.rpm                                                                                   |  65 kB     00:00
(12/21): libXxf86dga-1.1.3-2.el6.x86_64.rpm                                                                              |  24 kB     00:00
(13/21): libXxf86misc-1.0.3-4.el6.x86_64.rpm                                                                             |  17 kB     00:00
(14/21): libaio-devel-0.3.107-10.el6.x86_64.rpm                                                                          |  13 kB     00:00
(15/21): libdmx-1.1.2-2.el6.x86_64.rpm                                                                                   |  20 kB     00:00
(16/21): libstdc++-devel-4.4.7-3.el6.x86_64.rpm                                                                          | 1.6 MB     00:08
(17/21): mpfr-2.4.1-6.el6.x86_64.rpm                                                                                     | 156 kB     00:01
(18/21): oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64.rpm                                                       |  15 kB     00:00
(19/21): ppl-0.10.2-11.el6.x86_64.rpm                                                                                    | 1.3 MB     00:13
(20/21): xorg-x11-utils-7.5-6.el6.x86_64.rpm                                                                             |  94 kB     00:00
(21/21): xorg-x11-xauth-1.0.2-7.1.el6.x86_64.rpm                                                                         |  34 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                           117 kB/s |  25 MB     03:39
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libstdc++-devel-4.4.7-3.el6.x86_64                                                                                          1/21
  Installing : mpfr-2.4.1-6.el6.x86_64                                                                                                     2/21
  Installing : cpp-4.4.7-3.el6.x86_64                                                                                                      3/21
  Installing : kernel-uek-headers-2.6.32-400.26.2.el6uek.x86_64                                                                            4/21
  Installing : glibc-headers-2.12-1.107.el6.x86_64                                                                                         5/21
  Installing : glibc-devel-2.12-1.107.el6.x86_64                                                                                           6/21
  Installing : libXmu-1.1.1-2.el6.x86_64                                                                                                   7/21
  Installing : 1:xorg-x11-xauth-1.0.2-7.1.el6.x86_64                                                                                       8/21
  Installing : libdmx-1.1.2-2.el6.x86_64                                                                                                   9/21
  Installing : libXxf86dga-1.1.3-2.el6.x86_64                                                                                             10/21
  Installing : compat-libstdc++-33-3.2.3-69.el6.x86_64                                                                                    11/21
  Installing : libXxf86misc-1.0.3-4.el6.x86_64                                                                                            12/21
  Installing : xorg-x11-utils-7.5-6.el6.x86_64                                                                                            13/21
  Installing : libaio-devel-0.3.107-10.el6.x86_64                                                                                         14/21
  Installing : ppl-0.10.2-11.el6.x86_64                                                                                                   15/21
  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                                                                                            16/21
  Installing : gcc-4.4.7-3.el6.x86_64                                                                                                     17/21
  Installing : gcc-c++-4.4.7-3.el6.x86_64                                                                                                 18/21
  Installing : ksh-20100621-19.el6_4.3.x86_64                                                                                             19/21
  Installing : compat-libcap1-1.10-1.x86_64                                                                                               20/21
  Installing : oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64                                                                      21/21
  Verifying  : compat-libcap1-1.10-1.x86_64                                                                                                1/21
  Verifying  : xorg-x11-utils-7.5-6.el6.x86_64                                                                                             2/21
  Verifying  : ksh-20100621-19.el6_4.3.x86_64                                                                                              3/21
  Verifying  : gcc-c++-4.4.7-3.el6.x86_64                                                                                                  4/21
  Verifying  : ppl-0.10.2-11.el6.x86_64                                                                                                    5/21
  Verifying  : gcc-4.4.7-3.el6.x86_64                                                                                                      6/21
  Verifying  : libaio-devel-0.3.107-10.el6.x86_64                                                                                          7/21
  Verifying  : libXxf86misc-1.0.3-4.el6.x86_64                                                                                             8/21
  Verifying  : mpfr-2.4.1-6.el6.x86_64                                                                                                     9/21
  Verifying  : oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64                                                                      10/21
  Verifying  : glibc-devel-2.12-1.107.el6.x86_64                                                                                          11/21
  Verifying  : compat-libstdc++-33-3.2.3-69.el6.x86_64                                                                                    12/21
  Verifying  : libXxf86dga-1.1.3-2.el6.x86_64                                                                                             13/21
  Verifying  : 1:xorg-x11-xauth-1.0.2-7.1.el6.x86_64                                                                                      14/21
  Verifying  : libstdc++-devel-4.4.7-3.el6.x86_64                                                                                         15/21
  Verifying  : cpp-4.4.7-3.el6.x86_64                                                                                                     16/21
  Verifying  : libdmx-1.1.2-2.el6.x86_64                                                                                                  17/21
  Verifying  : libXmu-1.1.1-2.el6.x86_64                                                                                                  18/21
  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                                                                                            19/21
  Verifying  : glibc-headers-2.12-1.107.el6.x86_64                                                                                        20/21
  Verifying  : kernel-uek-headers-2.6.32-400.26.2.el6uek.x86_64                                                                           21/21

Installed:
  oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-7.el6

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6         compat-libcap1.x86_64 0:1.10-1             compat-libstdc++-33.x86_64 0:3.2.3-69.el6
  cpp.x86_64 0:4.4.7-3.el6                  gcc.x86_64 0:4.4.7-3.el6                   gcc-c++.x86_64 0:4.4.7-3.el6
  glibc-devel.x86_64 0:2.12-1.107.el6       glibc-headers.x86_64 0:2.12-1.107.el6      kernel-uek-headers.x86_64 0:2.6.32-400.26.2.el6uek
  ksh.x86_64 0:20100621-19.el6_4.3          libXmu.x86_64 0:1.1.1-2.el6                libXxf86dga.x86_64 0:1.1.3-2.el6
  libXxf86misc.x86_64 0:1.0.3-4.el6         libaio-devel.x86_64 0:0.3.107-10.el6       libdmx.x86_64 0:1.1.2-2.el6
  libstdc++-devel.x86_64 0:4.4.7-3.el6      mpfr.x86_64 0:2.4.1-6.el6                  ppl.x86_64 0:0.10.2-11.el6
  xorg-x11-utils.x86_64 0:7.5-6.el6         xorg-x11-xauth.x86_64 1:1.0.2-7.1.el6

Complete!
[root@oralearning ~]#
[root@oralearning ~]# yum list oracle-rdbms-server-11gR2-preinstall
Loaded plugins: security
Installed Packages
oracle-rdbms-server-11gR2-preinstall.x86_64                                        1.0-7.el6                                         @ol6_latest
[root@oralearning ~]#
จากการติดตั้ง oracle-rdbms-server-11gR2-preinstall package เราควรพบ "oracle" user บนระบบปฏิบัติการ
[root@oralearning ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)

จากนั้นขอสร้างโฟลเดอร์ ที่ต้องการติดตั้งสักซอฟเวอร์สักหน่อย... ตามด้วย Profile และเช็ค hosts ไฟล์
[root@oralearning ~]# mkdir -p /u01/app
[root@oralearning ~]# chown -R oracle:oinstall /u01/app
[root@oralearning ~]# cat /etc/profile.d/oracle.sh
if [ $USER = "oracle" ]; then
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
fi
[root@oralearning ~]# chmod 755 /etc/profile.d/oracle.sh
[root@oralearning ~]#

[root@oralearning ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.111.200 oralearning

ตามด้วยตรวจสอบซอฟแวร์พร้อม uncompress ออราเคิลซอฟแวร์
[oracle@oralearning SRC]$ pwd
/u01/SRC
[oracle@oralearning SRC]$ ls
database  linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip
[oracle@oralearning SRC]$ cd database/
[oracle@oralearning database]$ unzip ../linux.x64_11gR2_database_1of2.zip
[oracle@oralearning database]$ unzip ../linux.x64_11gR2_database_2of2.zip

เมื่อทุกอย่างพร้อม และต้องการติดตั้ง ก็ Connect เข้าไปยังเซิร์ฟเวอร์แบบใช้ GUI... เราอาจใช้ VNC เข้ามาช่วย หรือติดตั้งแบบ silence mode (ตัวอย่าง)


ในตัวอย่างตรงนี้ ผมจะใช้ GUI เพื่อให้ง่าย... หลังจาก Connect VNC และ ทดสอบ xclock  ...จากนั้นเริ่มติดตั้ง
[oracle@oralearning database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 26674 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-05-17_06-31-14PM. Please wait ...[oracle@oralearning database]$ You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2013-05-17_06-31-14PM.log


กรณีนี้เราเลือกติดตั้งซอฟเวอร์เท่านั้น

หลังจากนั้นเราจะพบประเภทของฐานข้อมูลที่ต้องการติดตั้ง ในกรณีนี้เรามีแค่เครื่องเดียว และไม่มีแชร์ดิสต์ จึงลือก "Single instance database installation"


จากรูปข้างล่าง นั้นคือขั้นตอนที่เลือก database edition. (ขอเลือก Enterprise Edition เพราะเราจะสามารถทดสอบได้ทุกๆ ฟีเจอร์) ตรวจสอบเพิ่มเติม

ในส่วนนี้เซต ORACLE_BASE และ ORACLE_HOME paths



ณ. จุดนี้จะพบว่าการเช็ค packages นั้น Failed สิ่งแรกที่ควรทำ คือการเช็คบนระบบปฏิบัติการ (แต่กรณีนี้ ผมใช้ OL6.4 อาจเป็นไปได้ที่ packages ที่ติดตั้งใหม่กว่า ดังนั้น "Ignore All" สำหรับกรณีนี้)



จากรูปข้างบน เราต้อง login เป็น "root" แล้วรัน scripts จากรูป
[root@oralearning ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oralearning ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@oralearning ~]#
เมื่อเรียบร้อย จากนั้นเลือก "OK"

ตอนนี้ติดตั้งเรียบร้อย แล้วครับ
อย่างไรก็ตาม เราสามารถเช็คปัญหาในการติดตั้งที่ได้ที่ /u01/app/oraInventory/logs/installActions2013-05-17_06-31-14PM.log ไฟล์

ไม่มีความคิดเห็น: