❶ linux怎麼遠程連接ORACLE資料庫
很簡單,你在A電腦安裝一個ORACLE 客戶端,然後,在你所安裝的ORACLE主目錄文件找到tnsnames.ora文件打開,然後,(testdb是你要連接的B伺服器實例名)加入一條記錄如:
TESTDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.xx)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = testdb)
)
)
或者,你在A機器上Oracle Net Manager 手動添加一條記錄,按步驟來。
❷ 如何連接到linux上的oracle資料庫
裝好oracle資料庫,我們准備用PLSQL Developer 這個軟體來連接伺服器的資料庫!
下面簡單介紹設置此軟體並連接oracle資料庫的方法:
一、下載並安裝好PLSQL Developer(綠色版的也可以);
二、下載並解壓
Oracle免安裝版的客戶端:
http://download.oracle.com/otn/nt/instantclient/112030/instantclient-basic-nt-11.2.0.3.0.zip
三、建立tns配置文件。
1、在解壓的:「nstantclient-basic-nt-11.2.0.3.0」文件夾的下面建文件夾,路徑像這樣「nstantclient-basic-nt-11.2.0.3.0
eidownadmin「,其實這個倒是無所謂的,只是看起來與服務端上的更接近而已,與文章後面的環境變數要對應。
2、拷貝服務端目錄「$ORACLE_HOME$
etworkadmin nsnames.ora」到客戶端的「nstantclient-basic-nt-11.2.0.3.0
eidownadmin「目錄,這個文件的內容如下:(也可自行建立)
# tnsnames.ora Network Configuration File: /home/oradb/oracle/proct/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.localdomain)
)
)
ORACLE_BASE=/home/oradb/oracle
ORACLE_HOME=$ORACLE_BASE/proct/11.2.0/db_1
ORACLE_SID=orcl
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
LANG=C
# tnsnames.ora Network Configuration File: /home/oradb/oracle/proct/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.localdomain)
)
)
在菜單「工具-首選項」中的「連接」中,
找到「Oracle主目錄名」,輸入
找到「OCI庫」,輸入
❸ 鍦╓indows 涓嬪備綍璁塊棶Linux 涓鐨凮racle 鏁版嵁搴 濡備綍閰嶇疆tns
棣栧厛蹇呴』瀹夎匴indows鐗堟湰鐨凮ralce瀹㈡埛絝紼嬪簭(鏈嶅姟絝涔熷彲浠ワ紝瀹冨寘鍚瀹㈡埛絝鍐呭癸紝浣嗗畨瑁呭悗鏂囦歡浼氭洿澶)銆
瀹夎呭埌鏈鍚庯紝闇瑕佽懼畾涓繪満IP銆佹湇鍔″悕縐扮瓑錛岃繖浜涘彲浠ラ殢鎰忓~鍐欙紝鍥犱負鍚庨潰鍙鎵嬪伐閰嶇疆銆
瀹夎呭畬Oracle紼嬪簭鍚庯紝榪涘叆瀹夎呯洰褰曪紝鍦–lientNetorkAdmin鐩褰曚笅浼氭湁涓涓猼nsnames.ora鏂囦歡錛岀敤璁頒簨鏈鎵撳紑瀹冦
緙栬緫鎴栨柊澧炲唴瀹癸紝test鏄鍏朵粬紼嬪簭璋冪敤鏁版嵁搴撶殑鍚嶇О錛孒ost鏄疧racle鏁版嵁搴撳湴鍧錛孭ort涓鑸榛樿1521錛宻ervice_name鏄疧racle鐨勬暟鎹搴撴湇鍔″悕縐幫紝榪欎簺鍐呭逛竴瀹氳佹g『銆傛ゆ椂鍙瀹夎呬竴涓狿L/SQL紼嬪簭錛屽畨瑁呭悗鎵撳紑PL/SQL錛孌atabase閫夋嫨test錛岃緭鍏ヨ處鍙峰瘑鐮侊紝鍗沖彲鐧婚檰錛屽規暟鎹榪涜屾搷浣溿
test =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = mytest)
)
)
❹ LINUX怎麼遠程連接ORACLE資料庫
1、安裝client或者instantclient
2、配置$ORACLE_HOME/network/admin/tnsnames.ora
例如:
DB02 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = remotedb)
)
)
3、像remoteDB一樣配置oracle環境變數
4、用sqlplus或者軟體訪問
例如:
sqlplus user/passwd@orcl
❺ linux操作系統下oracle資料庫如何配置監聽
1. 修改監聽器配置文件
Linux下Oracle監聽器配置文件在:$ ORACLE_HOME/network/admin/listerer.ora, 如:
/bank/oracle/oracle10g/proct/10.2.0/network/admin/listener.ora
修改並配置要監聽SID的相關信息,如:
#listener.ora Network Configuration File: /bank/oracle/oracle10g/proct/10.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /bank/oracle/oracle10g/proct/10.2.0)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL DBNAME = bkserver)
(SID_NAME = bkserver)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.7.13.242)(PORT = 1521))
)
)
2. 啟動監聽器
(1). 切換至oracle安裝用戶(一般為oracle)
su - oracle
(2). 啟動監聽器
lsnrctl start
另:停止監聽器
lsnrctl stop
3. 測試監聽器是否運行正常
在客戶端修改tnsnames.ora配置文件就訪問Oracle資料庫,如:
BKSERVER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.7.13.242)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = BKSERVER)
)
)
通過命令tnsping測試是否能訪問到監聽器,如:
M:\>tnsping bkserver
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Proction on 12-8月 -
2010 17:11:04
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的參數文件:
D:\oracle\proct\10.2.0\client_1\network\admin\sqlnet.ora
已使用 TNSNAMES 適配器來解析別名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 10.7.13.242)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVIC
E_NAME = BKSERVER)))
OK (20 毫秒)
注意: 監聽器是否能被tnsping通跟資料庫的開啟/關閉無關,所以就算可以tnsping通監聽器但未必能連接到資料庫,這時請檢查listener.ora文件配置信息是否正確,還有資料庫是否已經被開啟。