Oracle Client 11g For Mac

The script content on this page is for navigation purposes only and does not alter the content in any way.

How to install Oracle Database on Mac OS Sierra 10.12 or above. You can use the terminal to connect to the database but it’s better use a client. It’s easier to manage this way. Oracle 11g R2 Database Release 2 only support Windows, Linux, and Solaris. So if you want to using Oracle 11g R2 on a Mac OS you will need to using something like Virtual Box or VMware Fusion. You can read more about installing Oracle 11g R2 on these operating system here.

This chapter contains the following topics:

2.1 About Oracle Instant Client

Oracle Instant Client provides the necessary Oracle Database client-side files to create and run OCI, OCCI, ODBC, and JDBC OCI applications. Useful command-line utilities including SQL*Plus, SQL*Loader and Oracle Data Pump are also available. Oracle Instant Client simplifies the deployment of applications by eliminating the need for an Oracle home on the client machines.

The storage space requirement of an OCI application running in Instant Client mode is significantly reduced compared to the same application running in a full client-side installation. A minimal install of Instant Client shared libraries can occupy less than 10% of the space of a full client-side installation. Finally, the Instant Client is easy to install.

Why use Instant Client?

  • Installation involves unzipping a few files, or installing RPM packages.

  • The number of required files and the total disk storage are significantly reduced.

  • There is no loss of functionality or performance for applications deployed using Instant Client.

  • It is simple for independent software vendors to package applications.

A README file is included with the Instant Client installation. It describes the version, date and time, and the operating system the Instant Client was generated on.

OCI applications, by default, look for the OCI Data Shared Library, libociei.so (or Oraociei19.dll on Windows) in the runtime library search path (for example LD_LIBRARY_PATH on Linux, or PATH on Windows) to determine if the application should operate in the Instant Client mode. If this library is not found, then OCI tries to load the Instant Client Light Data Shared Library (see Table 2-3 and Table 2-4), libociicus.so (or Oraociicus19.dll on Windows). If the Instant Client Light library is found, then the application operates in the Instant Client Light mode. Otherwise, a full installation based on Oracle home is assumed.

For Instant Client, the following tables shows the Oracle Database client-side files required to deploy an OCI application for Linux and UNIX and Microsoft Windows. Other libraries and utilities get installed, but are not needed for OCI runtime use. For example, you can delete files such as jdbc.jar.

Table 2-1 Instant Client Shared Libraries for Linux and UNIX

Linux and UNIXDescription for Linux and UNIX

libclntsh.so.19.1

libclntshcore.so.19.1

Client Code Library

libociei.soFoot 1

OCI Instant Client Data Shared Library

libnnz19.so

Security Library

libons.so

Oracle Notification Service (ONS) library

libmql1.so

Light Weight IPC Library

libipc1.so

Message Queue Light Library

Footnote 1

The libraries must reside in the same directory in order to use Instant Client.

Table 2-2 Instant Client Shared Libraries for Microsoft Windows

Microsoft WindowsDescription for Microsoft Windows

oci.dll

Forwarding functions that applications link with

oraociei19.dll

Data and code

orannzsbb19.dll

Security Library

oraons.dll

ONS library used by OCI internally

oci.sym

oraociei19.sym

orannzsbb19.sym

Symbol tables

On Microsoft Windows, a .sym file is provided for each dynamic-link library (DLL). When the .sym file is present in the same location as the DLL, a stack trace with function names is generated when a failure occurs in OCI on Microsoft Windows.

In general, all OCI functionality is available to an application being run using the Instant Client, except that the Instant Client is for client-side operation only. Therefore, server-side external procedures cannot use Instant Client libraries.

For development you can also use the Instant Client SDK.

See Also:

2.2 Install from ZIP Files, from RPMs, and from Oracle Universal Installer

Oracle Instant Client can be installed in several ways.

The Instant Client libraries can be installed by either choosing the Instant Client option from Oracle Universal Installer or by downloading and installing either the ZIP files or RPMs from the OCI page on the Oracle Technology Network website: Oracle Instant Client.

The following sections describe different ways to download and Install the Instant Client Libraries from the Oracle Technology Network Website:

2.2.1 Installing from the ZIP files

This section describes how to install the Instant Client from the ZIP files.

  1. Download the desired Instant Client ZIP files. All installations require a Basic or Basic Light package.
  2. Run the following command to unzip the packages into a single directory such as /opt/oracle/instantclient_19_3 that is accessible to your application:
  3. Run the following command for versions prior to 18.3 to create the appropriate links for the version of Instant Client:
  4. Install the libaio package. This is called libaio1 on some Linux distributions.
    For example, on Oracle Linux, run the following command:
  5. If Instant Client is the only Oracle software installed on this system then run the following command to update the runtime link path:

    Alternatively, run the following command to set the LD_LIBRARY_PATH environment variable prior to running the applications:

    The variable can be added optionally to the configuration files such as ~/.bash_profile and to the application configuration files such as /etc/sysconfig/httpd.

  6. If you intend to co-locate the optional Oracle configuration files such as tnsnames.ora, sqlnet.ora, ldap.ora, or oraaccess.xml with Instant Client, then place them in the network/admin subdirectory. This needs to be created for 12.2 and earlier versions using the following command:

    This is the default Oracle configuration directory for applications linked with the Instant Client.

    Alternatively, Oracle configuration files can be placed in another accessible directory and then set the environment variable TNS_ADMIN to that directory name.

  7. To use binaries such as sqlplus from the SQL*Plus package, unzip the package to the same directory as the Basic package and then update the PATH environment variable as follows:
  8. Start your application.

2.2.2 Installing from the RPM files

