MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for May, 2016

Oracle 12c Pre-requisites

without comments

Installing any Oracle database is tedious, but the installing the prerequisites can be especially tedious. This post tries to simplify the process by creating a single prereq.sh file for all the prerequisite libraries, except for the oracle-rdbms-server-12cR1-preinstall, which you should run after the prerequisite file.

The prerequisite file should contain the following:

yum install -y binutils \
               compat-libstdc++-33 \
               compat-libstdc++-33.i686 \
               gcc \
               gcc-c++ \
               glibc \
               glibc.i686 \
               glibc-devel \
               glibc-devel.i686 \
               ksh \
               libgcc \
               libgcc.i686 \
               libstdc++ \
               libstdc++.i686 \
               libstdc++-devel \
               libstdc++-devel.i686 \
               libaio \
               libaio.i686 \
               libaio-devel \
               libaio-devel.i686 \
               libXext \
               libXext.i686 \
               libXtst \
               libXtst.i686 \
               libX11 \
               libX11.i686 \
               libXau \
               libXau.i686 \
               libxcb \
               libxcb.i686 \
               libXi \
               libXi.i686 \
               make \
               sysstat \
               unixODBC \
               unixODBC-devel \
               zlib-devel \
               zlib-devel.i686

You can run the prereq.sh script as the root user like you would source an environment file:

. ./prereq.sh

Dependent upon what you installed when creating the Oracle Linux 7.1 operating system, you should see something like this in the output console:

sh-4.2# . ./prereq.sh
Loaded plugins: langpacks
Package compat-libstdc++-33-3.2.3-72.el7.x86_64 already installed and latest version
Package libXtst-1.2.2-2.1.el7.x86_64 already installed and latest version
Package libXau-1.0.8-2.1.el7.x86_64 already installed and latest version
Package 1:make-3.82-21.el7.x86_64 already installed and latest version
Package sysstat-10.1.5-7.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package binutils.x86_64 0:2.23.52.0.1-30.el7_1.2 will be updated
---> Package binutils.x86_64 0:2.23.52.0.1-55.el7 will be an update
---> Package compat-libstdc++-33.i686 0:3.2.3-72.el7 will be installed
---> Package gcc.x86_64 0:4.8.3-9.el7 will be updated
--> Processing Dependency: gcc = 4.8.3-9.el7 for package: gcc-gfortran-4.8.3-9.el7.x86_64
--> Processing Dependency: gcc = 4.8.3-9.el7 for package: libquadmath-devel-4.8.3-9.el7.x86_64
---> Package gcc.x86_64 0:4.8.5-4.el7 will be an update
--> Processing Dependency: cpp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64
--> Processing Dependency: libgomp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.3-9.el7 will be updated
---> Package gcc-c++.x86_64 0:4.8.5-4.el7 will be an update
---> Package glibc.x86_64 0:2.17-78.0.1.el7 will be updated
--> Processing Dependency: glibc = 2.17-78.0.1.el7 for package: glibc-headers-2.17-78.0.1.el7.x86_64
--> Processing Dependency: glibc = 2.17-78.0.1.el7 for package: glibc-common-2.17-78.0.1.el7.x86_64
---> Package glibc.i686 0:2.17-106.0.1.el7_2.6 will be installed
--> Processing Dependency: libfreebl3.so for package: glibc-2.17-106.0.1.el7_2.6.i686
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.17-106.0.1.el7_2.6.i686
---> Package glibc.x86_64 0:2.17-106.0.1.el7_2.6 will be an update
---> Package glibc-devel.x86_64 0:2.17-78.0.1.el7 will be updated
---> Package glibc-devel.i686 0:2.17-106.0.1.el7_2.6 will be installed
---> Package glibc-devel.x86_64 0:2.17-106.0.1.el7_2.6 will be an update
---> Package ksh.x86_64 0:20120801-22.el7_1.3 will be installed
---> Package libX11.x86_64 0:1.6.0-2.1.el7 will be updated
---> Package libX11.i686 0:1.6.3-2.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.3-2.el7 for package: libX11-1.6.3-2.el7.i686
---> Package libX11.x86_64 0:1.6.3-2.el7 will be an update
---> Package libXau.i686 0:1.0.8-2.1.el7 will be installed
---> Package libXext.x86_64 0:1.3.2-2.1.el7 will be updated
---> Package libXext.i686 0:1.3.3-3.el7 will be installed
---> Package libXext.x86_64 0:1.3.3-3.el7 will be an update
---> Package libXi.x86_64 0:1.7.2-2.1.el7 will be updated
---> Package libXi.i686 0:1.7.4-2.el7 will be installed
---> Package libXi.x86_64 0:1.7.4-2.el7 will be an update
---> Package libXtst.i686 0:1.2.2-2.1.el7 will be installed
---> Package libaio.x86_64 0:0.3.109-12.el7 will be updated
---> Package libaio.i686 0:0.3.109-13.el7 will be installed
---> Package libaio.x86_64 0:0.3.109-13.el7 will be an update
---> Package libaio-devel.i686 0:0.3.109-13.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package libgcc.x86_64 0:4.8.3-9.el7 will be updated
---> Package libgcc.i686 0:4.8.5-4.el7 will be installed
---> Package libgcc.x86_64 0:4.8.5-4.el7 will be an update
---> Package libstdc++.x86_64 0:4.8.3-9.el7 will be updated
---> Package libstdc++.i686 0:4.8.5-4.el7 will be installed
---> Package libstdc++.x86_64 0:4.8.5-4.el7 will be an update
---> Package libstdc++-devel.x86_64 0:4.8.3-9.el7 will be updated
---> Package libstdc++-devel.i686 0:4.8.5-4.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-4.el7 will be an update
---> Package libxcb.x86_64 0:1.9-5.el7 will be updated
---> Package libxcb.i686 0:1.11-4.el7 will be installed
---> Package libxcb.x86_64 0:1.11-4.el7 will be an update
---> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
---> Package unixODBC-devel.x86_64 0:2.3.1-11.el7 will be installed
---> Package zlib-devel.i686 0:1.2.7-15.el7 will be installed
--> Processing Dependency: zlib = 1.2.7-15.el7 for package: zlib-devel-1.2.7-15.el7.i686
--> Processing Dependency: libz.so.1 for package: zlib-devel-1.2.7-15.el7.i686
---> Package zlib-devel.x86_64 0:1.2.7-15.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.3-9.el7 will be updated
---> Package cpp.x86_64 0:4.8.5-4.el7 will be an update
---> Package gcc-gfortran.x86_64 0:4.8.3-9.el7 will be updated
---> Package gcc-gfortran.x86_64 0:4.8.5-4.el7 will be an update
--> Processing Dependency: libgfortran = 4.8.5-4.el7 for package: gcc-gfortran-4.8.5-4.el7.x86_64
--> Processing Dependency: libquadmath = 4.8.5-4.el7 for package: gcc-gfortran-4.8.5-4.el7.x86_64
---> Package glibc-common.x86_64 0:2.17-78.0.1.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-106.0.1.el7_2.6 will be an update
---> Package glibc-headers.x86_64 0:2.17-78.0.1.el7 will be updated
---> Package glibc-headers.x86_64 0:2.17-106.0.1.el7_2.6 will be an update
---> Package libX11-common.noarch 0:1.6.0-2.1.el7 will be updated
---> Package libX11-common.noarch 0:1.6.3-2.el7 will be an update
---> Package libgomp.x86_64 0:4.8.3-9.el7 will be updated
---> Package libgomp.x86_64 0:4.8.5-4.el7 will be an update
---> Package libquadmath-devel.x86_64 0:4.8.3-9.el7 will be updated
---> Package libquadmath-devel.x86_64 0:4.8.5-4.el7 will be an update
---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-12.el7_1 will be updated
---> Package nss-softokn-freebl.i686 0:3.16.2.3-14.2.el7_2 will be installed
---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-14.2.el7_2 will be an update
---> Package zlib.x86_64 0:1.2.7-13.el7 will be updated
---> Package zlib.i686 0:1.2.7-15.el7 will be installed
---> Package zlib.x86_64 0:1.2.7-15.el7 will be an update
--> Running transaction check
---> Package libgfortran.x86_64 0:4.8.3-9.el7 will be updated
---> Package libgfortran.x86_64 0:4.8.5-4.el7 will be an update
---> Package libquadmath.x86_64 0:4.8.3-9.el7 will be updated
---> Package libquadmath.x86_64 0:4.8.5-4.el7 will be an update
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                Arch      Version                   Repository     Size
================================================================================
Installing:
 compat-libstdc++-33    i686      3.2.3-72.el7              ol7_latest    196 k
 glibc                  i686      2.17-106.0.1.el7_2.6      ol7_latest    4.2 M
 glibc-devel            i686      2.17-106.0.1.el7_2.6      ol7_latest    1.0 M
 ksh                    x86_64    20120801-22.el7_1.3       ol7_latest    880 k
 libX11                 i686      1.6.3-2.el7               ol7_latest    609 k
 libXau                 i686      1.0.8-2.1.el7             ol7_latest     28 k
 libXext                i686      1.3.3-3.el7               ol7_latest     38 k
 libXi                  i686      1.7.4-2.el7               ol7_latest     39 k
 libXtst                i686      1.2.2-2.1.el7             ol7_latest     19 k
 libaio                 i686      0.3.109-13.el7            ol7_latest     24 k
 libaio-devel           i686      0.3.109-13.el7            ol7_latest     12 k
 libaio-devel           x86_64    0.3.109-13.el7            ol7_latest     12 k
 libgcc                 i686      4.8.5-4.el7               ol7_latest    102 k
 libstdc++              i686      4.8.5-4.el7               ol7_latest    310 k
 libstdc++-devel        i686      4.8.5-4.el7               ol7_latest    1.5 M
 libxcb                 i686      1.11-4.el7                ol7_latest    201 k
 unixODBC               x86_64    2.3.1-11.el7              ol7_latest    412 k
 unixODBC-devel         x86_64    2.3.1-11.el7              ol7_latest     54 k
 zlib-devel             i686      1.2.7-15.el7              ol7_latest     49 k
 zlib-devel             x86_64    1.2.7-15.el7              ol7_latest     49 k
Updating:
 binutils               x86_64    2.23.52.0.1-55.el7        ol7_latest    5.0 M
 gcc                    x86_64    4.8.5-4.el7               ol7_latest     16 M
 gcc-c++                x86_64    4.8.5-4.el7               ol7_latest    7.2 M
 glibc                  x86_64    2.17-106.0.1.el7_2.6      ol7_latest    3.6 M
 glibc-devel            x86_64    2.17-106.0.1.el7_2.6      ol7_latest    1.0 M
 libX11                 x86_64    1.6.3-2.el7               ol7_latest    605 k
 libXext                x86_64    1.3.3-3.el7               ol7_latest     38 k
 libXi                  x86_64    1.7.4-2.el7               ol7_latest     39 k
 libaio                 x86_64    0.3.109-13.el7            ol7_latest     24 k
 libgcc                 x86_64    4.8.5-4.el7               ol7_latest     94 k
 libstdc++              x86_64    4.8.5-4.el7               ol7_latest    297 k
 libstdc++-devel        x86_64    4.8.5-4.el7               ol7_latest    1.5 M
 libxcb                 x86_64    1.11-4.el7                ol7_latest    189 k
Installing for dependencies:
 nss-softokn-freebl     i686      3.16.2.3-14.2.el7_2       ol7_latest    187 k
 zlib                   i686      1.2.7-15.el7              ol7_latest     90 k
Updating for dependencies:
 cpp                    x86_64    4.8.5-4.el7               ol7_latest    5.9 M
 gcc-gfortran           x86_64    4.8.5-4.el7               ol7_latest    6.6 M
 glibc-common           x86_64    2.17-106.0.1.el7_2.6      ol7_latest     11 M
 glibc-headers          x86_64    2.17-106.0.1.el7_2.6      ol7_latest    662 k
 libX11-common          noarch    1.6.3-2.el7               ol7_latest    161 k
 libgfortran            x86_64    4.8.5-4.el7               ol7_latest    292 k
 libgomp                x86_64    4.8.5-4.el7               ol7_latest    130 k
 libquadmath            x86_64    4.8.5-4.el7               ol7_latest    182 k
 libquadmath-devel      x86_64    4.8.5-4.el7               ol7_latest     45 k
 nss-softokn-freebl     x86_64    3.16.2.3-14.2.el7_2       ol7_latest    203 k
 zlib                   x86_64    1.2.7-15.el7              ol7_latest     89 k
 
