Setting the environment variable in files like .bash_profile won't work (unless you launch the application from the terminal) because in OSX the applications are not started as in other UNIX'es, they don't inherit the parents shell variables.
Applications like Oracle JDeveloper for mac also don't work by just setting .bash_profile. The only way is to edit /etc/launchd.conf to contain a line like this: "setenv VAR value" and then reboot the system.
Showing posts with label os x. Show all posts
Showing posts with label os x. Show all posts
Sunday, March 1, 2009
Monday, July 21, 2008
Sqlplus on a Mac with Oracle Instant Client
One of the things any Oracle developer uses is sqlplus, but getting it to work on Mac OS-X is not quite as easy as on Windows. Follow these steps to install sqlplus on your Mac.
1. Download the Oracle Instant Client Zip files:
3. Move the directory to where you want it. I put mine in /usr/local/oracle/instantclient_10_2.
4. Then go to this directory and make symbolic links for dynamic libraries.
5. I reccomend creating a tnsnames.ora file where you add all your connection details. I placed mine in /usr/local/oracle/network/admin.
Example of a tnsnames.ora file:
6. Then you need to set up necessary environment variables. I added mine to my .bash_profile script so they are alway's set when I run the terminal.
In your home folder you can type:
And then add the following lines at the end of the file (Make sure you set the PATH correctly otherwise sqlplus won't run):
7. You should now be able to run sqlplus. Close the terminal and re-lunch it. Now run:
8. Sqlplus should now run and look something like this:
1. Download the Oracle Instant Client Zip files:
- Instant Client Package - Basic
- Instant Client Package - SQL*Plus
- Instant Client Package - JDBC Supplement (Optional)
- Instant Client Package - SDK (Optional)
| unzip instantclient-basic-macosx-10.2.0.4.0.zip unzip instantclient-sqlplus-macosx-10.2.0.4.0.zip unzip instantclient-jdbc-macosx-10.2.0.4.0 #Optional unzip instantclient-sdk-macosx-10.2.0.4.0 #Optional |
3. Move the directory to where you want it. I put mine in /usr/local/oracle/instantclient_10_2.
| sudo mkdir /usr/local/oracle/ sudo mv instantclient_10_2 /usr/local/oracle/ |
4. Then go to this directory and make symbolic links for dynamic libraries.
| sudo ln -s libclntsh.dylib.10.1 libclntsh.dylib sudo ln -s libocci.dylib.10.1 libocci.dylib |
5. I reccomend creating a tnsnames.ora file where you add all your connection details. I placed mine in /usr/local/oracle/network/admin.
Example of a tnsnames.ora file:
| IDENTIFIER = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = userid.myhosteddb.net)(PORT = 1521)) ) (CONNECT_DATA = (SID = odb)) ) |
6. Then you need to set up necessary environment variables. I added mine to my .bash_profile script so they are alway's set when I run the terminal.
In your home folder you can type:
| vi .bash_profile |
And then add the following lines at the end of the file (Make sure you set the PATH correctly otherwise sqlplus won't run):
| export DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient_10_2" export SQLPATH="/usr/local/oracle/instantclient_10_2" export TNS_ADMIN="/usr/local/oracle/network/admin" export NLS_LANG="AMERICAN_AMERICA.UTF8" export PATH=$PATH:$DYLD_LIBRARY_PATH |
7. You should now be able to run sqlplus. Close the terminal and re-lunch it. Now run:
| sqlplus [username]/[password]@[service] |
8. Sqlplus should now run and look something like this:
Subscribe to:
Posts (Atom)