This section describes how to install the Instant Client from the RPM files.

  1. Download the desired Instant Client RPM files. All installations require a Basic or Basic Light package.
  2. Run the following command to install the packages with yum:

    Note:

    Starting from version 19.3, by default only one version of the Instant Client RPM libraries can be installed at a time.

  3. For versions prior to 19, if Instant Client is the only Oracle software installed on the system, then run the following command to update the runtime link path:

    Note:

    For Instant Client 19.3 RPM packages, these commands are run automatically.

    Display clock on iphone. Alternatively, run the following command to set the LD_LIBRARY_PATH environment variable prior to running the applications:

    The variable can optionally be added to configuration files such as ~/.bash_profile and to the application configuration files such as /etc/sysconfig/httpd.

  4. If you intend to co-locate the optional Oracle configuration files such as tnsnames.ora, sqlnet.ora, ldap.ora, or oraaccess.xml with Instant Client, then place them in the network/admin subdirectory. This needs to be created for 12.2 and earlier versions using the following command:

    This is the default Oracle configuration directory for applications linked with the Instant Client.

    Alternatively, Oracle configuration files can be placed in another accessible directory and then set the environment variable TNS_ADMIN to that directory name.

  5. To use binaries tools package, use yum to install the package to the same directory as the Basic package and then update the PATH environment variable as follows:
  6. Start your application.

2.2.3 Installing from the Oracle Universal Installer

This section describes how to install Oracle Instant Client from the Oracle Universal Installer.

For installing Instant Client from Oracle Universal Installer, invoke the Oracle Universal Installer, select the Instant Client option and then install the Instant Client shared libraries to an empty directory, such as instantclient_19_3, for Oracle Database release 19c, version 19.3.

See Steps 5 and 6 in Installing from the ZIP files about setting the environment variables.

If you did a complete client installation (by choosing the Admin option in Oracle Universal Installer), the locations of the Instant Client shared libraries in a full client installation are:

On Linux or UNIX:

libociei.so library is in $ORACLE_HOME/instantclient

libclntsh.so.19.1, libclntshcore.so.19.1, and libnnz19.so are in $ORACLE_HOME/lib

On Windows:

oraociei19.dll library is in ORACLE_HOMEinstantclient

oci.dll, ociw32.dll, and orannzsbb19.dll are in ORACLE_HOMEbin

To enable running the OCI application using Instant Client, copy the preceding libraries to a different directory and then set the operating system shared library path to locate this directory.

Note:

All the libraries must be copied from the same Oracle home and must be placed in the same directory. Co-location of symlinks to Instant Client libraries is not a substitute for physical co-location of the libraries.

There should be only one set of Oracle libraries on the operating system Library Path variable. That is, if you have multiple directories containing Instant Client libraries, then only one such directory should be on the operating system Library Path.

Similarly, if an Oracle home-based installation is performed on the same system, then you should not have ORACLE_HOME/lib and the Instant Client directory on the operating system Library Path simultaneously regardless of the order in which they appear on the Library Path. That is, either the ORACLE_HOME/lib directory (for non-Instant Client operation) or Instant Client directory (for Instant Client operation) should be on the operating system Library Path variable, but not both.

To enable other capabilities such as OCCI and JDBC OCI, you must copy a few additional files. To enable OCCI, you must install the OCCI Library (libocci.so.19.1 on Linux or UNIX and oraocci19.dll on Windows) in the Instant Client directory. For the JDBC OCI driver, in addition to the three OCI shared libraries, you must also download OCI JDBC Library (for example libocijdbc19.so on Linux or UNIX and ocijdbc19.dll on Windows). Place all libraries in the Instant Client directory.

Note:

On hybrid platforms, such as Sparc64, to operate the JDBC OCI driver in the Instant Client mode, copy the libociei.so library from the ORACLE_HOME/instantclient32 directory to the Instant Client directory. Copy all other Sparc64 libraries needed for the JDBC OCI Instant Client from the ORACLE_HOME/lib32 directory to the Instant Client directory.

2.3 Environment Variables for Oracle Instant Client

The ORACLE_HOME environment variable no longer determines the location of NLS, CORE, and error message files.

An OCI-only application should not require ORACLE_HOME to be set. However, if it is set, it does not affect OCI. OCI always obtains its data from the Data Shared Library. If the Data Shared Library is not available, only then is ORACLE_HOME used and a full client installation is assumed. Though ORACLE_HOME is not required to be set, if it is set, then it must be set to a valid operating system path name that identifies a directory.

If Dynamic User callback libraries are to be loaded, then as this guide specifies, the callback package must reside in ORACLE_HOME/lib (ORACLE_HOMEbin on Windows). Set ORACLE_HOME in this case.

Environment variables ORA_NLS10 and ORA_NLS_PROFILE33 are ignored in the Instant Client mode.

Beginning with Oracle Database 12c Release 2 (12.2), when using Instant Client libraries, the Instant Client can use the ORA_TZFILE environment variable to read the time zone file from the file system when this environment variable is set. Otherwise, if the ORA_TZFILE variable is not set, then the larger, default, timezlrg_n.dat file from the Data Shared Library is used. If the smaller timezone_n.dat file is to be used from the Data Shared Library, then set the ORA_TZFILE environment variable to the name of the file without any absolute or relative path names. The file must be copied to subdirectory oracore/zoneinfo for (UNIX/LINUX) or oracorezoneinfo for (Microsoft Windows) in the instant client directory. You can use the genezi utility with the -v option to verify that the time zone file and location is valid or run SQL*Plus.

On Linux or UNIX:

On Windows:

In these examples, n is the time zone data file version number.