Transaction Summary
================================================================================
Install  20 Packages (+ 2 Dependent packages)
Upgrade  13 Packages (+11 Dependent packages)
 
Total download size: 71 M
Downloading packages:
No Presto metadata available for ol7_latest
(1/46): compat-libstdc++-33-3.2.3-72.el7.i686.rpm          | 196 kB   00:00     
(2/46): binutils-2.23.52.0.1-55.el7.x86_64.rpm             | 5.0 MB   00:01     
(3/46): cpp-4.8.5-4.el7.x86_64.rpm                         | 5.9 MB   00:01     
(4/46): gcc-c++-4.8.5-4.el7.x86_64.rpm                     | 7.2 MB   00:02     
(5/46): gcc-4.8.5-4.el7.x86_64.rpm                         |  16 MB   00:03     
(6/46): glibc-2.17-106.0.1.el7_2.6.i686.rpm                | 4.2 MB   00:01     
(7/46): gcc-gfortran-4.8.5-4.el7.x86_64.rpm                | 6.6 MB   00:02     
(8/46): glibc-2.17-106.0.1.el7_2.6.x86_64.rpm              | 3.6 MB   00:01     
(9/46): glibc-devel-2.17-106.0.1.el7_2.6.i686.rpm          | 1.0 MB   00:00     
(10/46): glibc-devel-2.17-106.0.1.el7_2.6.x86_64.rpm       | 1.0 MB   00:00     
(11/46): glibc-headers-2.17-106.0.1.el7_2.6.x86_64.rpm     | 662 kB   00:00     
(12/46): ksh-20120801-22.el7_1.3.x86_64.rpm                | 880 kB   00:00     
(13/46): libX11-1.6.3-2.el7.i686.rpm                       | 609 kB   00:00     
(14/46): libX11-1.6.3-2.el7.x86_64.rpm                     | 605 kB   00:00     
(15/46): libX11-common-1.6.3-2.el7.noarch.rpm              | 161 kB   00:00     
(16/46): libXau-1.0.8-2.1.el7.i686.rpm                     |  28 kB   00:00     
(17/46): libXext-1.3.3-3.el7.i686.rpm                      |  38 kB   00:00     
(18/46): libXext-1.3.3-3.el7.x86_64.rpm                    |  38 kB   00:00     
(19/46): libXi-1.7.4-2.el7.i686.rpm                        |  39 kB   00:00     
(20/46): libXi-1.7.4-2.el7.x86_64.rpm                      |  39 kB   00:00     
(21/46): libXtst-1.2.2-2.1.el7.i686.rpm                    |  19 kB   00:00     
(22/46): libaio-0.3.109-13.el7.i686.rpm                    |  24 kB   00:00     
(23/46): libaio-0.3.109-13.el7.x86_64.rpm                  |  24 kB   00:00     
(24/46): libaio-devel-0.3.109-13.el7.i686.rpm              |  12 kB   00:00     
(25/46): glibc-common-2.17-106.0.1.el7_2.6.x86_64.rpm      |  11 MB   00:04     
(26/46): libaio-devel-0.3.109-13.el7.x86_64.rpm            |  12 kB   00:00     
(27/46): libgcc-4.8.5-4.el7.i686.rpm                       | 102 kB   00:00     
(28/46): libgfortran-4.8.5-4.el7.x86_64.rpm                | 292 kB   00:00     
(29/46): libgomp-4.8.5-4.el7.x86_64.rpm                    | 130 kB   00:00     
(30/46): libgcc-4.8.5-4.el7.x86_64.rpm                     |  94 kB   00:00     
(31/46): libquadmath-4.8.5-4.el7.x86_64.rpm                | 182 kB   00:00     
(32/46): libquadmath-devel-4.8.5-4.el7.x86_64.rpm          |  45 kB   00:00     
(33/46): libstdc++-4.8.5-4.el7.i686.rpm                    | 310 kB   00:00     
(34/46): libstdc++-4.8.5-4.el7.x86_64.rpm                  | 297 kB   00:00     
(35/46): libstdc++-devel-4.8.5-4.el7.i686.rpm              | 1.5 MB   00:00     
(36/46): libstdc++-devel-4.8.5-4.el7.x86_64.rpm            | 1.5 MB   00:00     
(37/46): libxcb-1.11-4.el7.x86_64.rpm                      | 189 kB   00:00     
(38/46): libxcb-1.11-4.el7.i686.rpm                        | 201 kB   00:00     
(39/46): nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64.rpm | 203 kB   00:00     
(40/46): nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686.rpm   | 187 kB   00:00     
(41/46): unixODBC-devel-2.3.1-11.el7.x86_64.rpm            |  54 kB   00:00     
(42/46): unixODBC-2.3.1-11.el7.x86_64.rpm                  | 412 kB   00:00     
(43/46): zlib-1.2.7-15.el7.i686.rpm                        |  90 kB   00:00     
(44/46): zlib-1.2.7-15.el7.x86_64.rpm                      |  89 kB   00:00     
(45/46): zlib-devel-1.2.7-15.el7.x86_64.rpm                |  49 kB   00:00     
(46/46): zlib-devel-1.2.7-15.el7.i686.rpm                  |  49 kB   00:00     
--------------------------------------------------------------------------------
Total                                              5.2 MB/s |  71 MB  00:13     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libgcc-4.8.5-4.el7.x86_64                                   1/70 
  Updating   : glibc-common-2.17-106.0.1.el7_2.6.x86_64                    2/70 
  Updating   : nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64               3/70 
  Updating   : glibc-2.17-106.0.1.el7_2.6.x86_64                           4/70 
  Updating   : zlib-1.2.7-15.el7.x86_64                                    5/70 
  Updating   : libquadmath-4.8.5-4.el7.x86_64                              6/70 
  Updating   : libstdc++-4.8.5-4.el7.x86_64                                7/70 
  Updating   : glibc-headers-2.17-106.0.1.el7_2.6.x86_64                   8/70 
  Updating   : libX11-common-1.6.3-2.el7.noarch                            9/70 
  Installing : nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686                10/70 
  Installing : glibc-2.17-106.0.1.el7_2.6.i686                            11/70 
  Installing : libgcc-4.8.5-4.el7.i686                                    12/70 
  Installing : glibc-devel-2.17-106.0.1.el7_2.6.i686                      13/70 
  Updating   : libgfortran-4.8.5-4.el7.x86_64                             14/70 
  Updating   : cpp-4.8.5-4.el7.x86_64                                     15/70 
  Updating   : binutils-2.23.52.0.1-55.el7.x86_64                         16/70 
  Updating   : libaio-0.3.109-13.el7.x86_64                               17/70 
  Installing : unixODBC-2.3.1-11.el7.x86_64                               18/70 
  Updating   : libgomp-4.8.5-4.el7.x86_64                                 19/70 
  Updating   : gcc-4.8.5-4.el7.x86_64                                     20/70 
  Updating   : libquadmath-devel-4.8.5-4.el7.x86_64                       21/70 
  Updating   : libxcb-1.11-4.el7.x86_64                                   22/70 
  Updating   : libX11-1.6.3-2.el7.x86_64                                  23/70 
  Updating   : libXext-1.3.3-3.el7.x86_64                                 24/70 
  Updating   : libXi-1.7.4-2.el7.x86_64                                   25/70 
  Updating   : gcc-gfortran-4.8.5-4.el7.x86_64                            26/70 
  Installing : unixODBC-devel-2.3.1-11.el7.x86_64                         27/70 
  Installing : libaio-devel-0.3.109-13.el7.x86_64                         28/70 
  Updating   : glibc-devel-2.17-106.0.1.el7_2.6.x86_64                    29/70 
  Updating   : libstdc++-devel-4.8.5-4.el7.x86_64                         30/70 
  Installing : zlib-devel-1.2.7-15.el7.x86_64                             31/70 
  Installing : ksh-20120801-22.el7_1.3.x86_64                             32/70 
  Installing : libstdc++-4.8.5-4.el7.i686                                 33/70 
  Installing : libstdc++-devel-4.8.5-4.el7.i686                           34/70 
  Installing : libXau-1.0.8-2.1.el7.i686                                  35/70 
  Installing : libxcb-1.11-4.el7.i686                                     36/70 
  Installing : libX11-1.6.3-2.el7.i686                                    37/70 
  Installing : libXext-1.3.3-3.el7.i686                                   38/70 
  Installing : libXi-1.7.4-2.el7.i686                                     39/70 
  Installing : libaio-0.3.109-13.el7.i686                                 40/70 
  Installing : zlib-1.2.7-15.el7.i686                                     41/70 
  Installing : zlib-devel-1.2.7-15.el7.i686                               42/70 
  Installing : libaio-devel-0.3.109-13.el7.i686                           43/70 
  Updating   : gcc-c++-4.8.5-4.el7.x86_64                                 44/70 
  Installing : libXtst-1.2.2-2.1.el7.i686                                 45/70 
  Installing : compat-libstdc++-33-3.2.3-72.el7.i686                      46/70 
  Cleanup    : gcc-gfortran-4.8.3-9.el7.x86_64                            47/70 
  Cleanup    : gcc-c++-4.8.3-9.el7.x86_64                                 48/70 
  Cleanup    : libgfortran-4.8.3-9.el7.x86_64                             49/70 
  Cleanup    : libXi-1.7.2-2.1.el7.x86_64                                 50/70 
  Cleanup    : libquadmath-devel-4.8.3-9.el7.x86_64                       51/70 
  Cleanup    : libstdc++-devel-4.8.3-9.el7.x86_64                         52/70 
  Cleanup    : gcc-4.8.3-9.el7.x86_64                                     53/70 
  Cleanup    : glibc-devel-2.17-78.0.1.el7.x86_64                         54/70 
  Cleanup    : binutils-2.23.52.0.1-30.el7_1.2.x86_64                     55/70 
  Cleanup    : cpp-4.8.3-9.el7.x86_64                                     56/70 
  Cleanup    : libstdc++-4.8.3-9.el7.x86_64                               57/70 
  Cleanup    : libXext-1.3.2-2.1.el7.x86_64                               58/70 
  Cleanup    : glibc-headers-2.17-78.0.1.el7.x86_64                       59/70 
  Cleanup    : libX11-1.6.0-2.1.el7.x86_64                                60/70 
  Cleanup    : libxcb-1.9-5.el7.x86_64                                    61/70 
  Cleanup    : zlib-1.2.7-13.el7.x86_64                                   62/70 
  Cleanup    : libgomp-4.8.3-9.el7.x86_64                                 63/70 
  Cleanup    : libquadmath-4.8.3-9.el7.x86_64                             64/70 
  Cleanup    : libaio-0.3.109-12.el7.x86_64                               65/70 
  Cleanup    : libX11-common-1.6.0-2.1.el7.noarch                         66/70 
  Cleanup    : glibc-common-2.17-78.0.1.el7.x86_64                        67/70 
  Cleanup    : nss-softokn-freebl-3.16.2.3-12.el7_1.x86_64                68/70 
  Cleanup    : glibc-2.17-78.0.1.el7.x86_64                               69/70 
  Cleanup    : libgcc-4.8.3-9.el7.x86_64                                  70/70 
  Verifying  : libXext-1.3.3-3.el7.x86_64                                  1/70 
  Verifying  : libgcc-4.8.5-4.el7.i686                                     2/70 
  Verifying  : gcc-4.8.5-4.el7.x86_64                                      3/70 
  Verifying  : glibc-devel-2.17-106.0.1.el7_2.6.i686                       4/70 
  Verifying  : libXext-1.3.3-3.el7.i686                                    5/70 
  Verifying  : libstdc++-4.8.5-4.el7.i686                                  6/70 
  Verifying  : glibc-2.17-106.0.1.el7_2.6.x86_64                           7/70 
  Verifying  : libxcb-1.11-4.el7.i686                                      8/70 
  Verifying  : gcc-c++-4.8.5-4.el7.x86_64                                  9/70 
  Verifying  : zlib-devel-1.2.7-15.el7.x86_64                             10/70 
  Verifying  : libaio-devel-0.3.109-13.el7.i686                           11/70 
  Verifying  : libX11-1.6.3-2.el7.x86_64                                  12/70 
  Verifying  : glibc-common-2.17-106.0.1.el7_2.6.x86_64                   13/70 
  Verifying  : unixODBC-devel-2.3.1-11.el7.x86_64                         14/70 
  Verifying  : libXau-1.0.8-2.1.el7.i686                                  15/70 
  Verifying  : libaio-0.3.109-13.el7.i686                                 16/70 
  Verifying  : zlib-1.2.7-15.el7.x86_64                                   17/70 
  Verifying  : ksh-20120801-22.el7_1.3.x86_64                             18/70 
  Verifying  : libaio-0.3.109-13.el7.x86_64                               19/70 
  Verifying  : libXtst-1.2.2-2.1.el7.i686                                 20/70 
  Verifying  : glibc-2.17-106.0.1.el7_2.6.i686                            21/70 
  Verifying  : libstdc++-4.8.5-4.el7.x86_64                               22/70 
  Verifying  : libX11-common-1.6.3-2.el7.noarch                           23/70 
  Verifying  : zlib-devel-1.2.7-15.el7.i686                               24/70 
  Verifying  : unixODBC-2.3.1-11.el7.x86_64                               25/70 
  Verifying  : libgfortran-4.8.5-4.el7.x86_64                             26/70 
  Verifying  : libstdc++-devel-4.8.5-4.el7.i686                           27/70 
  Verifying  : gcc-gfortran-4.8.5-4.el7.x86_64                            28/70 
  Verifying  : libaio-devel-0.3.109-13.el7.x86_64                         29/70 
  Verifying  : nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64              30/70 
  Verifying  : glibc-headers-2.17-106.0.1.el7_2.6.x86_64                  31/70 
  Verifying  : zlib-1.2.7-15.el7.i686                                     32/70 
  Verifying  : libstdc++-devel-4.8.5-4.el7.x86_64                         33/70 
  Verifying  : libXi-1.7.4-2.el7.x86_64                                   34/70 
  Verifying  : cpp-4.8.5-4.el7.x86_64                                     35/70 
  Verifying  : compat-libstdc++-33-3.2.3-72.el7.i686                      36/70 
  Verifying  : libX11-1.6.3-2.el7.i686                                    37/70 
  Verifying  : libgomp-4.8.5-4.el7.x86_64                                 38/70 
  Verifying  : libgcc-4.8.5-4.el7.x86_64                                  39/70 
  Verifying  : binutils-2.23.52.0.1-55.el7.x86_64                         40/70 
  Verifying  : libquadmath-devel-4.8.5-4.el7.x86_64                       41/70 
  Verifying  : libXi-1.7.4-2.el7.i686                                     42/70 
  Verifying  : glibc-devel-2.17-106.0.1.el7_2.6.x86_64                    43/70 
  Verifying  : nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686                44/70 
  Verifying  : libquadmath-4.8.5-4.el7.x86_64                             45/70 
  Verifying  : libxcb-1.11-4.el7.x86_64                                   46/70 
  Verifying  : glibc-common-2.17-78.0.1.el7.x86_64                        47/70 
  Verifying  : libX11-common-1.6.0-2.1.el7.noarch                         48/70 
  Verifying  : libxcb-1.9-5.el7.x86_64                                    49/70 
  Verifying  : libgfortran-4.8.3-9.el7.x86_64                             50/70 
  Verifying  : glibc-2.17-78.0.1.el7.x86_64                               51/70 
  Verifying  : libaio-0.3.109-12.el7.x86_64                               52/70 
  Verifying  : cpp-4.8.3-9.el7.x86_64                                     53/70 
  Verifying  : libstdc++-devel-4.8.3-9.el7.x86_64                         54/70 
  Verifying  : libX11-1.6.0-2.1.el7.x86_64                                55/70 
  Verifying  : gcc-gfortran-4.8.3-9.el7.x86_64                            56/70 
  Verifying  : libquadmath-devel-4.8.3-9.el7.x86_64                       57/70 
  Verifying  : libXi-1.7.2-2.1.el7.x86_64                                 58/70 
  Verifying  : glibc-devel-2.17-78.0.1.el7.x86_64                         59/70 
  Verifying  : gcc-c++-4.8.3-9.el7.x86_64                                 60/70 
  Verifying  : nss-softokn-freebl-3.16.2.3-12.el7_1.x86_64                61/70 
  Verifying  : libgcc-4.8.3-9.el7.x86_64                                  62/70 
  Verifying  : binutils-2.23.52.0.1-30.el7_1.2.x86_64                     63/70 
  Verifying  : glibc-headers-2.17-78.0.1.el7.x86_64                       64/70 
  Verifying  : gcc-4.8.3-9.el7.x86_64                                     65/70 
  Verifying  : zlib-1.2.7-13.el7.x86_64                                   66/70 
  Verifying  : libXext-1.3.2-2.1.el7.x86_64                               67/70 
  Verifying  : libstdc++-4.8.3-9.el7.x86_64                               68/70 
  Verifying  : libgomp-4.8.3-9.el7.x86_64                                 69/70 
  Verifying  : libquadmath-4.8.3-9.el7.x86_64                             70/70 
 
