| 订阅 | 在线投稿
分享
 
 
 

讲解Oracle数据库TNS常见错误的解决办法

2008-08-06 07:16:39  编辑来源:互联网  宽屏版  评论

本文为【讲解Oracle数据库TNS常见错误的解决办法】的汉字拼音对照版显示拼音

1ORA-12541:TNS:meiyoujiantingqi

yuanyin:meiyouqidongjiantingqihuozhejiantingqisunhuairuoshiqianzhe使shiyongminglingnet start OracleOraHome10gTNSListener(mingzikenengyouchuru)jike;ruguoshihouzheze使shiyongNet Configuration Assistantgongjuxiangdaozhijiantingchengxupeizhizengjiayigejiantingqijike(jibenbuyongxierenhexinxiyiluOKzaitianjiazhiqiankenengxuyaobasuoyoudejiantingqixianshan!)

2ORA-12500:TNS:jiantingchengxuwufaqidongzhuanyongfuwuqijinchenghuoORA-12560:TNS:xieyishipeiqicuowu

yuanyin:ORACLEdeshujukufuwumeiyouqidong使shiyongminglingnet start ORACLESERVICEORADB(ORADBweishujukumingzi)jikeruguorengmeiyoujiejueqingjixuxiangxiakan

3ruguoshujukufuwuqidongshibaizehenyoukenengshiqizhucebiaoxiangzhisunhuaizuihaodezuofashiyixialiangbu:

1)ORADIM -DELETE -SID oradb shanchushujukufuwuxiang

2)ORADIM -NEW -SID oradb xinzengshujukufuwuxiang

zhu:zhegeguochengzhongruguochucuojiuchongqijisuanji!

4ORA-12154:TNS:nengjiexifuwuming

yuanyin:ORACLEdewangluofuwumingmeiyouzhengquepeizhiqing使shiyongNet8 Configuration AssistantgongjuxiangdaozhibendiwangluofuwumingpeizhipeizhiTNSjikeruguorengmeiyoujiejueqingjixuxiangxiakan

5ORA-1034 :TNS:ORACLEbukeyong

yuanyin:ORACLEdeshujukufuwuzhengqueqidongdanshishujukumeiyoudakai!

使shiyongmingling:

1)svrmgrl qidongfuwuguanliqi

2)connect internal yiinternalshenfendenglu

3)startup dakaishujuku

6ORA-12560:TNS:xieyishipeiqicuowu(wanguxingde)

yuanyin:weizhi

jiejue:bishaji--dakaiWindowsrenwuguanliqishasiORACLE.exejiORADIM.exejinchengshuxiezijideora_startup.batzhixingzhi!

PS:

1ora_startup.bat:

net start OracleOraHome81TNSListener

net start ORACLESERVICEORADB

svrmgrl yibanqingkuangxiabuyongbuguoyoushishaobuletadejutibuzhoujiandi5bu

2ora_shutdown.bat:

net stop OracleOraHome81TNSListener

net stop ORACLESERVICEORADB

3ORACLExiangguanfuwumingqingshenjianguanligongjuzhifuwuzhongyiORACLEkaitoudefuwuming

1TNS-12154 Error huoORA-12154

tezheng:SQL*NETmeiyouzhaodaolianjiechuanhuobieming

yuanyin1:(1)meiyouzhaodaoTNSNAMES.ORAwenjiangaiwenjiandequeshenglujingwei:

Windows 95/98 client

SQL*Net 2.x - ORAWIN95NETWORKADMIN

Net8 - ORAWIN95NET80admin

Net8i - ORACLEORA81NETWORKADMIN

Windows NT client

SQL*Net 2.x - ORANTNETWORKADMIN

Net8 - ORANTNET80ADMIN

Net8i - ORACLEORA81NETWORKADMIN

UNIX Client

$ORACLE_HOME/NETWORK/ADMIN

or /etc

or /var/opt/oracle

. zaikehuduanshezhiTNS_ADMIN

zaizhucebiao HKEY_LOCAL_MACHINESoftwareOracle shezhiTNS_ADMIN. TNS_ADMIN zhixiangTNSNAMES.ORAwenjiandeweizhi

cuoshi:anshangshushuomingjianchawenjianweizhi

yuanyin2:(2)TNSNAMES.ORAwenjianzhongneironggeshibudui

cuoshi:jianchawenjiangeshibiaozhungeshiruxia:

DEV1.WORLD =

(DESCRIPTION = (ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (Host = 145.45.78.56) (Port = 1521) ) )

(CONNECT_DATA = (SID = ORCL) ) )

yuanyin3: (3) TNSNAMES.ORAyuSQLNET.ORAbuyizhi