Be sure to create subdirectory oracore/zoneinfo for (UNIX/LINUX) or subdirectory oracorezoneinfo for (Microsoft Windows) where oracoei or oraociicus DLL's are located (typically in the instantclient_12_2 directory) and copy the timezone_n.dat file to this directory.

To determine the versions of small and large time zone files that are packaged in the Instant Client Data Shared Library, enter the following command to run the genezi utility:

If OCI is not operating in the Instant Client mode (because the Data Shared Library is not available), then ORA_TZFILE variable, if set, names a complete path name as it does in previous Oracle Database releases.

Oracle Client 11g For Mac

If TNSNAMES local naming parameters are used, then, as mentioned earlier, TNS_ADMIN directory must contain the TNSNAMES configuration files. If TNS_ADMIN is not set, then the ORACLE_HOME/network/admin directory must contain Oracle Net Services configuration files.

2.4 Database Connection Strings for Oracle Instant Client

All Oracle Net naming methods that do not require use of ORACLE_BASE_HOME, or ORACLE_HOME (to locate configuration files such as tnsnames.ora, sqlnet.ora, or oraaccess.xml) work with the Instant Client mode.

You can use the network/admin to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora, ldap.ora, or oraaccess.xml with Instant Client. Prior to release 18.1, the users had to create the network/admin directory manually.

See Database Connection Strings for complete information about database connection strings.

See Also:

Oracle Database Net Services Administrator's Guide chapter on 'Configuring Naming Methods' for more about connect descriptors

This section includes the following topic: Examples of Oracle Database Connection String Connect Identifiers.

2.5 SDK for Oracle Instant Client

The software development kit (SDK) is a set of development tools that allows the creation of applications can be downloaded from the Instant Client link URL on the Oracle Technology Network website:

  • The Instant Client SDK package has both C and C++ header files and a makefile for developing OCI and OCCI applications while in an Instant Client environment. Developed applications can be deployed in any client environment.

  • The SDK contains C and C++ demonstration programs.

  • On Windows, libraries required to link the OCI or OCCI applications are also included. Make.bat is provided to build the demos.

  • On UNIX or Linux, the makefile demo.mk is provided to build the demos. The instantclient_19 directory must be in the runtime library search path, for example LD_LIBRARY_PATH before linking the application. The OCI and OCCI programs require the presence of libclntsh.so and libocci.so symbolic links in the instantclient_19 directory. Beginning with Oracle Database 18c, version 18.1, Instant Client Basic and Basic Light ZIP files on Linux, Unix, and macOS now have the libclntsh and libocci symbolic links precreated.

  • The SDK also contains the Object Type Translator (OTT) utility and its classes to generate the application header files.

2.6 About Oracle Instant Client Light

The Instant Client Light version of Instant Client further reduces the disk space requirements of the client installation.

The size of the library has been reduced by removing error message files for languages other than English and leaving only a few supported character set definitions out of around 250.

This Instant Client Light version is geared toward applications that use either US7ASCII, WE8DEC, WE8ISO8859P1, WE8MSWIN1252, or a Unicode character set. There is no restriction on the LANGUAGE and the TERRITORY fields of the NLS_LANG setting, so the Instant Client Light operates with any language and territory settings. Because only English error messages are provided with the Instant Client Light, error messages generated on the client side, such as Net connection errors, are always reported in English, even if NLS_LANG is set to a language other than AMERICAN. Error messages generated by the database side, such as syntax errors in SQL statements, are in the selected language provided the appropriate translated message files are installed in the Oracle home of the database instance.

This section includes the following topics:

2.6.1 Globalization Settings

Instant Client Light supports the following client character sets:

Oracle 11g Client 32

Single-byte

  • US7ASCII

  • WE8DEC

  • WE8MSWIN1252

  • WE8ISO8859P1

Unicode

  • UTF8

  • AL16UTF16

  • AL32UTF8

Instant Client Light can connect to databases having one of these database character sets:

  • US7ASCII

  • WE8DEC

  • WE8MSWIN1252

  • WE8ISO8859P1

  • WE8EBCDIC37C

  • WE8EBCDIC1047

  • UTF8

  • AL32UTF8

Instant Client Light returns an error if a character set other than those in the preceding lists is used as the client or database character set.

Instant Client Light can also operate with the OCI Environment handles created in the OCI_UTF16 mode.

See Also:

Oracle Database Globalization Support Guide for more information about National Language Support (NLS) settings

2.6.2 Libraries for Oracle Instant Client Light

OCI applications, by default, look for the OCI Data Shared Library, libociei.so (or Oraociei119.dll on Windows) in the runtime library search path (for example LD_LIBRARY_PATH on Linux, or PATH on Windows) to determine if the application should operate in the Instant Client mode.

If the OCI Data Shared Library is not found, then OCI tries to load the Instant Client Light Data Shared Library (see Table 2-3 and Table 2-4), libociicus.so (or Oraociicus19.dll on Windows). If the Instant Client Light library is found, then the application operates in the Instant Client Light mode. Otherwise, a full installation based on Oracle home is assumed.

Table 2-3 Instant Client Light Shared Libraries Linux and UNIX

Linux and UNIXDescription for Linux and UNIX

libclntsh.so.19

libclntshcore.so.19

Client Code Library

libociicus.so

OCI Instant Client Light Data Shared Library

libnnz19.so

Security Library

libons.so

Oracle Notification Service (ONS) library

libmql1.so

Light Weight IPC Library

libipc1.so

Message Queue Light Library

Table 2-4 Instant Client Light Shared Libraries for Microsoft Windows

Microsoft WindowsDescription for Microsoft Windows

oci.dll

Forwarding functions that applications link with

oraociicus19.dll

Data and code

orannzsbb19.dll

Security Library

oci.sym

oraociicus19.sym