Installed:
  compat-libstdc++-33.i686 0:3.2.3-72.el7  glibc.i686 0:2.17-106.0.1.el7_2.6    
  glibc-devel.i686 0:2.17-106.0.1.el7_2.6  ksh.x86_64 0:20120801-22.el7_1.3     
  libX11.i686 0:1.6.3-2.el7                libXau.i686 0:1.0.8-2.1.el7          
  libXext.i686 0:1.3.3-3.el7               libXi.i686 0:1.7.4-2.el7             
  libXtst.i686 0:1.2.2-2.1.el7             libaio.i686 0:0.3.109-13.el7         
  libaio-devel.i686 0:0.3.109-13.el7       libaio-devel.x86_64 0:0.3.109-13.el7 
  libgcc.i686 0:4.8.5-4.el7                libstdc++.i686 0:4.8.5-4.el7         
  libstdc++-devel.i686 0:4.8.5-4.el7       libxcb.i686 0:1.11-4.el7             
  unixODBC.x86_64 0:2.3.1-11.el7           unixODBC-devel.x86_64 0:2.3.1-11.el7 
  zlib-devel.i686 0:1.2.7-15.el7           zlib-devel.x86_64 0:1.2.7-15.el7     
 
Dependency Installed:
  nss-softokn-freebl.i686 0:3.16.2.3-14.2.el7_2     zlib.i686 0:1.2.7-15.el7    
 
