您的位置:首页 > 数据库 > Oracle

关于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。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: