1、$ORACLE_HOME/network/admin/tnsnames.ora文件是连接远程数据库的配置
文件
2、例如 YOURDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
172.16.1.2)(PORT = 1521)) (CONNECT_DATA = (SERVER =
DEDICATED) (SERVICE_NAME = yourdb) ) )
3、使用 sqlplus /nolog
SQL>conn system/123456@YOURDB
Oracle 11g 安装完成后,只能在本机访问,希望其远程计算机也能访问,刚开始直接修改listener.ora文件# 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
将localhost直接改为本机Ip地址,重启监听服务停止监听:lsnrctl stop
启动监听:lsnrctl start
查看监听:lsnrctl status
结果失败。
正确的方式,运行Net Configuration Assistant,修改监听配置,一步一步即可,无需修改任何数据结果listener.ora文件变为:
# 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 = TCP)(HOST = WIN-VI5UF46V3UG)(PORT = 1521)))
)
ADR_BASE_LISTENER = C:\app\Administrator
Host处变为主机名,这样远程计算机就可以访问服务器了。
无需修改服务方式为共享还是专用,无需修改IP地址,可能该向导在后面自动做了很多工作
不用具体配置,只需在连接时,有一个地方要输入IP的,你输入Oracle安装的那台机器的IP就可以了用户名和密码就不用说了,在下面的Hostname处填写数据库服务器(即数据库安装的电脑)的IP地址,端口号都默认是1521,sid就是你需要连接的数据库的名称了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)