orannzsbb19.sym

Symbol tables

See Also:

Instant Client Shared Libraries for Linux and UNIX Table 2-1

Instant Client Shared Libraries for Microsoft Windows Table 2-2

2.6.3 Installing Oracle Instant Client Light

How can Instant Client Light can be installed.

Instant Client Light can be installed in one of these ways:

  • Installed from Oracle Technology Network (OTN)

    The following URL is the Instant Client page on the Oracle Technology Network website: Oracle Instant Client

    For Instant Client Light, download and unzip the basiclite.zip package in to an empty instantclient_12_2 directory.

  • Installed from an Instant Client Administrator installation

    From the ORACLE_HOME/instantclient/light subdirectory, copy libociicus.so (or oraociicus12.dll on Windows). The Instant Client directory on the LD_LIBRARY_PATH (PATH on Windows) should contain the Instant Client Light Data Shared Library, libociicus.so (oraociicus12.dll on Windows), instead of the larger OCI Instant Client Data Shared Library, libociei.so (oraociei12.dll on Windows).

  • Installed from an Oracle Universal Installer installation

    When you select the Instant Client option from the Oracle Universal Installer, libociei.so (or oraociei12.dll on Windows) is installed in the base directory of the installation, which means these files are placed on the LD_LIBRARY_PATH (PATH on Windows).

    The Instant Light Client Data Shared Library, libociicus.so (or oraociicus12.dll on Windows), is installed in the light subdirectory of the base directory and not enabled by default. Therefore, to operate in the Instant Client Light mode, the OCI Data Shared Library, libociei.so (or Oraociei12.dll on Windows) must be deleted or renamed and the Instant Client Light library must be copied from the light subdirectory to the base directory of the installation.

    For example, if Oracle Universal Installer has installed the Instant Client in my_oraic_12_2 directory on the LD_LIBRARY_PATH (PATH on Windows), then use the following command sequence to operate in the Instant Client Light mode:

    Note:

    To ensure that no incompatible binaries exist in the installation, always copy and install the Instant Client files in to an empty directory.

2.7 About Patching Oracle Instant Client Shared Libraries on Linux or UNIX

Because Instant Client is a deployment feature, the number and size of files (client footprint) required to run an OCI application has been reduced.

Hence, all files needed to patch Instant Client shared libraries are not available in an Instant Client deployment. A complete client installation based on Oracle home is needed for patching. Use the opatch utility for patching.

After you apply the patch in an Oracle home environment, copy the files listed in About Oracle Instant Client to the instant client directory, as described in Install from ZIP Files, from RPMs, and from Oracle Universal Installer.

Instead of copying individual files, you can generate Instant Client zip and RPM files for OCI and OCCI, JDBC, and SQL*Plus as described in Regeneration of Data Shared Library and Zip and RPM Files. Then, you can copy the zip and RPM files to the target system and unzip them as described in Install from ZIP Files, from RPMs, and from Oracle Universal Installer.

The opatch utility stores the patching information of the ORACLE_HOME installation in libclntsh.so. This information can be retrieved by the following command:

If the Instant Client deployment system does not have the genezi utility, you can copy it from the ORACLE_HOME/bin directory.

Note:

The opatch utility is not available on Windows.

2.8 Regeneration of Data Shared Library and Zip and RPM Files

The process to regenerate the data shared library and the zip and RPM files changed in Oracle Database 12c Release 1 (12.1).

Separate make file targets are used to create the data shared libraries, zip, and RPM files either individually or all at once. Currently, ilibociei builds only the zip and RPM files. Regeneration of data shared libraries requires both a compiler and linker, which may not be available on all installations. The sections that follow show the make file target used to regenerate data shared libraries, zip, and RPM files.

Note:

The regenerated Instant Client binaries contain only the Instant Client files installed in the Oracle Client Administrator Home from which the regeneration is done. Therefore, error messages, character set encodings, and time zone files that are present in the regeneration environment are the only ones that are packaged in the data shared libraries. Error messages, character set encodings, and time zone files depend on which national languages were selected for the installation of the Oracle Client Administrator Home.

Regeneration of the data shared library and the zip and RPM files is not available on Windows platforms.

This section includes the following topics:

2.8.1 Regenerating Data Shared Library libociei.so

The OCI Instant Client Data Shared Library (libociei.so) can be regenerated by using the following commands in an Administrator Install of ORACLE_HOME:

The new regenerated libociei.so is placed in the ORACLE_HOME/instantclient directory. The original existing libociei.so located in this same directory is renamed to libociei.so0.

2.8.2 Regenerating Data Shared Library libociicus.so

To regenerate Instant Client Light data shared library (libociicus.so), use the following commands:

The newly regenerated libociicus.so is placed in the ORACLE_HOME/instantclient/light directory. The original existing libociicus.so located in this same directory is renamed to libociicus.so0.

2.8.3 Regenerating Data Shared Libraries libociei.so and libociicus.so in One Step

To regenerate the data shared libraries libociei.so and libociicus.so, use the following commands:

The newly regenerated libociei.so is placed in the ORACLE_HOME/instantclient directory. The original existing libociei.so located in this same directory is renamed to libociei.so0.

The newly regenerated libociicus.so is placed in the ORACLE_HOME/instantclient/light directory. The original existing libociicus.so located in this same directory is renamed to libociicus.so0.

2.8.4 Regenerating Zip and RPM Files for the Basic Package

To regenerate the zip and RPM files for the basic package, use the following commands:

2.8.5 Regenerating Zip and RPM Files for the Basic Light Package

To regenerate the zip and RPM files for the basic light package, use the following commands:

2.8.6 Regenerating Zip and RPM Files for the JDBC Package