Updated:
  binutils.x86_64 0:2.23.52.0.1-55.el7                                          
  gcc.x86_64 0:4.8.5-4.el7                                                      
  gcc-c++.x86_64 0:4.8.5-4.el7                                                  
  glibc.x86_64 0:2.17-106.0.1.el7_2.6                                           
  glibc-devel.x86_64 0:2.17-106.0.1.el7_2.6                                     
  libX11.x86_64 0:1.6.3-2.el7                                                   
  libXext.x86_64 0:1.3.3-3.el7                                                  
  libXi.x86_64 0:1.7.4-2.el7                                                    
  libaio.x86_64 0:0.3.109-13.el7                                                
  libgcc.x86_64 0:4.8.5-4.el7                                                   
  libstdc++.x86_64 0:4.8.5-4.el7                                                
  libstdc++-devel.x86_64 0:4.8.5-4.el7                                          
  libxcb.x86_64 0:1.11-4.el7                                                    
 
Dependency Updated:
  cpp.x86_64 0:4.8.5-4.el7                                                      
  gcc-gfortran.x86_64 0:4.8.5-4.el7                                             
  glibc-common.x86_64 0:2.17-106.0.1.el7_2.6                                    
  glibc-headers.x86_64 0:2.17-106.0.1.el7_2.6                                   
  libX11-common.noarch 0:1.6.3-2.el7                                            
  libgfortran.x86_64 0:4.8.5-4.el7                                              
  libgomp.x86_64 0:4.8.5-4.el7                                                  
  libquadmath.x86_64 0:4.8.5-4.el7                                              
  libquadmath-devel.x86_64 0:4.8.5-4.el7                                        
  nss-softokn-freebl.x86_64 0:3.16.2.3-14.2.el7_2                               
  zlib.x86_64 0:1.2.7-15.el7                                                    
 
