关于oracle 客户怎么端连server 的设置 -- 监听的作用
2011-12-04 19:58
411 查看
本次试验是搞了下监听 pc ,还有server 的设置。
[oracle@aoracle ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:02:09
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
好,我们检查一下:
cd /$ORACLE_HOME/network/admin
[oracle@aoracle admin]$ vi listener.ora
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
)
# SID_LIST_<lsnr>
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
(SID_NAME=ezhu)
(ORACLE_HOME=/u01/pp/oracle/product/10.2/db_1)
)
(SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
(SID_NAME=ezhoudg)
(ORACLE_HOME=/u01/pp/oracle/product/10.2/db_1)
)
)
注意:current database ORACLE_SID: ezhou, 但是:listener.ora文件中么有这个sid,
好,我们启动试试:
先check 一下hostname:
[oracle@aoracle admin]$ hostname
aoracle.domain.com
虽然显示成功:
[oracle@aoracle admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:13:36
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/pp/oracle/product/10.2/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/pp/oracle/product/10.2/db_1/network/admin/listener.ora
Log messages written to /u01/pp/oracle/product/10.2/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 04-DEC-2011 19:13:36
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/pp/oracle/product/10.2/db_1/network/admin/listener.ora
Listener Log File /u01/pp/oracle/product/10.2/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521)))
Services Summary...
Service "ezhoudg" has 1 instance(s).
Instance "ezhoudg", status UNKNOWN, has 1 handler(s) for this service...
Service "ezhu" has 1 instance(s).
Instance "ezhu", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
但是有status :UNKNOWN.
我们来从pc 连一下:
C:\Documents and Settings\Jonup>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 12月 4 19:31:51 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL>
SQL> conn sys/oracle@ezhou as sysdba
ERROR:
ORA-12170: TNS: 连接超时
好,我们下面把监听里的 sid 和database 写对。再起一下:
[oracle@aoracle admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:34:48
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 04-DEC-2011 19:13:36
Uptime 0 days 0 hr. 21 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/pp/oracle/product/10.2/db_1/network/admin/listener.ora
Listener Log File /u01/pp/oracle/product/10.2/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521)))
Services Summary...
Service "ezhou" has 1 instance(s).
Instance "ezhou", status READY, has 1 handler(s) for this service...
Service "ezhouXDB" has 1 instance(s).
Instance "ezhou", status READY, has 1 handler(s) for this service...
Service "ezhou_XPT" has 1 instance(s).
Instance "ezhou", status READY, has 1 handler(s) for this service...
Service "ezhoudg" has 1 instance(s).
Instance "ezhoudg", status UNKNOWN, has 1 handler(s) for this service...
Service "ezhu" has 1 instance(s).
Instance "ezhu", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
好,下面再连一下:
还是报相同的错,
我检查了pc 的oracle 的listener.ora 的设置:
BOSS=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.190.140)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATE)
(SERVICE_NAME=ezhou)
(INSTANCE=ezhou)
)
)
发现是server :192.168.190.140 在pc 上映射的BOSS,ok, 下面再连一下:
成功:
SQL> conn sys/oracle@Boss as sysdba;
已连接。
SQL> select name from v$database;
NAME
------------------
EZHOU
在server 上看一下连接:
[oracle@aoracle admin]$ ps -ef | grep LOCAL=NO
oracle 7155 1 0 19:43 ? 00:00:00 oracleezhou (LOCAL=NO)
oracle 7322 5904 0 19:48 pts/2 00:00:00 grep LOCAL=NO
确实远端有连接:
下面pc 退出看看:
SQL> disconnect
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
server check一下:
虽然看到还有。但是已经断开了。
可以从
[oracle@aoracle admin]$ ps -ef | grep LOCAL=NO
oracle 8003 1 1 19:52 ? 00:00:00 oracleezhou (LOCAL=NO)
oracle 8005 5904 0 19:52 pts/2 00:00:00 grep LOCAL=NO
时间上看出来。
下面吧server 的listner 断了,看看:
oracle@aoracle admin]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:54:38
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
The command completed successfully
下面从pc 连上来看看:
SQL> conn sys/oracle@Boss as sysdba;
ERROR:
ORA-12541: TNS: 无监听程序
警告: 您不再连接到 ORACLE。
[oracle@aoracle ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:02:09
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
好,我们检查一下:
cd /$ORACLE_HOME/network/admin
[oracle@aoracle admin]$ vi listener.ora
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
)
# SID_LIST_<lsnr>
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
(SID_NAME=ezhu)
(ORACLE_HOME=/u01/pp/oracle/product/10.2/db_1)
)
(SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
(SID_NAME=ezhoudg)
(ORACLE_HOME=/u01/pp/oracle/product/10.2/db_1)
)
)
注意:current database ORACLE_SID: ezhou, 但是:listener.ora文件中么有这个sid,
好,我们启动试试:
先check 一下hostname:
[oracle@aoracle admin]$ hostname
aoracle.domain.com
虽然显示成功:
[oracle@aoracle admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:13:36
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/pp/oracle/product/10.2/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/pp/oracle/product/10.2/db_1/network/admin/listener.ora
Log messages written to /u01/pp/oracle/product/10.2/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 04-DEC-2011 19:13:36
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/pp/oracle/product/10.2/db_1/network/admin/listener.ora
Listener Log File /u01/pp/oracle/product/10.2/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521)))
Services Summary...
Service "ezhoudg" has 1 instance(s).
Instance "ezhoudg", status UNKNOWN, has 1 handler(s) for this service...
Service "ezhu" has 1 instance(s).
Instance "ezhu", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
但是有status :UNKNOWN.
我们来从pc 连一下:
C:\Documents and Settings\Jonup>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 12月 4 19:31:51 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL>
SQL> conn sys/oracle@ezhou as sysdba
ERROR:
ORA-12170: TNS: 连接超时
好,我们下面把监听里的 sid 和database 写对。再起一下:
[oracle@aoracle admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:34:48
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 04-DEC-2011 19:13:36
Uptime 0 days 0 hr. 21 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/pp/oracle/product/10.2/db_1/network/admin/listener.ora
Listener Log File /u01/pp/oracle/product/10.2/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521)))
Services Summary...
Service "ezhou" has 1 instance(s).
Instance "ezhou", status READY, has 1 handler(s) for this service...
Service "ezhouXDB" has 1 instance(s).
Instance "ezhou", status READY, has 1 handler(s) for this service...
Service "ezhou_XPT" has 1 instance(s).
Instance "ezhou", status READY, has 1 handler(s) for this service...
Service "ezhoudg" has 1 instance(s).
Instance "ezhoudg", status UNKNOWN, has 1 handler(s) for this service...
Service "ezhu" has 1 instance(s).
Instance "ezhu", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
好,下面再连一下:
还是报相同的错,
我检查了pc 的oracle 的listener.ora 的设置:
BOSS=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.190.140)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATE)
(SERVICE_NAME=ezhou)
(INSTANCE=ezhou)
)
)
发现是server :192.168.190.140 在pc 上映射的BOSS,ok, 下面再连一下:
成功:
SQL> conn sys/oracle@Boss as sysdba;
已连接。
SQL> select name from v$database;
NAME
------------------
EZHOU
在server 上看一下连接:
[oracle@aoracle admin]$ ps -ef | grep LOCAL=NO
oracle 7155 1 0 19:43 ? 00:00:00 oracleezhou (LOCAL=NO)
oracle 7322 5904 0 19:48 pts/2 00:00:00 grep LOCAL=NO
确实远端有连接:
下面pc 退出看看:
SQL> disconnect
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
server check一下:
虽然看到还有。但是已经断开了。
可以从
[oracle@aoracle admin]$ ps -ef | grep LOCAL=NO
oracle 8003 1 1 19:52 ? 00:00:00 oracleezhou (LOCAL=NO)
oracle 8005 5904 0 19:52 pts/2 00:00:00 grep LOCAL=NO
时间上看出来。
下面吧server 的listner 断了,看看:
oracle@aoracle admin]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 04-DEC-2011 19:54:38
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=aoracle.domain.com)(PORT=1521))
The command completed successfully
下面从pc 连上来看看:
SQL> conn sys/oracle@Boss as sysdba;
ERROR:
ORA-12541: TNS: 无监听程序
警告: 您不再连接到 ORACLE。
相关文章推荐
- 关于Oracle Shared Server及一些参数设置与监听之间的联系
- 关于Oracle Shared Server及一些参数设置
- 关于Hibernate连接到Oracle上的设置(映射)
- 连接oracle的总结(关于tnsname和监听)
- 用oracle客户端的Net Manager创建服务(server)和监听(listener)
- 关于navicat连接oracle错误:ora-123737:instant client light:unsupported server character set zhs16gbk
- oracle怎么实现id自增和设置主键
- linux 下 oracle 数据库和监听自启动 设置
- 关于浏览器极速模式怎么设置
- 关于RAC 的Data Guard中FAL_SERVER及FAL_CLIENT的设置
- 关于oracle怎么输出到控制台以及oracle 记录表record的使用
- sql server service broker中调用存储过程执行跨库操作,不管怎么设置都一直提示 服务器主体 "sa" 无法在当前安全上下文下访问数据库 "dbname"。
- 连接oracle的总结(关于tnsname和监听)
- oracle怎么实现id自增和设置主键
- 关于MOSS传入电子邮件设置 - [SharePoint Server]
- 关于Oracle Exadata Storage Server的Exafusion协议
- 关于imageview 不让背景图片自动拉伸填充 imageview 以及布局参数的设置的小结(自己试验的可能不怎么准确)
- 2012 里SQL Server Data Tools进程处理数据库时 怎么没有更改设置呢?
- 关于Oracle中设置缺省时间显示格式的问题
- oracle监听不能自动启动(但服务已设置自动),手动启动后又停止