EZCONNECT方式連線服務端
這裡介紹一種比較方便的連線服務端的方式:EZCONNECT 。
這種連線方式,只需要服務端配置監聽檔案就可以了,而不需要再客戶端配置tnsnames檔案的連線串。
---配置監聽:
[oracle@enmo admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
---啟動監聽:
[oracle@enmo admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 20:04:17
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
... ...
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 03-NOV-2016 20:04:17
Uptime 0 days 0 hr. 0 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/enmo/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "PROD" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
Service "PRODXDB" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
The command completed successfully
--首先使用tnsnames方式作連線測試:
--使用連線串測試監聽:
ORA11GR2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
)
)
--串通服務機測試:
[oracle@host01 admin]$ tnsping ora11gr2
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 20:05:08
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD)))
OK (20 msec)
[oracle@host01 admin]$
--tnsping通後,連線服務機的資料庫測試:
[oracle@host01 admin]$ sqlplus sys/oracle@ora11gr2 as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 3 20:05:36 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string PROD
SQL>
#連線成功。
---嘗試在另外一臺機進行EZCONNECT:
[oracle@host01 ~]$ sqlplus sys/oracle@192.168.2.6:1521/PROD as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 3 20:30:25 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string PROD
---在Windows的客戶端連線:
C:\Users\Asus>sqlplus sys/oracle@192.168.2.6:1521/PROD as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 11月 3 22:00:41 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
連線到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter service
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
service_names string
PROD
SQL>
#都連線成功。
注意,一般情況下,在配置或者連線命令書寫無誤的情況下,若依然連線不到,則需要去配置sqlnet.ora檔案,
檔案所在的位置跟listener.ora檔案的路徑一樣在/u01/app/oracle/product/11.2.0/dbhome_1/network/admin。
[oracle@enmo admin]$ vi sqlnet.ora
# sqlnet.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)
#此檔案明確遠端客戶端連線服務端的方式。
這種連線方式,只需要服務端配置監聽檔案就可以了,而不需要再客戶端配置tnsnames檔案的連線串。
---配置監聽:
[oracle@enmo admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = enmo)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
---啟動監聽:
[oracle@enmo admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 20:04:17
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
... ...
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 03-NOV-2016 20:04:17
Uptime 0 days 0 hr. 0 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/enmo/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enmo.oracle.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "PROD" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
Service "PRODXDB" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
The command completed successfully
--首先使用tnsnames方式作連線測試:
--使用連線串測試監聽:
ORA11GR2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
)
)
--串通服務機測試:
[oracle@host01 admin]$ tnsping ora11gr2
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 20:05:08
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD)))
OK (20 msec)
[oracle@host01 admin]$
--tnsping通後,連線服務機的資料庫測試:
[oracle@host01 admin]$ sqlplus sys/oracle@ora11gr2 as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 3 20:05:36 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string PROD
SQL>
#連線成功。
---嘗試在另外一臺機進行EZCONNECT:
[oracle@host01 ~]$ sqlplus sys/oracle@192.168.2.6:1521/PROD as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 3 20:30:25 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string PROD
---在Windows的客戶端連線:
C:\Users\Asus>sqlplus sys/oracle@192.168.2.6:1521/PROD as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 11月 3 22:00:41 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
連線到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter service
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
service_names string
PROD
SQL>
#都連線成功。
注意,一般情況下,在配置或者連線命令書寫無誤的情況下,若依然連線不到,則需要去配置sqlnet.ora檔案,
檔案所在的位置跟listener.ora檔案的路徑一樣在/u01/app/oracle/product/11.2.0/dbhome_1/network/admin。
[oracle@enmo admin]$ vi sqlnet.ora
# sqlnet.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)
#此檔案明確遠端客戶端連線服務端的方式。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2127788/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows遠端連線Docker服務WindowsDocker
- IoT雲服務連線性的方式
- 第五週週一(安卓端連線服務端)安卓服務端
- jconsole連線遠端服務
- SSH服務連線
- rd遠端桌面連線方式
- rdp遠端桌面連線方式
- win10 如何開啟遠端服務_win10如何開啟遠端連線服務Win10
- 使用免費的Oracle雲服務-遠端連線ATPOracle
- [SSH服務]——SSH詳解、常用的遠端連線工具
- TCP協議服務端和客戶端的連線與通訊TCP協議服務端客戶端
- mysql怎麼連線服務MySql
- SpringCloud服務安全連線SpringGCCloud
- netty服務端監聽客戶端連線加入和斷開事件Netty服務端客戶端事件
- git連線遠端倉庫的方式Git
- 解決:連線遠端redis服務失敗(在linux部署)RedisLinux
- Node.js 服務連線 MySQLNode.jsMySql
- Nginx/Apache服務連線數梳理NginxApache
- web服務中連線池用法Web
- 雲服務預設Sql server和Mysql遠端連線埠是多少?ServerMySql
- ubuntu18.04開啟ssh服務和ssh遠端連線Ubuntu
- 使用 SAP Cloud SDK 連線 OData 服務Cloud
- golang實現的長連線服務Golang
- [場景設計]短連線服務
- 遠端桌面連線管理器,遠端桌面連線管理器遠端連線vps撥號伺服器的方式伺服器
- 遠端連線伺服器的方式推薦伺服器
- MySQL client客戶端的四種連線方式MySqlclient客戶端
- MongoDB系列一:MongoDB安裝、啟動關閉服務、客戶端連線MongoDB客戶端
- golang做為長連線遊戲服務端,如何解決熱更新問題?Golang遊戲服務端
- Win7無法建立遠端連線管理服務的解決方法Win7
- 極光推送-服務端端智慧人社訊息推送方式服務端
- 如何以 mock server 的方式本地啟動 SAP UI5 應用,使它不連線伺服器端 OData 服務MockServerUI伺服器
- ORACLE 連線方式Oracle
- Oracle連線方式Oracle
- 簡單談談服務間的連線
- 公有云專線直連服務-ElinkcloudCloud
- Gopusher 一個通用的長連線服務Go
- oracle客戶端連線server 端, tnsnames的三種設定方式Oracle客戶端Server