Install SQLPlus and Oracle Client on the MAC OS

Install SQLPlus and Oracle Client on the MAC OS

 

Install SQLPlus and Oracle Client on the MAC OS

Note: In this example we will be installing Oracle Client release 11.2.0.4 64bit

Download the files on Oracle’s site

instantclient-sqlplus-macos.x64-11.2.0.4.0.zip

instantclient-basic-macos.x64-11.2.0.4.0.zip

Be sure to download the following files:

Instant Client Package – Basic

Instant Client Package – SQL * Plus

Extract the files and create an appropriate folder structure

Open Terminal and “unzip” files downloaded

$ Unzip -qq instantclient-basic-macos.x64-11.2.0.4.0.zip

$ Unzip -qq instantclient-sqlplus-macos.x64-11.2.0.4.0.zip

Note: the argument “-qq” tells “unzip” utility to run without screen display. By default the files are extracted into a single directory, after we create well structured directories to keep these files organized. NOT create directory structure the graph, but all the Terminal.

$ Sudo mkdir -p /Applications/oracle/product/instantclient_64/11.2.0.4.0/bin

$ Sudo mkdir -p /Applications/oracle/product/instantclient_64/11.2.0.4.0/lib

$ Sudo mkdir -p /Applications/oracle/product/instantclient_64/11.2.0.4.0/jdbc/lib

$ Sudo mkdir -p /Applications/oracle/product/instantclient_64/11.2.0.4.0/rdbms/jlib

$ Sudo mkdir -p /Applications/oracle/product/instantclient_64/11.2.0.4.0/sqlplus/admin

$ Sudo mkdir -p /Applications/oracle/product/instantclient_64/11.2.0.4.0/network/admin Then move the files to these directories as follows:

$ Cd instantclient_11_2 $ sudo mv * ojdbc /Applications/oracle/product/instantclient_64/11.2.0.4.0/jdbc/lib/

$ Sudo mv x * .jar /Applications/oracle/product/instantclient_64/11.2.0.4.0/rdbms/jlib/

$ Sudo mv glogin.sql /Applications/oracle/product/instantclient_64/11.2.0.4.0/sqlplus/admin/

$ Sudo mv * * dylib /Applications/oracle/product/instantclient_64/11.2.0.4.0/lib/

$ Sudo mv * README /Applications/oracle/product/instantclient_64/11.2.0.4.0/ $ sudo mv * /Applications/oracle/product/instantclient_64/11.2.0.4.0/bin/

Create the file “tnsnames.ora” defining the necessary connections

Copy or create the file “tnsnames.ora” in the destination directory: /Applications/oracle/product/instantclient_64/11.2.0.4.0/network/admin/ Example file contents “tnsnames.ora”

database_name =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = xxxx) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = instance)
)
)

Set environment variables

Create or edit the file “.bash_profile”

$ Cd / Users / UserName

$ Vi ~ / .bash_profile

Note: If the file already exists, simply add these lines at the end of the file. If the file does not exist you must create it and include the following lines.

# Oracle client
export ORACLE_HOME = “/ Applications / oracle / product / instantclient_64 / 11.2.0.4.0”
export PATH = $ ORACLE_HOME / bin: $ PATH
export DYLD_LIBRARY_PATH = $ ORACLE_HOME / lib
# Oracle client

Note: To recharge the profile, run the following command: $ source ~ / .bash_profile Assuming the file “tnsnames.ora” is set up correctly, you can now connect to the desired database.

Connecting with SQLPlus

$ Sqlplus username / password @ database_name

 

Back to previous menu