oracle tnsnames缩写,Oracle 正确理解tnsnames.ora中的service_name

正确理解tnsnames.ora中的service_name

正解:tnsnames.ora中的service_name 其实应该是监听程序

监听到

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "

test.test.doudou.com" has 1 instance(s).

Instance "test", status READY, has 1 handler(s) for this service...

Service "testXDB.test.doudou.com" has 1 instance(s).

Instance "test", status READY, has 1 handler(s) for this service...

Service "test_XPT.test.doudou.com" has 1 instance(s).

Instance "test", status READY, has 1 handler(s) for this service...

The command completed successfully

场景回忆

查看service_names,db_domain

SQL> show parameter service_names

NAME

TYPE

VALUE

------------------------------------ ----------- ------------------------------

service_names

string

test

SQL> show parameter db_domain

NAME

TYPE

VALUE

------------------------------------ ----------- ------------------------------

db_domain

string

test.doudou.com

tnsping

通,可以ping通

[ora@dg-ss dbs]$ tnsping test

TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 08-AUG-2008 17:23:19

Copyright (c) 1997,

2007, Oracle.

All rights reserved.

Used parameter files:

/opt/oracle/product/10.2.0/db_2/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg-ss)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test)))

OK (0 msec)

用户登录确报错 ORA-12514

[ora@dg-ss dbs]$ sqlplus doudou/123@test

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Aug 8 17:23:23 2008

Copyright (c) 1982, 2007, Oracle.

All Rights Reserved.

ERROR:

ORA-12514: TNS:listener does not currently know of service requested in connect

descriptor

查看监听程序状态

[ora@dg-ss dbs]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 08-AUG-2008 17:22:00

Copyright (c) 1991, 2007, Oracle.

All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg-ss)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias

LISTENER

Version

TNSLSNR for Linux: Version 10.2.0.4.0 - Production

Start Date

08-AUG-2008 17:21:35

Uptime

0 days 0 hr. 0 min. 24 sec

Trace Level

off

Security

ON: Local OS Authentication

SNMP

OFF

Listener Parameter File

/opt/oracle/product/10.2.0/db_2/network/admin/listener.ora

Listener Log File

/opt/oracle/product/10.2.0/db_2/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg-ss)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "

viewspace-758902

viewspace-758902

test.test.doudou.com" has 1 instance(s).

Instance "test", status READY, has 1 handler(s) for this service...

Service "testXDB.test.doudou.com" has 1 instance(s).

Instance "test", status READY, has 1 handler(s) for this service...

Service "test_XPT.test.doudou.com" has 1 instance(s).

Instance "test", status READY, has 1 handler(s) for this service...

The command completed successfully

查看tnsnames.ora文件

[ora@dg-ss admin]$ cat tnsnames.ora

TEST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dg-ss)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME =

test)

)

)

解决方法

TEST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = dg-ss)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME =

test.test.doudou.com)

)

)

用户可以正常登录

[ora@dg-ss admin]$ sqlplus doudou/123@test

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Aug 8 17:24:14 2008

Copyright (c) 1982, 2007, Oracle.

All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

总结:

通过这次简单的错误,让我意识到研究oracle不能人云亦云,必须通过实验才能研究的更深,更明了。

最后提醒自己一次tnsnames.ora中的service_name是监听程序监听到的service_name也可以认为是servcie_name=db_name.db_domain

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值