cuoshi: SQLNET.ORAgeshiruxia:

TRACE_LEVEL_CLIENT = OFF

SQLNET.AUTHENTICATION_SERVICES = (NONE)

NAMES.DIRECTORY_PATH = (TNSNAMES)

AUTOMATIC_IPC = OFF

yinweimeiyouNAMES.DEFAULT_DOMAIN=worldsuoyiDEV1.WORLDlianjiechuanbunenglianjiekeyizaiTNSNAMES.ORAzhongzengjia

DEV1 =

(DESCRIPTION = (ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (Host = 145.45.78.56) (Port = 1521) ) )

(CONNECT_DATA = (SID = ORCL) ) )

cishikelianjie

2NL-00462 Error huoORA-00462

tezheng:jiantingqiwufaqidong

yuanyin:LISTENER.ORAwenjianneirongcuowulirukuohaobupipeishenshumingcuowudengduoyudekonggedeng

cuoshi:chongxinbianjiwenjian

3NL-00405 Error huoORA-00405

tezheng:LISTENER.ORAwenjianbukeduhuozhaobudao

yuanyin:LISTENER.ORAwenjianneirongcuowulirukuohaobupipeishenshumingcuowudengduoyudekonggedeng

cuoshi:quebaowenjianweizhizaiqueshengmuluxia$ORACLE_HOME/network/adminhuoshezhihuanjingbianliangTNS_ADMINzhixiangzhegewenjiansuozaiweizhi

4TNS-01155 Error huoORA-01155

tezheng:LISTENER.ORAwenjianzhongSID_LIST_LISTENERbianliangfuzhibudui

yuanyin:LISTENER.ORAwenjianneirongcuowuSID_LIST_LISTENERbianliangfuzhibudui

cuoshi:quebaowenjianzhongfuzhizhengque$ORACLE_HOME/network/admin/samplesmuluxiayouyangliwenjiankegongshenkao

5TNS-12537 TNS-12560TNS-00507 Error

tezheng:LISTENER.ORAwenjianzhongyinyongleyigewuxiaodexieyishipeichengxu

yuanyin:LISTENER.ORAwenjianzhongPROCOTOLbianliangfuzhibudui

cuoshi:quebaowenjianzhongfuzhizhengqueyibanyongTCPxieyi$ORACLE_HOME/network/admin/samplesmuluxiayouyangliwenjiankegongshenkaoyongadapters tnslsnrjianchaxieyichengxu

6TNS-12203 Error

tezheng:bunengyumubiaolianjie

yuanyin:jiantingqishifouqidong;biemingshifoupeizhi

cuoshi:jianchajiantingqishifouqidonglirulsnrctl status;jianchaTNSNAMES.ORAdebiemingpeizhi

7TNS-12533 Error

tezheng:bunengyumubiaolianjie

yuanyin:feifadeaddressshenshu

cuoshi:jianchaTNSNAMES.ORAdeADDRESSshenshu

yongtnsping net_service_nameceshiwangluofuwumingshifoupeizhizhengque

yongsqlpluschengxutongguotestwangluofuwumingjinxingceshirusqlplus system/manager@testruguobunenglianjiedaoshujukuzezaitnsname.orawenjianzhongdetestwangluofuwumingnet servicehoumianjiashangsqlnet.orawenjianNAMES.DEFAULT_DOMAINshenshudezhi

shenmeqingkuangxiahuiyinqioraclezidongshezhiNAMES.DEFAULT_DOMAINshenshu

chuxianzhezhongqingkuangdedianxinghuanjingweiwindowsdekehuduandewodediannaoàshuxingàjisuanjimingàgenggaiàqitaàcijisuanjidezhuDNShouzhuizhongshezhileprimary dns suffixyinweizaizhezhongqingkuangxiaanzhuangkehuduanshihuizaisqlnet.orawenjianzhongzidongshezhiNAMES.DEFAULT_DOMAINshenshuhuoxudangbajisuanjijiaruyuzhonganzhuangoraclekehuduanshiyehuichuxianzhezhongqingkuangyoutiaojiandehuadajiakeyishiyixia

wozaishezhioracledekehuduanshiyibanshougongxiugaitnsnames.orawenjiandanshihuanyouxuduorenxihuanyongtuxinggongjupeizhigaituxinggongjuzuizhonghuanshixiugaitnsnames.orawenjiandanshitayoushihuiyinqiqitadewenti