Complete!

After you have installed the prerequisites, you install the oracle-dbms-server-12cR1-preinstall library as the root user. You run the command as the root user like this:

yum install -y oracle-dbms-server-12cR1-preinstall

You should see the following when it’s successful:

Loaded plugins: langpacks
adobe-linux-x86_64                                       |  951 B     00:00     
ol7_UEKR3                                                | 1.2 kB     00:00     
ol7_latest                                               | 1.4 kB     00:00     
(1/2): ol7_latest/x86_64/updateinfo                      | 829 kB     00:00     
(2/2): ol7_latest/x86_64/primary                         |  16 MB     00:02     
ol7_latest                                                          14500/14500
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-4.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                                Arch     Version     Repository    Size
================================================================================
Installing:
 oracle-rdbms-server-12cR1-preinstall   x86_64   1.0-4.el7   ol7_latest    18 k
 
Transaction Summary
================================================================================
Install  1 Package
 
Total download size: 18 k
Installed size: 43 k
Downloading packages:
oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.x86_64.rpm  |  18 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.x86_64        1/1 
  Verifying  : oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.x86_64        1/1 
 
Installed:
  oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-4.el7                       
 
Complete!

After running the oracle-dbms-server-12cR1-preinstall library, you can navigate through the Applications, Sundry, and Users and Groups to see the following dialog:

OracleUserCreated

It’s hard to tell from the GUI the oracle user’s group. You can find oracle primary user’s group by checking the /etc/passwd file. You will find that oinstall is the primary user’s group.

As always, I hope this helps those trying to install an Oracle Database 12c instance. Please post a comment if you have a better way to load the pre-requisite packages.

Written by maclochlainn

May 31st, 2016 at 2:44 am

Linux User-Group Console

without comments

This post shows you how to add the menu option and GUI to set users and groups. It’s quite a bit easier than mastering all the command-line syntax. It makes setting up the required user and group accounts for an Oracle Enterprise or MySQL database solution much easier.

You add the utility by calling the yum (Yellowdog Updater, Modified) utility like this:

yum installed -y system-config_users

You should see the following:

Loaded plugins: langpacks
adobe-linux-x86_64                                       |  951 B     00:00     
ol7_UEKR3                                                | 1.2 kB     00:00     
ol7_latest                                               | 1.4 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package system-config-users.noarch 0:1.3.5-2.el7 will be installed
--> Processing Dependency: system-config-users-docs for package: system-config-users-1.3.5-2.el7.noarch
--> Running transaction check
---> Package system-config-users-docs.noarch 0:1.0.9-6.el7 will be installed
--> Processing Dependency: rarian-compat for package: system-config-users-docs-1.0.9-6.el7.noarch
--> Running transaction check
---> Package rarian-compat.x86_64 0:0.8.1-11.el7 will be installed
--> Processing Dependency: rarian = 0.8.1-11.el7 for package: rarian-compat-0.8.1-11.el7.x86_64
--> Processing Dependency: rarian for package: rarian-compat-0.8.1-11.el7.x86_64
--> Processing Dependency: librarian.so.0()(64bit) for package: rarian-compat-0.8.1-11.el7.x86_64
--> Running transaction check
---> Package rarian.x86_64 0:0.8.1-11.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                      Arch       Version           Repository      Size
================================================================================
Installing:
 system-config-users          noarch     1.3.5-2.el7       ol7_latest     337 k
Installing for dependencies:
 rarian                       x86_64     0.8.1-11.el7      ol7_latest      97 k
 rarian-compat                x86_64     0.8.1-11.el7      ol7_latest      65 k
 system-config-users-docs     noarch     1.0.9-6.el7       ol7_latest     307 k
 
