您好,登錄后才能下訂單哦!
怎么在Oracle中配置遠程訪問?相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。
1.網絡監聽配置
# listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) ) ADR_BASE_LISTENER = C:\app\Administrator
多個IP時,如下:
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.24.226.2)(PORT = 1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.24.226.3)(PORT = 1521)) ) )
2.TNS 配置
# tnsnames.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora # Generated by Oracle configuration tools. ORCL= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO) ) ) LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
多個IP時,如下:
ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.24.226.2)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 172.24.226.3)(PORT = 1521)) ) (SOURCE_ROUTE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
3.停止和啟動服務
先停止以下服務,然后再啟動.
OracleOraDb11g_homeTNSListener OracleService*
客戶端配置
1.下載 ODAC 壓縮包.
2.解壓下載的 ODAC 壓縮包.
3.執行安裝命令
示例:
install.bat all D:\Program\ODAC\12040x64 OracleHome true
4.添加環境變量
ORACLE_HOME : 是 ODAC 安裝的目錄.
TNS_ADMIN : 是文件 tnsnames.ora 所在的目錄,一般為 ODAC 安裝目錄下的 network\admin 中.
注: TNS_ADMIN 可以不用添加,直接將 tnsnames.ora 文件復制到 ODAC 安裝目錄下即可
將 %ORACLE_HOME% 添加到 PATH 環境變量中.
5.配置 TNS
在配置文件 tnsnames.ora 中加入
DBORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <db-host>)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = <db-name>) ) )
說明:
<db-host> : 數據庫電腦的IP或者是計算機名
<db-name> : 數據庫TNS配置的名稱
看完上述內容,你們掌握怎么在Oracle中配置遠程訪問的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。