Tips: Minimum install for Oracle

I'm working currently from my six year old laptop. I needed access to Oracle but I don't have much space, here's what I figure out.

Download Oracle Instant Client, which I found at:
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html

To complete the install you'll need to register with Oracle (it's free), if you haven't already.

Unzip the files into c:\oracle, total size about 84 meg.

Modify your PATH environment variable to point to c:\ORACLE.

Add TNS_ADMIN environment variable to point to C:\ORACLE.

Create a text file called C:\ORACLE\SQLNET.ORA with the following contents:
NAMES.DEFAULT_DOMAIN = world
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
Create (or copy from someplace) a text file called c:\ORACLE\TNSNAMES.ORA with contents like:
ABC123.WORLD=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(COMMUNITY= tcp.world)
(PROTOCOL= tcp)
(HOST= site.com)
(PORT= 1521)
)
)
(CONNECT_DATA= (SID= abc123))
)
Now, in my minimum install I'm going to use Python, so I'll need cx_Oracle.

Write a program like this (say select.py):
import cx_Oracle

aTSN = 'abc123'
user = 'scott'
password = 'tiger'
conn = cx_Oracle.connect(user, password, aTSN)

cur = conn.cursor()

cur.execute("SELECT * from MYTABLE")
for row in cur:
print row


From what I've gathered cx_Oracle uses the oci.dll which is found via the PATH environment variable. This dll looks at TNS_ADMIN and loads up the SQLNET.ORA file looking for NAMES.DIRECTORY_PATH line, which basically says to use TNSNAMES. Then it knows to look for TNSNAMES.ORA in the same directory and parse that.
Piece of cake.

Comments

Anonymous said…
...molte, molte, molte grazie.

Cosimo

Popular posts from this blog

Shortest Sudoku solver in Python

Key-Train Launched