1.下載Oracle Client Package .
從http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html下載
Instant Client Package – Basic包( 標(biāo)注:All files required to run OCI, OCCI, and JDBC-OCI applications)這里下載的是Version 11.2
2.本地保存Oracle Client Package:
創(chuàng)建文件夾,比如oracle_client,將下載的文件加壓縮到此文件夾里.(筆者目錄: D:\oracle_client\instantclient_11_2)
3.在當(dāng)前目錄下,新建立兩個(gè)文件,,sqlnet.ora和tnsnames.ora然后再手動(dòng)配置sqlnet.ora和tnsnames.ora
(直接拷貝XP 下的這兩個(gè)文件)
比如這里是:
sqlnet.ora文件內(nèi)容:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tnsnames.ora文件內(nèi)容(斜體表示需要替換的內(nèi)容):
orcl=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
4.配置環(huán)境變量
變量名: TNS_ADMIN
變量值: D:\oracle_client\instantclient_11_2
否則出現(xiàn):ORA-12154: TNS:could not resolve the connect identifier specified錯(cuò)誤
變量名:NLS_LANG
變量值: SIMPLIFIED CHINESE.ZHS16GBK
否則查詢條件中有中文時(shí)無法查詢到相應(yīng)的數(shù)據(jù)
如果之前安裝了Oracle 又卸載,會(huì)遺留NLS_LANG=NA的鍵值.輸入RegEdit打開注冊(cè)表HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE.在右面找到NLS_LANG=NA并刪除掉
否則會(huì)報(bào)ORA-12705: Cannot access NLS data files or invalid 錯(cuò)誤.
5.安裝pl/sql軟件(過程略)
6.配置pl/sql的Oracle連接參數(shù):
選擇pl/sql的工具/首選項(xiàng)(too/ preference/)里的連接,在右面設(shè)置Oracle主目錄名(即安裝目錄)和OCI庫.
Oracle主目錄名: D:\oracle_client\instantclient_11_2
OCI庫: D:\oracle_client\instantclient_11_2\oci.dll
7.登陸pl/sql測試成功