Oracle常见问题及解决方法

--------ORA-12154: TNS:could not resolve service name--------
解决步骤:

ORA-12154: TNS:could not resolve service name

错误指出客户不能查找到tnsnames.ora文件中所列举的服务。

查错误码显示:

ORA-12154: TNS:could not resolve service name
Cause: Oracle Net could not locate the net service name specified in the tnsnames.ora configuration file.

Action: Perform. these steps:
1.Verify that a tnsnames.ora file exists.(See Also: "Localized Configuration File Support" for configuration file location information)

2.Verify that there are not multiple copies of the tnsnames.ora file.

3.In the tnsnames.ora file, verify that the net service name specified in your connect string is mapped to a connect descriptor.

4.Verify that there are no duplicate copies of the sqlnet.ora file.

5.If you are using domain names, verify that your sqlnet.ora file contains a NAMES.DEFAULT_DOMAIN parameter. If this parameter does not exist, you must specify the domain name in your connect string.

6.If you are not using domain names, and this parameter exists, delete it or disable it by commenting it out.

7.If you are connecting from a login dialog box, verify that you are not placing an "@" symbol before your connect net service name.

8.Activate client tracing and repeat the operation.

实践步骤:
Cause: Oracle Net could not locate the database service name or net service name specified in the directory server.

Action: Perform. these steps:
1.Verify that the database service or net service name entry exists in the directory that this computer was configured to use.
  (See Also: Chapter 8, "Setting Up Directory Server Usage" for directory setup instructions)

2.Verify that the sqlnet.ora file includes the following entry: NAMES.DIRECTORY_PATH=(ldap, other_naming_methods)
  根据文档中的提示第三步3.(1.2没问题了)检查tnsnames.ora文件中的服务名称是否正确的配置,经过检查(SERVICE_NAME = hatest)没有问题
  然后按照文档做第4.5步,到第6步时发现问题,sqlnet.ora文件中引用了domain域(注:我们这边没使用域)
  [oracle@localhost admin]$ cat sqlnet.ora
  # SQLNET.ORA Network Configuration File: /home/oracle/OraHome1/network/admin/sqlnet.ora
  # Generated by Oracle configuration tools.
  NAMES.DEFAULT_DOMAIN = localdomain
  NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)--这个没问题啦

  好了那还等什么编辑该文件把domain干掉。编辑完后赶快tnsping hatest
  [oracle@localhost admin]$ tnsping hatest
  TNS Ping Utility for Linux: Version 9.2.0.4.0 - Production on 26-APR-2007 16:33:39
  Copyright (c) 1997 Oracle Corporation.  All rights reserved.
  Used parameter files:
  /home/oracle/OraHome1/network/admin/sqlnet.ora
  Used TNSNAMES adapter to resolve the alias
  Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 
  192.168.248.155)(PORT = 1521))) (CONNECT_DATA = (SID = hatest) (SERVER = DEDICATED)))
  OK (30 msec)

  没问题通了。再连接 数据库

  [oracle@localhost admin]$ sqlplus hangan/hangan@hatest
  SQL*Plus: Release 9.2.0.4.0 - Production on Thu Apr 26 16:33:49 2007
  Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
  Connected to:
  Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
  With the Partitioning, OLAP and Oracle Data Mining options
  JServer Release 9.2.0.4.0 - Production

  SQL> exit
----------------------------------------------------------------------------------------------------------------------------------------

看了上面的描述之后,我按照步骤一步步检查,到了检查sqlnet.ora文件的时候,问题就出来了。原来这位同事的sqlnet.ora文件中是这样的:

# SQLNET.ORA Network Configuration File: C:\oracle\ora81\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DEFAULT_DOMAIN = eapac.ericsson.se

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (ONAMES)

可以看到这里只使用了ONAMES来查找服务,但他的服务是配置在tnsnames.ora文件中,当在SQL*PLUS中连接时,Oracle不是按tnsname的方式来查找,当然找不到服务了。

问题找到了,将NAMES.DIRECTORY_PATH 改为:
NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, ONAMES)


自己总结的解决过程:
1.物理连接:ping命令,检验网络是否可以连接;
2.端口是否打开:netstat -na,查看端口是否可用;
3.服务端监听:lsnrctl status;
4.服务端tnsnames:tnsping 服务名;
5.客户端tnsnames:tnsping 客户端服务;
6.服务器是否有防火墙,有,则打开端口:telnet ip 端口;例如:telnet 10.80.11.137 1521

找到原因是服务器打了xp sp2并启用了防火墙将客户端来访程序拦截掉了的缘故,将防火墙关闭即可解决问题。

---------------------IMP-00010: 标题验证失败---------------------------
问题原因:
1.imp/exp的版本不对,也就是说低版本的导出,可以用高版本的导入,但高版本导出不能用低版本的导入,这个版本不只是指imp/exp的版本,也是指数据库的版本
2.可能你在用ftp download时未设置binary的传输方式,导致文件损坏
结果方法:
1.用UltraEdit-32打开dmp文件可看到版本信息,是否由于版本高低问题引起的;
2.重新导出一次dmp文件;

----------------Ora-01536:超出了表空间users的空间限量-----------
问题原因:ora-1536 是指的你建表的那个user 所能使用的空间没有了,不是那个表所在的tablespace 没有free space 了。
解决办法:解决办法增大能够使用的表空间数或授予无限制的使用权限
例如: ALTER USER A QUOTA 50M ON users;
      ALTER USER  A  QUOTA UNLIMITED ON users;

-----------------ORA-01034:Shared memory realm does not exist------
问题原因:
        1.ORACLE_HOME或者ORACLE_SID设置不正确;
        2.文件路径发生了变化,路径不正确;
        3.在Windows环境下有的时候连接不上远程的数据库,会报告如此的错误。
解决办法:
        1.window命令行设置:set ORACLE_SID=HZASA
        2.检查注册表中检查路径是否正确:ORACLE_HOME
        3.把sqlnet.ora文件中的
         SQLNET.AUTHENTICATION_SERVICES = (NTS) NTS换为NONE
备注:可以通过控制文件,检查文件路径是否正确。(数据文件、日志文件、归档日志文件、控制文件等)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值