To regenerate the zip and RPM files for the JDBC package, use the following commands:

2.8.7 Regenerating Zip and RPM Files for the ODBC Package

To regenerate the zip and RPM files for the ODBC package, use the following commands:

2.8.8 Regenerating Zip and RPM Files for the SQL*Plus Package

To regenerate the zip and RPM files for the SQL*Plus package, use the following commands:

2.8.9 Regenerating Zip and RPM Files for the Tools Package

To regenerate the zip and RPM files for the tools package, use the following commands:

2.8.10 Regenerating Zip and RPM Files for All Packages

To regenerate the zip and RPM files for all packages, use the following commands:

The new zip and RPM files are generated under the following directory:

$ORACLE_HOME/rdbms/install/instantclient

Regeneration of the data shared library and the zip and RPM files is not available on Windows platforms.

Update, 2009:

Since I wrote this article in 2007 there have been new releases of Oracle (including 10g Express Edition for Linux),Parallels, VirtualBox, Mac OS and every flavour of Linux.Ubuntu has become a favourite desktop Linux, and is now supported by Oracle, including a convenient XE installation.Parallels Tools now provides file sharing for Linux, and Oracle provides pre-built VirtualBox demo VMs for download.Many of us who moaned about the lack of an Oracle version for Mac have found that we don't really need one after all.

I have not updated the document to reflect these changes.If you just want a quick and easy Oracle installation,have a look at Oracle Express Edition for Linux.You still have to increase the swap space as shown below, but otherwise the installer takes care of just about everything.

Introduction

Back in 2002, Oracle announced 9.2 Early Adopters' Edition for Mac OS 10.2. It was theoretically for OSX Server rather than the desktops and laptops we allwanted it for, you had to jump through a few hoops to get it working, it had no internal JVM, it didn't do Native Compilation, and SQL*Plus took up to tenseconds to connect. However, I had Oracle on my G3 iMac and that was pretty cool.

A couple of years later, out came 10g for Mac OS 10.3. This was a simpler install, everything worked, and we seemed to be getting somewhere.Unfortunately, there progress stopped. When Mac OS 10.4 came out, you could just about install 10g if youjumped through some more hoops - but soon there was a new range of Macs that ran on something called an 'Intel chip', and Oracle did not run on that.So from 2006 with the whole Apple range now running on Intel, there is no Oracle product for either the OS version or the hardware platform.

However, Parallels Desktop For Mac has been getting some great write-ups, as it makes use of the Mac'sshiny new Intel chip to run software compiled for Intel with almost native efficiency.A virtual database server even has some advantages, since you'll get a client-server setup that's similar to many commercial Oracle installations.It'll also be easy to experiment with configurations, and you can make a backup by simply copying the Parallels .hdd file.

Note about Howard Rogers/Dizwell links

Shortly after this article was written, Howard Rogers closed the Dizwell site.Unfortunately this article linked to some excellent animated installation guides that were there.These days (as of 2015), following a complete site overhaul, he is writing again and you can download his pre-built Centos/Oracle disk image fromwww.dizwell.com.

There are other easy-to-follow CentOS and Oracle installation guides about, for example Tim Hall's Linuxand Oracle installation guides on Oracle Base.

I hope the remainder of this article is still useful.

Overview

What we're going to do is:

  • Create a Parallels virtual machine.
  • Install CentOS, following Howard Rogers' CentOS installation guide for VMware (similar to Parallels).
  • Install Oracle, following Howard Rogers' Oracle installation guide for CentOS.
  • Install Oracle Instant Client For Mac OSX so we can have SQL*Plus in a Mac Terminal window, just like old times. (The Instant Client also includes JDBC and ODBC drivers etc.)
  • Optionally, we'll also set up iSQL*Plus, SQL Developer and anything else I can get working.

This will give us a virtual database server that will appear like another computer on the network. For most purposes we'll be able to connect to the database from the Mac,without having to log into CentOS at all.

Download the software

Parallels Desktop for Mac

Parallels Desktop for Maccosts $79.99 (£42) at the time of writing, although you can download a time-limited free trial.

Oracle Client 11g For Mac Installer

CentOS

You also need a guest OS capable of running Oracle.Many choose Windows for its convenience and the ability to use tools such as PL/SQL Developer or(if you must) TOAD.However, Redhat Linux is an Oracle-supported platform (2006's Oracle Unbreakable Linux is essentially Redhat with an Oracle badge),and CentOS is a free Redhat clone.You can buy CentOS on DVD (it's very cheap since you are only paying for the distribution costs) or download a disk image in .iso format.It's further complicated by a choice of versions (I chose CentOS 4.4 for i386), mirrors (I chose the 'actual country' download mirror site, in my case UK),formats (single DVD rather than multiple CD) and download methods (I chose Bittorrent). (Update: CentOS 5 is the current release as of Summer 2007.)

You can download Bittorrent free from www.bittorrent.com. With Bittorrent, you download a small control file such as CentOS-4.4-i386-binDVD.torrent, and open it in the Bittorrent application, which drives the actual download. I started it up and left it running overnight. (I'm told Bittorrrent can be extremely fast, but in my case it wasn't. If you have problems there is a lot of help on the Net.)

Oracle 10g

At the time of writing, this is Oracle Database 10g Release 2 Enterprise/Standard Edition for Linux x86 32 bit.There is no convenient way provided to share files between the VM and the host, although we can set up an NFS share later,which allows you to access Mac files directly from Linux.

Create a new Virtual Machine