Transaction Summary
================================================================================
Install  1 Package (+3 Dependent packages)
 
Total download size: 805 k
Installed size: 3.9 M
Downloading packages:
(1/4): rarian-0.8.1-11.el7.x86_64.rpm                      |  97 kB   00:00     
(2/4): rarian-compat-0.8.1-11.el7.x86_64.rpm               |  65 kB   00:00     
(3/4): system-config-users-1.3.5-2.el7.noarch.rpm          | 337 kB   00:00     
(4/4): system-config-users-docs-1.0.9-6.el7.noarch.rpm     | 307 kB   00:00     
--------------------------------------------------------------------------------
Total                                              830 kB/s | 805 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : rarian-0.8.1-11.el7.x86_64                                   1/4 
  Installing : rarian-compat-0.8.1-11.el7.x86_64                            2/4 
  Installing : system-config-users-1.3.5-2.el7.noarch                       3/4 
  Installing : system-config-users-docs-1.0.9-6.el7.noarch                  4/4 
  Verifying  : rarian-compat-0.8.1-11.el7.x86_64                            1/4 
  Verifying  : system-config-users-1.3.5-2.el7.noarch                       2/4 
  Verifying  : rarian-0.8.1-11.el7.x86_64                                   3/4 
  Verifying  : system-config-users-docs-1.0.9-6.el7.noarch                  4/4 
 
Installed:
  system-config-users.noarch 0:1.3.5-2.el7                                      
 
Dependency Installed:
  rarian.x86_64 0:0.8.1-11.el7                                                  
  rarian-compat.x86_64 0:0.8.1-11.el7                                           
  system-config-users-docs.noarch 0:1.0.9-6.el7                                 
 
Complete!

After successfully installing the radian, rarian-compat, system-config-users, and system-config-users-docs packages, you will find that there’s now a Users and Groups option when you navigate by clicking on Applications and then clicking on Sundry from the menu.

Menu Instructions

SQLDeveloper1

  1. You navigate to the Applications menu, and choose Sundry from the menu list and Users and Groups from the menu item to continue.

SQLDeveloper1

  1. You will be prompted for the sudoer’s password in this dialog.

SQLDeveloper1

  1. At this point, you can use the GUI interface to set users and groups.

As always, I hope this helps those trying to set users and passwords without mastering the command-line syntax.

Written by maclochlainn

May 29th, 2016 at 4:32 pm

Fix VMware Networking

with 3 comments

Occasionally, my students loose their network connection when copying their virtual machines. This article shows you how to rebuild your Internet connection.

The first step requires you to identify the port number on your host operating system, which is typically Windows OS or Mac OS X. You can find that by running the following search from a Mac OS X Terminal session or Windows OS Command session.

If you’re on the Mac OS X, you launch a Terminal session and then use the sudo command to open a shell as the root super user, like this:

sudo sh

As the root super user on Mac OS X , you run the netstat command like this:

sh-3.2# netstat -a | grep 1.ntp | grep -v grep
udp4       0      0  192.168.147.1.ntp      *.*

VMware uses the same subdomain with one difference for the gateway, it uses node 2:

192.168.147.2

The alternate syntax to find Vmware’s subdomain requires you to use an Administrator account on Windows, like this:

C:\> netstat -a | findstr /C:.ntp

After you determine the subdomain, you need to ensure VMware is configured correctly. You navigate to the menu and choose Virtual Machine and then Settings from the dropdown menu. The software shows you the following:

Linux7Network1

Then, click on the Network Adapter under the Removable Devices, and you see the following screen:

Linux71Network2

You need to make sure that you’re using Internet Sharing, or Share with my Mac. If you’re not using it select it now.

Launch the hosted Linux OS and open a Terminal seesion. Inside the Terminal, you should find the machine’s address as the root address with the ifconfig utility. The technique follows:

