oracle 10g 网络一点研究

listener.ora、sqlnet.ora、tnsnames.ora 这三个文件的具体作用及内容就不在阐述。

主机IP:192.168.216.172
HOSTNAME:LOCALHOST
/etc/hosts文件:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost


listener.ora:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/soft/product/10.2.0)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = testdb)
(ORACLE_HOME = /opt/oracle/soft/product/10.2.0)
(SID_NAME = testdb)
)
)

tnsnames.ora:
KZ172 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.216.172)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = testdb)
)
)

oracle@localhost ~$lsnrctl start

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 22-SEP-2009 17:59:38

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /opt/oracle/soft/product/10.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.2.0 - Production
System parameter file is /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production
Start Date 22-SEP-2009 17:59:38
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "testdb" has 1 instance(s).
Instance "testdb", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


当数据库还没有OPEN的时候,STATUS表现为BLOCKED。
oracle@localhost ~$lsnrctl status

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 22-SEP-2009 18:00:16

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production
Start Date 22-SEP-2009 17:59:38
Uptime 0 days 0 hr. 0 min. 38 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "testdb" has 2 instance(s).
Instance "testdb", status UNKNOWN, has 1 handler(s) for this service...
Instance "testdb", status BLOCKED, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "testdb_XPT" has 1 instance(s).
Instance "testdb", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

SQL> startup
ORACLE instance started.

Total System Global Area 1744830464 bytes
Fixed Size 1261284 bytes
Variable Size 503316764 bytes
Database Buffers 1224736768 bytes
Redo Buffers 15515648 bytes
Database mounted.
Database opened.

数据库起来后,表现为ready:
oracle@localhost ~$lsnrctl status

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 22-SEP-2009 18:00:23

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production
Start Date 22-SEP-2009 17:59:38
Uptime 0 days 0 hr. 0 min. 45 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "testdb" has 2 instance(s).
Instance "testdb", status UNKNOWN, has 1 handler(s) for this service...
Instance "testdb", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "testdb_XPT" has 1 instance(s).
Instance "testdb", status READY, has 1 handler(s) for this service...
The command completed successfully


现在修改LISTENER.ORA为IP:
oracle@localhost ~$vi /opt/oracle/soft/product/10.2.0/network/admin/listener.ora

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.216.172)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/soft/product/10.2.0)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = testdb)
(ORACLE_HOME = /opt/oracle/soft/product/10.2.0)
(SID_NAME = testdb)
)
)


oracle@localhost ~$lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 22-SEP-2009 18:04:17

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.216.172)(PORT=1521)))
The command completed successfully
oracle@localhost ~$lsnrctl start

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 22-SEP-2009 18:04:40

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /opt/oracle/soft/product/10.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.2.0 - Production
System parameter file is /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.216.172)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.216.172)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production
Start Date 22-SEP-2009 18:04:40
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.216.172)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "testdb" has 1 instance(s).
Instance "testdb", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

一直状态为status UNKNOWN.

oracle@localhost ~$sqlplus system/haha1029_##@kz172

SQL*Plus: Release 10.2.0.2.0 - Production on Tue Sep 22 18:05:58 2009

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

数据库客户端连接报数据库没起来的错误。

解决方式:
[root@localhost ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.216.172 testdb

oracle@testdb ~$sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.2.0 - Production on Tue Sep 22 18:10:19 2009

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1744830464 bytes
Fixed Size 1261284 bytes
Variable Size 503316764 bytes
Database Buffers 1224736768 bytes
Redo Buffers 15515648 bytes
Database mounted.
Database opened.
SQL>

oracle@localhost ~$lsnrctl status

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 22-SEP-2009 18:10:28

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.216.172)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production
Start Date 22-SEP-2009 18:08:37
Uptime 0 days 0 hr. 1 min. 51 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/soft/product/10.2.0/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.216.172)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "testdb" has 2 instance(s).
Instance "testdb", status UNKNOWN, has 1 handler(s) for this service...
Instance "testdb", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "testdb_XPT" has 1 instance(s).
Instance "testdb", status READY, has 1 handler(s) for this service...
The command completed successfully

oracle@localhost ~$sqlplus system/haha1029_##@kz172

SQL*Plus: Release 10.2.0.2.0 - Production on Tue Sep 22 18:10:59 2009

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL>

问题解决。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28419/viewspace-615346/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28419/viewspace-615346/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值