Parallels' supplied help explains how to get this started. Essentially you create a new virtual machine (VM) using the 'Install OS' button, and follow the onscreen instructions.

  • Choose 'Custom OS installation' (Windows users get a handy Express option, but no such luck for Linux).
  • For the OS Type, choose Linux and Red Hat Linux (RHL is the same as CentOS for our purposes).
  • I gave it 756 MB of RAM (my iMac has 2 GB), and 15 GB (15360 MB) of disk space, selecting Plain rather than Expanding (it said it would run faster). You could make it bigger, but huge files are slower to back-up, copy and so on. (However, if you install Application Express you will need at least 936 MB of memory, and a bit more disk space.)
  • For the hard disk image file location, I chose a spot on my Firewire drive (a subfolder per VM is a good idea).
  • For networking, choose 'Bridged Ethernet' (see 'Networking for Dummies' box, below).
  • 'Default adaptor' will do (this lets it choose between Ethernet or Airport automatically), or just pick Ethernet.
  • Give the VM a name. This is the name within Parallels, not the CentOS hostname.
  • Select 'ISO file' for the installation media, and show it the CentOS .iso file you downloaded earlier. Hit 'Finish' and be prepared for a ten minute wait while it formats 15GB of disk space.

Install CentOS

Follow Howard Rogers' guide to installing CentOS 4.

Note however that this is written for VMware on Windows, and the networking set-up steps are subtly different in Parallels for Mac. (Those who are already familarwith this stuff will take it in their stride, but the rest of us may need to look at Networking for Dummies, below.)

Resist the urge to use the CentOS 'Up2Date' tool in the top right corner to get all the CentOS system tools up to date, at least until you have installed Oracle and made a backup(i.e. copied the .hdd file - or in Parallels 3.0, created a snapsot).For example some system libraries may be altered or renamed by an upgrade, and you'll have to start tweaking installer scripts to get them to work, without really knowing what effect the changes had.

Note that 'Parallels Tools' are currently only available for Windows, OS/2 and Solaris, and not for CentOS. This isn't a big deal, but just means we don't get aconvenient way to switch context or copy and paste between the Mac and the VM.(NoMachine NX Client is worth a look, although I haven't tried it myself. I'll update this document if I do.)

There is also no way provided to share files between the VM and the host, but you can set up an NFS share. To keep this installation guide simple, I have written a separateNFS setup guide. (If you are not familiar with the networking involved, you may want to read 'Networking for Dummies', below,before tackling NFS.) With NFS in place, you can download and unzip the Oracle software to the Mac, rathr than having to download it separately withinany VM you create.

It may also be an idea to add some extra swap space, depending on how much memory you gave the VM. For example to add 512MB, execute the following commandswith root privileges (either become the root user first using the command su -, or place sudo in front of each command and enter your own password when prompted):

  • dd if=/dev/zero of=/etc/extraswap bs=1M count=512
    mkswap /etc/extraswap
    swapon /etc/extraswap
  • Edit /etc/fstab to include the line:
    /etc/extraswap swap swap defaults 0 0
  • After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free -m (the '-m' option makes it display in megabytes).

Networking for Dummies

Parallels provides three Network Adapter options, which represent the different ways the VM can connect to the local network.The static IP address will depend on the network adaptor we select.(You can easily change it later, so feel free to experiment.)

  • Bridged Ethernet: the VM becomes a peer of the Mac. They will be in effect two machines sharing a common network gateway, which means their IP addresses must be in the same range. I'll be using this option.
  • Host-only Networking: the VM becomes a client of the Mac. It can only see (and be seen by) its host machine, and won't have Internet access. Its IP address should be in the same range as 'Parallels Host-Guest' (see screenshot below).
  • Shared Networking (Network Address Translation): the VM and the Mac will appear as a single machine. Parallels recommend this for a quick and easy general purpose set-up, but it is not ideal for a database server.

At the Network Configuration screen in the CentOS installer, the default setting is to use DHCP. You do not want to use this.DHCP (Dynamic Host Configuration Protocol) is great at automating network configuration,but because it dynamically hands out temporary IP addresses, any Oracle utility you configure by specifying the IP address will break sooner or later at the whim of DHCP.

In VMware on Windows (as in Howard's guide) you would check the VMware settings to find the VM's name on the network, such as'VMnet1', type ipconfig in a cmd window to see VMnet1's IP address, and use that information to pick a new static IP address back in the CentOSinstaller. However, this is where VMware and Windows differ from Mac OSX and Parallels. OSX does have an 'ipconfig' command, but it's a rather different beast and requiresa bunch of additional parameters depending on what type of information you are interested in.

The related command ifconfig gives me output like this (I've changed a few random values in case any hackers are reading this):

The label on the left identifies the network device, in this case en0, the Mac's Ethernet connection(I used the -u en0 option so it only shows en0, and not Airport or my Firewire drive)and it's telling me that its address is 10.0.1.2 and the subnet mask is 255.255.255.0 (shown in hexadecimal as ff ff ff 00).

Alternatively, open System Preferences, Network, and look at the 'Network Status' page: you may see an entry something like this (depending on your network connection of course),which tells me that my Mac's internal IP address is10.0.1.2:1This is behind my firewall - when I connect to a public Internet website I will appear to have a different address, set by my ISP.

If you are on wi-fi it's even easier - Option-click the Wi-Fi symbol in the menu bar.

The two Parallels entries below it apply to Host-Only Networking and Shared Networking. Since I'm not using either of these right now they are not relevant.The new static address I'm going to use for CentOS will be of the form 10.0.1.xxx; that is, matching the Mac's address but with a different number in the finalslot.2 If we were using Host-only Networking as in Howard's example, we would read the 'Parallels Host-Guest' address from the 'System Preferences, Network' screen, and choose an address in the same range, for example 10.37.129.10.

The two other pieces of information you will need are the addresses of the DNS server and the default gateway(in my case the router, although in some setups it could also be a proxy server). DNS looks up names such as 'williamrobertson.net' and translates them into IP addresses.On home setups it's common for the DNS server and router to share the same address (but don't count on it).There are various ways to find this information, but the easy way to find the router address isby selecting 'Built-in Ethernet' in the 'System Preferences, Network' screen above. Here, my router is at 10.0.1.1 and my subnet mask is 255.255.255.0:

Yet another way, which also tells you the DNS address, is using the command ipconfig getpacket en0:

The line with 'server_identifier' shows the gateway address, and the one with 'domain_name_server' shows the DNS address. In this case they are both 10.0.1.1.

The CentOS installer applies these settings for you, but you can edit them later in the CentOS 'System Settings, Network' screen:

Install Oracle

If you set up NFS, then you can download and unzip Oracle on the Mac, into a directory you share using NFS(www.oracle.com, Downloads, look for Database 10g for Linux, 32 bit).3 While it's downloading, it might be a good time to install your favourite Firefox bookmark synchronisation service - I use Foxmarks. Then within CentOS you can simply cd to that directory and execute ./runInstaller.Otherwise, you'll have to download Oracle from inside CentOS.You might as well also download the Oracle Database 10g Companion CD while you're at it (672 MB) if you are going to want to install Application Express later.

There isn't much I can add to Howard Rogers' guide to installing Oracle 10g Release 2 on Centos 4.3 & 4.4.Follow that. It'll work.

I also added the following to /etc/bashrc for a more friendly prompt:

This sets the prompt as the current directory name, in bold.

OEM has to be started manually:

Howard suggests editing /etc/rc.d/init.d/dbora (the database startup script called during the boot process) to have itstart up OEM. I had mine start up iSQL*Plus (see below) as well. I added the following lines to the 'start' section:

Note the URL displayed on the command line when you call emctl, which is http://hostname:1158/em/console/aboutApplication, where hostname is the name you set when installing Centos.You can actually control-click this URL and it will load in Firefox.However, it is rather more useful to be able to do this from the Mac.

Add an entry to the Mac's /etc/hosts file to map a name to the address, for example:

Now we can enter the Enterprise Manager URL into a browser, and behold the moment of truth:

Back on the Mac - SQL*Plus, gqlplus, SQL Developer etc

Oracle 10g Instant Client for Mac OS X

Although the RDBMS software itself won't run on Intel Mac, it turns out that SQL*Plus does.The client software will also allow other applications to connect to the database.

  • Find 'Macintosh OSX' and download both the Basic and SQL*Plus packages from the Instant Client downloads page.
  • Move the contents of both into a single convenient folder (I used /Applications/Application_folders/instantclient).
  • Add the location to your PATH variable, and also set DYLD_LIBRARY_PATH to point to it; for example:
  • Fire up SQL*Plus, using the fully-qualified host and service names:
  • Here's a rather basic shell script for starting SQL*Plus. Save the following in convenient directory and name it sql. (If you're worried that someone might snoop your password by entering ps -auxU williamr grep sqlplus, or if you want to allow for multiple VMs, it'll take a bit more work). A marginally more flexible version is here. (It assumes you have gqlplus - see below.)

gqlplus

This gives a better SQL*Plus command-line experience (or should do). To quote the documentation:

gqlplus is a UNIX front-end program for Oracle command-line utility sqlplus. gqlplus is functionally nearly identical to sqlplus, with theaddition of command-line editing, history, table-name and optional column-name completion. The editing is similar to tcsh and bash shells.

Unfortunately I've found gqlplus isn't perfect - for example if you edit the current buffer by typing ed (with _EDITOR defined as vim or whatever)it wrecks the formatting by stripping all the leading spaces, and also strips any trailing semicolons, thus wrecking PL/SQL.ed also doesn't recognise the ORACLE_PATH environment variable and therefore doesn't find my scripts, although mysteriously they run fine.Maybe this is a configuration issue and as usual I'm just missing something. I'll update this page if I figure out how to fix it. Even so, it's a handy thing to have.

You can install it in CentOS if you like, but it'll run in a Mac Terminal window. You need the Oracle Instant Client set up first as it will look for a sqlplus executable.

  • Download gqlplus (zipped tarfile). The instructions tell you how to unzip (gunzip filename) and untar (tar -xvf filename), but this is a Mac and I let Firefox do it for me.
  • The download includes a README file with installation instructions, but essentially you open a Terminal window, cd to the unzipped gqlplus directory, and enter:

Now you can call gqlplus in place of sqlplus. It seems to take a little longer to start up, but it's worth it for the ability to scroll back throughprevious commands as you can on Windows.You could call this using a slightly modified version of the above script, sql.

iSQL*Plus

Although the server process is started by default when you create the database, it will need to be restarted any time you restart the database.Enter the following command in CentOS, as the oracle user:

One annoyance I've found with iSQL*Plus is that the font for the work area is the default proportional one, which (fairly obviously, I would have thought) isunsuitable for entering code. However, if you view the source of the page you can find the name of the stylesheet, which is

4For Internet Explorer it is blaf-A0-en-ie-5-macos.css. The 'mozilla' one appears to be the default and is used in non-Mozilla based browsers such as Safari and Shiira.You can edit this file, and add the following lines at the end (while I'm at it I'll also make any DBMS_OUTPUT text monospace):

You can alter the session timeout interval from its default of 15 minutes by editing$ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/isqlplus/isqlplus/WEB-INF.

Note also that the traditional glogin.sql in $ORACLE_HOME/sql/admin is read by iSQL*Plus on startup and reconnection,so you can add things like set serveroutput on size unlimited here. (The documentation suggests that'Some privileged connections may generate errors if SET SERVEROUTPUT or SET APPINFO commands are put in the Site Profile or User Profile', although I'm not sure whatsort of errors it means, or whether they are severe enough to offset the benefit of not having to retype the command manually each time.)

Anyway, once the server process is running, enter http://hostname:5560/isqlplus in your browser (substituting your VM's hostname).iSQL*Plus is documented in the SQL*Plus User's Guide and Reference.

SQL Developer

Download from www.oracle.com/technology/products/database/sql_developer.A ready-to-run Mac OSX binary is provided (SQLDeveloper.app). I must admit I was expecting some clunky Windows Java port, but I was pleasantly surprised.The Preferences are in the wrong place, but apart from that it's looking a lot like a real Mac application. Nice job, guys!More resources are available on the official SQL Developer mini-site.I won't repeat the 'Getting Started' instructions here, as it's just a case of clicking on the icon.

Application Express

Simple, you might think

Start at the Application Express home page,which has many useful links including the download page,which in turn leads to the installation guide.

Essentially there are three steps:

  1. Install Oracle HTTP Server (also referred to as 'Apache Standalone'), a lightweight web server, from the Companion CD (not actually a CD, but a zipped download).
  2. Run SQL*Plus script apexins.sql as SYS to install the database objects (this will create two schemas, with various tables, packages, public synonyms etc).
  3. Work through the Post-Installation Tasks in the installation guide, such as setting up a marvel.conf and starting the Oracle HTTP Server.

However in practice things were not quite so straightforward.

Some installation gotchas

  • Do not use the Companion CD to install Apex. Only use it to install Oracle HTTP Server.

    The Companion CD Release 2 available on the 10g (10.2.0.1) database download page at the time of writing (February 2007) claims to include two versions of Application Express, 'Oracle Application Express v2.2.1' and 'Oracle Application Express (formerly HTML DB) v2.0'. Once you've run the supplied installer, however (which gives you no such choice), the 'Installed Products' list displays 'Oracle HTML DB 10.2.0.1', and actually seems to have installed 1.6.5 There may be a better way to check your Apex version, but the installer creates two user accounts, FLOWS_FILES and FLOWS_n, where n represents the version number. These accounts are listed at the end of the intaller log. In my case the initial install gave me FLOWS_016000, indicating version 1.6.
    After dropping both accounts with DROP USER CASCADE and running apexins.sql from a more recent Application Express download, I have a new FLOWS_020200 account.

  • In the Installation Requirements section it says the shared_pool_size of the target database must be at least 100 MB, and suggests entering show parameter shared_pool_size at the SQL*Plus prompt to check the current setting. However, 10g uses Automatic Shared Memory Management by default, which means shared_pool_size will be shown as 0. My sga_target is 252 MB. Does that mean I can forget about it and carry on?

    Not quite. sga_target specifies the total size of all SGA components, of which the Shared Pool is only one. You should therefore follow the installation guide's instructions and set shared_pool_size to 100 MB - under Automatic Shared Memory Management this will become the minimum size. (The actual size can be found in V$SGA_DYNAMIC_COMPONENTS.)

  • When running the installer for the Companion CD, it mentions that it needs to go in a separate Oracle Home, but then prompts you with the current one. (If you just hit 'OK' it tells you that you can't use that one.) What should I put?

    Oracle's official directory structure, the Optimal Flexible Architecture, would give you something like this:

    There is some debate about how suitable this is for small installations where all this /u01/app/oracle/product business is somewhat redundant. Perhaps I'm missing something as I'm not a DBA, but I prefer something like this:

    Or perhaps (since Oracle HTTP Server is independent of the database release):

    However, by this point I'd already defined the database home as /oracle/10g when installing the database, so I put the new home at /oracle/10g_http. It's not really ideal and now it's hard to change, as the installer hardcodes it in a large number of config files. Damn.

  • Next, the installer prompts for database details including the service name. I enter it but it fails to connect. You need to enter the fully qualified name - not simply dev10g (in my case), but dev10g.starbase.local.
  • When running the apexins.sql script, you can specify a tablespace name which will become the default tablespace for the new Apex schemas. If you want to create a new one rather than relying on the default SYSAUX, the command is as follows (adjust if your file layout is different):

    This will create a 100 MB tablespace called 'APEX' that autoextends to up to 250 MB if it later runs out of space.

    Then I specified APEX as the tablespace name when callling the script (see the installation guide). Afterwards there were 681 rows in DBA_SEGMENTS (mostly owned by FLOWS_020200) with a combined size of 84 MB, all in the new tablespace.

  • In Post-Installation Tasks, the installation guide mentions copying a directory named apex/images to a location specified in marvel.conf. However, there is no file named marvel.conf yet unless you installed via the Oracle Installer (which as you'll recall we're not using, as it would install the wrong version). Later on, the guide explains that you may have to create your own file, and explains how. However, the sample file shown in the document contains the line:

    but there is no such package - it should be:

  • Also when setting the 'images' path in marvel.conf, be sure to include a '/' (forward slash) character at the end, for example: Alias /i/ '/oracle/10g_httpclient/Apache/Apache/images/'
  • If the shell variable LANG is set in the environment from which you start the Oracle HTTP Listener, it can cause some sort of conflict in mod_plsql resulting in an ORA-00604 error, and Apex fails to load at all. I'm afraid I didn't have the patience to get to the bottom of this, but when $LANG had the (default) value en_GB.UTF-8 it failed, and unsetting it with unset LANG before restarting the HTTP server solved the problem.
  • As a final post-installation step, add a line to the startup script to launch Oracle HTTP Server whenever the database is started:

Free alternatives to Parallels

  • VirtualBox: recommended by Lifehacker.