[student@localhost ~]$ sudo sh
[sudo] password for student: 
sh-4.2# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:70:77:64  txqueuelen 1000  (Ethernet)
        RX packets 34  bytes 4190 (4.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Next, you need to edit some files, they assume the VMware Network Gateway is 192.168.147.2 and the machine’s address is “00:0c:29:70:77:64“. The first file you need to edit is the /etc/resolv.conf file, and it should look like this:

domain localdomain
search localdomain
nameserver 192.168.147.2

The second file you need to edit is the /etc/sysconfig/network file. It should look like this:

# Created by anaconda
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.147.2

The third file you need to edit is the /etc/sysconfig/network-scripts/ifcfg-eth0 file. It should look like this:

DEVICE=eth0
HWADDR=00:0c:29:70:77:64
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
TYPE=Ethernet
DNS1=192.168.147.2
USERCTL=no
PEERDNS=yes
IPV6INIT=no

The last step requires that you reboot the machine or run the /etc/rc.d/init.d/network to restart the network. I hope this helps those trying to restore their VMware hosted operating systems network connection.

Written by maclochlainn

May 26th, 2016 at 12:58 am

Debug PL/SQL Web Pages

without comments

What happens when you can’t get a PL/SQL Web Toolkit to work because it only prints to a web page? That’s more tedious because any dbms_output.put_line command you embed only prints to a SQL*Plus session. The answer is quite simple, you create a test case and test it inside a SQL*Plus environment.

Here’s a sample web page that fails to run successfully …

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
CREATE OR REPLACE
  PROCEDURE html_table_values
  ( name_array   OWA_UTIL.VC_ARR
  , value_array  OWA_UTIL.VC_ARR ) IS
  BEGIN
    /* Print debug to SQL*Plus session. */
    FOR i IN 1..name_array.COUNT LOOP
      DBMS_OUTPUT.put_line('Value ['||name_array(i)||'='||value_array(i)||']');
    END LOOP;
 
    /* Open HTML page with the PL/SQL toolkit. */
    htp.print('<!DOCTYPE html>');
    htp.htmlopen;
    htp.headopen;
    htp.htitle('Test');
    htp.headclose;
    htp.bodyopen;
    htp.line;
    htp.print('Test');
    htp.line;
    htp.bodyclose;
    htp.htmlclose;
END;
/

You can test the program with the following anonymous block as the SYSTEM user, which is equivalent to the following URL:

http://localhost:8080/db/html_table_values?begin=1004&end=1012

The following test program lets you work:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DECLARE
  x  OWA_UTIL.VC_ARR;
  y  OWA_UTIL.VC_ARR;
BEGIN
  /* Insert first row element. */
  x(1) := 'begin';
  y(1) := '1004';
 
  /* Insert second row element. */
  x(2) := 'end';
  y(2) := '1012';
 
  /* Call the anonymous schema's web page. */
  anonymous.html_table_values(x,y);
END;
/

It should print:

Value [begin=1004]
Value [end=1012]

I hope this helps those looking for a solution.

Written by maclochlainn

May 16th, 2016 at 5:18 pm

SQL Developer & PL/SQL

without comments

While SQL Developer installs with a dbms_output view, some organizations close it before they distribute images or virtual machine (VM) instances. This post shows you how to re-enable the Dbms Output view for SQL Developer.

SQL Developer DBMS_OUTPUT Configuration

SQLDeveloper1

  1. You need to open SQL Developer, which may look like this when the DBMS_OUTPUT view isn’t visible.

SQLDeveloper1

  1. You need to click on the View menu option in SQL Developer and choose the Dbms Output dropdown menu element.

SQLDeveloper1

  1. You should see a grayed-out Dbms Output view.

SQLDeveloper1

  1. You should type a simply “Hello World!” anonymous block program in PL/SQL, like the one shown in the drawing.

SQLDeveloper1

  1. After writing the “Hello World!” anonymous block program in PL/SQL, click the green arrow to start the statement and you will see two things. There is now a Script Output view between your console and Dbms Output views, and it should say “anonymous block completed.” Unfortunately, none of your output is displayed in the Dbms Output view because you need to enable it.

SQLDeveloper1

  1. If you hover over the Dbms Output view’s green arrow, you see the help message that describes the behavior of the green arrow. The Dbms Output green arrow lets you enable the Dbms Output view for output.

SQLDeveloper1

  1. After you click the Dbms Output view’s green arrow, you receive a Select Connection prompt for the view. Make sure you have the right user, and click the OK button to continue.

SQLDeveloper1

  1. After you create the connection for the Dbms Output stream, the view area becomes white rather than gray.

SQLDeveloper1

  1. Click the green arrow to start the statement and you will see the “Hello World!” string in the Dbms Output view.”

As always, I hope this helps those looking for a solution.

Written by maclochlainn

May 13th, 2016 at 10:55 am

Using a Sparse Index

with 2 comments

My vacation from my blog is officially over. The question that I’m answering today is: How can you pass a set of non-sequential ID values to a function and return a result set? You can solve the problem by passing an ADT (Attribute Data Type) or UDT (User Defined Type) variable into a subquery of a cursor. The subquery leverages the TABLE function to translate the ADT or UDT into SQL result set, which is equivalent to a comma-delimited list of values.

You can also solve this problem with Native Dynamic SQL (NDS). However, the person who posed the question didn’t want to use NDS to build out a variable length list of comma-delimited numbers.

You need to create three object types for this example. They are:

  • a list of numbers
  • a record structure, declared as an object type without methods
  • a list of the record structure

These are the SQL commands to create the required data types:

CREATE OR REPLACE
  TYPE list_ids IS TABLE OF NUMBER;
/
CREATE OR REPLACE
  TYPE item_struct IS OBJECT
  ( item_id       NUMBER
  , item_title    VARCHAR2(80)
  , release_date  DATE );
/
CREATE OR REPLACE
  TYPE item_struct_list IS TABLE OF item_struct;
/

Next, you create a nonsynchronous function. It takes a sparsely populated list of values that map to the surrogate key of the column, which is typically the table’s primary key column. It returns a collection of the item_struct object type. This type of function is an object-table function.

The code follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
CREATE OR REPLACE
  FUNCTION nonsynchronous 
  ( pv_list_ids  LIST_IDS ) RETURN item_struct_list IS
    /* Declare a record data structure list. */
    lv_struct_list  ITEM_STRUCT_LIST := item_struct_list();
 
    /* Declare a sparsely indexed list of film items. */
    CURSOR get_items
    ( cv_list_ids  LIST_IDS ) IS
      SELECT   item_id AS item_id
      ,        item_title
      ||       CASE
                 WHEN item_subtitle IS NOT NULL THEN
                   ': '|| item_subtitle
               END AS item_title
      ,        release_date AS release_date
      FROM     item
      WHERE    item_id IN (SELECT *
                           FROM   TABLE(cv_list_ids))
      ORDER BY item_id;
BEGIN
  /* Lood through the sparsely populated list of numbers. */
  FOR i IN get_items(pv_list_ids) LOOP
    lv_struct_list.EXTEND;
    lv_struct_list(lv_struct_list.COUNT) := item_struct( item_id      => i.item_id
                                                       , item_title   => i.item_title
                                                       , release_date => i.release_date );
  END LOOP;
 
  /* Return the record structure list. */
  RETURN lv_struct_list;
END;
/

The foregoing nonsynchronous function uses a nested query that transforms to a result set on lines 18 and 19. In the execution block of the program, it uses a call to the item_struct structure to capture and assign row values to an element of the lv_struct_list variable.

You can now test the nonsynchronous function with the following query:

COL item_id      FORMAT 9999  HEADING "Item|ID #"
COL item_title   FORMAT A40   HEADING "Item Title"
COL release_date FORMAT A11   HEADING "Release|Date"
SELECT   *
FROM     TABLE(nonsynchronous(list_ids(1002, 1013, 1007)));

The query returns the record set as an ordered list in the result set, like:

Item					       Release
 ID # Item Title			       Date
----- ---------------------------------------- -----------
 1002 Star Wars I: Phantom Menace	       04-MAY-99
 1007 RoboCop				       24-JUL-03
 1013 The DaVinci Code			       19-MAY-06

I hope this answers the question about how to get results sets with sparsely populated ID values.

Written by maclochlainn

May 11th, 2016 at 1:37 am