Once you have the client installed, go ahead and create tnsnames.oraΒ for your server connection under '/Applications/oracle/product/instantclient_64/network/admin'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORACLE12C = | |
(DESCRIPTION = | |
(ADDRESS = (PROTOCOL = TCP)(HOST = myoracle12c.senecacollege.ca)(PORT = 1521)) | |
(CONNECT_DATA = | |
(SERVER = DEDICATED) | |
(SERVICE_NAME = oracle12c) | |
) | |
) |
Modify your .bash_profileΒ to store environment variables:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ORACLE_HOME="/Applications/oracle/product/instantclient_64" | |
export PATH=$ORACLE_HOME/bin:$PATH | |
export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib | |
# Set ORACLE_PATH to the location where you store your custom "login.sql" | |
export ORACLE_PATH="/Applications/oracle/product/instantclient_64/sqlplus/admin" | |
alias sqlplus='rlwrap sqlplus' |
Then you can create your own startup script, e.g.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET PAGESIZE 100; | |
SET LINESIZE 100; | |
define_editor='vi'; | |
SET SERVEROUTPUT ON; | |
SET VERIFY OFF; |
Last, add the following command to your .bashrc to skip error command not found: sqlplus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add it to the end of your .bashrc as start-up command | |
source ~/.bash_profile |
Note:
If you face Error ORA-21561: OID generation failed
when connecting to Oracle with a Mac, edit your hosts file to append local computer name to the end of the 127.0.0.1 line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost <local_computer_name> | |
255.255.255.255 broadcasthost |
π