zaiyongoracledetuxingpeizhiruanjian'net assistant'huoNet Configuration Assistantpeizhiwangluofuwumingshijiaruyijingshezhileprimary dns suffixdanshizaituxingpeizhiruanjianzhongxiedewangluofuwumingdemingzizhongmeiyouprimary dns suffixruzhishixieletestzetuxingpeizhiruanjianhuizidongzaihoumianjiashangprimary dns suffix使shizhibianweitest.testserver.combingcunzaitnsnames.orazhongerbuguannidesqlnet.orawenjianzhongshifouyouNAMES.DEFAULT_DOMAINshenshucishiyongtuxinggongjujinxingceshilianjieshitongguodedanshijiarucishisqlnet.orawenjianzhongmeiyouNAMES.DEFAULT_DOMAINshenshuzenizai使shiyongwangluofuwumingshiyinggai使shiyongzaitnsnames.orazhongdetest.testserver.comerbushinizaituxingpeizhiruanjianzhongjianrudetestjiejuedebanfawei

<1>keyizaisqlnet.orawenjianzhongshezhiNAMES.DEFAULT_DOMAIN= testserver.comzheshinikeyiyongtesthuotest.testserver.comlianjieshujuku

<2>zaisqlnet.orawenjianzhongbushezhiNAMES.DEFAULT_DOMAINshenshuzaitnsnames.orawenjianzhongjiangtest.testserver.comzhongde.testserver.comqudiaozheshinikeyiyongtestlianjieshujuku

