Installing Oracle instantclient basic and instantclient sqlplus on win32

Sometimes basic things like installing the latest Oracle instantclient on the PCs of all of your developers can take considerable time. I typically setup a dedicated DBA Portal website wherever I work and then write up instructions for repetitive things like these. It’s all about – do it once and forget it. Here’s the copy of the writeup I did to install the latest 11g Oracle instantclient basic and instantclient sqlplus on win32:

Download Software

Go to Instant Client Downloads for Microsoft Windows (32-bit) download page:

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html

And download basic-win32 and sqlplus-win32 files to your PC (for example):

  • instantclient-basic-win32-11.1.0.7.0.zip
  • instantclient-sqlplus-win32-11.1.0.7.0.zip

Create Oracle Directory

Create a C:\oracle directory on your C drive (if you don’t already have one) and move both files into C:\oracle.

Unzip both files

  1. first unzip instantclient-basic-win32-11.1.0.7.0.zip
  2. then unzip instantclient-sqlplus-win32-11.1.0.7.0.zip

to unzip:

  • right click on file
  • point to WinZip
  • Click Extract to here …

End result should be a new folder called instantclient_11_1 in your C:\oracle:

instantclient_11_1

Setup your system %PATH% and %TNS_ADMIN% variables

  • In Windows explorer LEFT pane, right click on My Computer icon and click Properties
  • Click Advanced tab
  • Click Environment variables button:

Environment variables button

In the System Variables panel select Path variable and click Edit button:

System Variables/Path

In the Variable Value field paste the following: C:\oracle\instantclient_11_1. Make sure it’s before all other path values that point to your OLD Oracle clients, then clickOk

Variable Value

Now find a variable called TNS_ADMIN – it could be in either panel (System / User), if you don’t have such variable, create it in the User panel by clicking New:

Variable Name: TNS_ADMIN
Variable Value: C:\oracle\instantclient_11_1

Click Ok

TNS_ADMIN Variable Win

  • Now click Ok on the Environment Variables screen
  • and click Ok on the System Properties window to close it

Setup tnsnames.ora file

If you already have an existing copy of tnsnames.ora file then place it to:

C:\oracle\instantclient_11_1

If you don’t – then create a new tnsnames.ora file, for example:

XRACQ_MYSERVICE_TAF =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vip-qarac1)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = vip-qarac2)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = vip-qarac4)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = vip-qarac3)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XRACQ_MYSERVICE_TAF.domain.com)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )

Test 11g client by running sqlplus

  • Open a new CMD window by going to Start->Run
  • In the Run Window type in: cmd and press Ok:

in the CMD window’s prompt – enter the following: sqlplus user/pass@TNS_ALIAS where:

user:      is the database username given to you by the DBA
pass:      is the database password given to you by the DBA
TNS_ALIAS: The alias you setup in the tnsnames.ora file

example:

C:\>sqlplus xxx/xxxxxxxx@XRACQ_MYSERVICE_TAF

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Aug 26 16:24:23 2009

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL>

Known Errors:

If you get the ORA-12705 error while running sqlplus:

C:\>sqlplus xxxxxx/xxxxxxxx@xxxxxxxxxxx

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Aug 26 16:58:33 2009

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

ERROR:
ORA-12705: Cannot access NLS data files or invalid environment specified

Enter user-name:

Here’s the solution:

To fix the ORA-12705: Cannot access NLS data files or invalid environment specified error, go to your registry editor (run regedit from Start->Run) and then:

  • Navigate to Windows Registry in \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
  • Remove the NLS_LANG from there (select it and delete)

Re-run the sqlplus test to make sure it works (you will need to open a new CMD window for the registry changes to take place).

Bonus PDF

If you’d like to get a copy of this article in an easy to share PDF – please sign up for my newsletter – Confessions of an Oracle DBA where I share tips, scripts and tricks I’ve learned during almost two decades in the tech field as an Oracle DBA:

SUBSCRIBE

Additional Resources

  1. If you have any additional questions please join our Oracle DBA Community and post them there.
  2. And if you need any further Oracle DBA help – I can be reached at: http://www.hashjoin.com/contact

End.

August 26, 2009

Posted In: Operations

Tags: , , ,