I don’t know if you have experienced this before. You have a Mac but you want to use SQLPLUS, however, SQLPLUS is not working on your Mac. Let me tell you step by step how to make it work.
1. Go to Oracle website, download Oracle Instantclient package for your Mac. Make sure you download the correct bit version. There are two folders you need to download. One is the basic file (looks like " instantclient-basiclite-macos.x32-11.2.0.4.0.zip"), the other one is the SQLPLUS package.
2. Merge your files inside two folders into one, I normally merge everything into my oracle instant client folder. After you did that, you are actually not quite done yet, Oracle only provide the basic need in those two folders, there are actually two more folders missing. One is called network, one is called SDK, without those two folders you can’t make Oracle SQLPLUS run at all. The network folder is quite easy to make, you just need to make a folder called network, inside network folder, create another folder called admin, under admin folder create a file named “tnsnames.ora”, inside that file make sure you put in your server information, as follows:
SERVERNAME = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = host_string)(PORT = your own port number)) ) (CONNECT_DATA = (SERVICE_NAME = your own service name) ) )
All the orange text needs to be replaced by your own server’s information.
About the SDK folder. There are a lot of them, if any of you guys need it, please let me know. I can email it to you.
3. Open a terminal, type in the following command:
cd /usr/local/ (this is for directing to your local folder) then enter key
mkdir local (make a local directory, it is for matching the path) then enter key
cd local then enter key
mkdir oracle (make a directory called oracle) then enter key
open oracle (to open “oracle” folder) then enter key
paste in your oracle instant client folder you just merged together, in my case , mine is called “instantclient_10_2”
cd (go back to your home directory) then enter key
vim .bash_profile then enter key
press “i” in order to edit under vim environment
then paste the following export lines:
#Sets the location for oracle instant client
export ORACLE_HOME="/usr/local/oracle/instantclient_10_2"
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export SQLPATH=$ORACLE_HOME export TNS_ADMIN=$ORACLE_HOME
export PATH="$ORACLE_HOME:$PATH"
then press esc to get out of editing mode, then type in “:wq” to write and quit.
4. After that you need to fix your path to make “sqlplus” command line could be found in your computer environment. This is a little bit complicated. Take a deep breath, we got this! In your terminal, type in the following command:
“source ~/.bash_profile” then enter
“echo $ORACLE_HOME” then enter
“ln -s /opt/oracle/instantclient/sqlplus /usr/local/bin/sqlplus” then enter
5. Actually after you got here, you are done.
6. In order to connect to sqlplus client, all you need to do it type in “sqlplus your_username@server_name” then entry key, after that, the system is going to ask you about password.
7. NOW YOU ARE CONNECT!!!!
Please let me know if you have any questions on that. I would be loving to help out all the time!