原文
1、ORA-12541:TNS:没有监听器 原因:没有启动监听器或者监听器损坏。若是前者,使用命令net start OracleOraHome10gTNSListener(名字可能有出入)即可;如果是后者,则使用“Net Configuration Assistant”工具向导之“监听程序配置”增加一个监听器即可(基本不用写任何信息,一路OK。在添加之前可能需要把所有的监听器先删!) 2、ORA-12500:TNS:监听程序无法启动专用服务器进程或ORA-12560:TNS:协议适配器错误 原因:ORACLE的数据库服务没有启动。使用命令net start ORACLESERVICEORADB(ORADB为数据库名字)即可。如果仍没有解决,请继续向下看。 3、如果数据库服务启动失败,则很有可能是其注册表项值损坏,最好的做法是以下两步: 1)ORADIM -DELETE -SID oradb 删除数据库服务项 2)ORADIM -NEW -SID oradb 新增数据库服务项 注:这个过程中如果出错,就重启计算机! 4、ORA-12154:TNS:能解析服务名 原因:ORACLE的网络服务名没有正确配置。请使用“Net8 Configuration Assistant”工具向导之“本地网络服务名配置”配置TNS即可。如果仍没有解决,请继续向下看。 5、ORA-1034 :TNS:ORACLE不可用 原因:ORACLE的数据库服务正确启动,但是数据库没有打开! 使用命令: 1)svrmgrl 启动服务管理器 2)connect internal 以internal身份登陆 3)startup 打开数据库 6、ORA-12560:TNS:协议适配器错误(顽固性的) 原因:未知。 解决:必杀技--打开“Windows任务管理器”,杀死ORACLE.exe及ORADIM.exe进程,书写自己的ora_startup.bat,执行之! PS: 1、ora_startup.bat: net start OracleOraHome81TNSListener net start ORACLESERVICEORADB svrmgrl 一般情况下不用,不过有时少不了它的,具体步骤见第5步。 2、ora_shutdown.bat: net stop OracleOraHome81TNSListener net stop ORACLESERVICEORADB 3、ORACLE相关服务名请参见“管理工具”之“服务”中以ORACLE开头的服务名 1、TNS-12154 Error 或ORA-12154 特征:SQL*NET没有找到连接串或别名 原因1:(1)没有找到TNSNAMES.ORA文件,该文件的缺省路径为: Windows 95/98 client SQL*Net 2.x - ORAWIN95NETWORKADMIN Net8 - ORAWIN95NET80admin Net8i - ORACLEORA81NETWORKADMIN Windows NT client SQL*Net 2.x - ORANTNETWORKADMIN Net8 - ORANTNET80ADMIN Net8i - ORACLEORA81NETWORKADMIN UNIX Client $ORACLE_HOME/NETWORK/ADMIN or /etc or /var/opt/oracle . 在客户端设置TNS_ADMIN 在注册表 HKEY_LOCAL_MACHINESoftwareOracle 设置TNS_ADMIN. TNS_ADMIN 指向TNSNAMES.ORA文件的位置 措施:按上述说明检查文件位置 原因2:(2)TNSNAMES.ORA文件中内容格式不对 措施:检查文件格式,标准格式如下: DEV1.WORLD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 145.45.78.56) (Port = 1521) ) ) (CONNECT_DATA = (SID = ORCL) ) ) 原因3: (3) TNSNAMES.ORA与SQLNET.ORA不一致 措施: SQLNET.ORA格式如下: TRACE_LEVEL_CLIENT = OFF SQLNET.AUTHENTICATION_SERVICES = (NONE) NAMES.DIRECTORY_PATH = (TNSNAMES) AUTOMATIC_IPC = OFF 因为没有NAMES.DEFAULT_DOMAIN=world,所以DEV1.WORLD连接串不能连接,可以在TNSNAMES.ORA中增加 DEV1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 145.45.78.56) (Port = 1521) ) ) (CONNECT_DATA = (SID = ORCL) ) ) 此时可连接。 2、NL-00462 Error 或ORA-00462 特征:监听器无法启动 原因:LISTENER.ORA文件内容错误,例如,括号不匹配、参数名错误等、多余的空格等。 措施:重新编辑文件 3、NL-00405 Error 或ORA-00405 特征:LISTENER.ORA文件不可读或找不到 原因:LISTENER.ORA文件内容错误,例如,括号不匹配、参数名错误等、多余的空格等。 措施:确保文件位置在缺省目录下$ORACLE_HOME/network/admin,或设置环境变量TNS_ADMIN指向这个文件所在位置。 4、TNS-01155 Error 或ORA-01155 特征:LISTENER.ORA文件中SID_LIST_LISTENER变量赋值不对 原因:LISTENER.ORA文件内容错误,SID_LIST_LISTENER变量赋值不对。 措施:确保文件中赋值正确,$ORACLE_HOME/network/admin/samples目录下有样例文件,可供参考。 5、TNS-12537 、TNS-12560、TNS-00507 Error 特征:LISTENER.ORA文件中引用了一个无效的协议适配程序 原因:LISTENER.ORA文件中PROCOTOL变量赋值不对。 措施:确保文件中赋值正确,一般用TCP协议,$ORACLE_HOME/network/admin/samples目录下有样例文件,可供参考。用adapters tnslsnr检查协议程序 6、TNS-12203 Error 特征:不能与目标连接 原因:监听器是否启动;别名是否配置 措施:检查监听器是否启动,例如lsnrctl status;检查TNSNAMES.ORA的别名配置 7、TNS-12533 Error 特征:不能与目标连接 原因:非法的address参数, 措施:检查TNSNAMES.ORA的ADDRESS参数 1)用tnsping net_service_name测试网络服务名是否配置正确!! 2)用sqlplus程序通过test网络服务名进行测试,如sqlplus [url=mailto:system/manager@test]system/manager@test[/url]。如果不能连接到数据库,则在tnsname.ora文件中的test网络服务名(net service)后面加上sqlnet.ora文件NAMES.DEFAULT_DOMAIN参数的值,  什么情况下会引起oracle自动设置NAMES.DEFAULT_DOMAIN参数? 出现这种情况的典型环境为windows的客户端的‘我得电脑à属性à计算机名à更改à其它…à此计算机的主DNS后缀’中设置了‘primary dns suffix’,因为在这种情况下安装客户端时,会在sqlnet.ora文件中自动设置NAMES.DEFAULT_DOMAIN参数,或许当把计算机加入域中安装oracle客户端时也会出现这种情况,有条件的话大家可以试一下。 我在设置oracle的客户端时一般手工修改tnsnames.ora文件,但是还有许多人喜欢用图形工具配置,该图形工具最终还是修改tnsnames.ora文件,但是它有时会引起其它的问题: 在用oracle的图形配置软件'net assistant'或‘Net Configuration Assistant’配置网络服务名时,假如已经设置了‘primary dns suffix’,但是在图形配置软件中写的网络服务名的名字中没有‘primary dns suffix’,如只是写了test,则图形配置软件会自动在后面加上‘primary dns suffix’,使之变为test.testserver.com,并存在tnsnames.ora中,而不管你的sqlnet.ora文件中是否有NAMES.DEFAULT_DOMAIN参数。此时,用图形工具进行测试连接是通过的,但是假如此时sqlnet.ora文件中没有NAMES.DEFAULT_DOMAIN参数,则你在使用网络服务名时应该使用在tnsnames.ora中的test.testserver.com,而不是你在图形配置软件中键入的test。解决的办法为: <1>可以在sqlnet.ora文件中设置NAMES.DEFAULT_DOMAIN= testserver.com,这时你可以用test或test.testserver.com连接数据库 <2>在sqlnet.ora文件中不设置NAMES.DEFAULT_DOMAIN参数,在tnsnames.ora文件中将test.testserver.com中的.testserver.com去掉,这时你可以用test连接数据库。
󰈣󰈤
 
 
 
>>返回首页<<
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
王朝网络微信公众号
微信扫码关注本站公众号wangchaonetcn
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有