sqlplus连接oracle失败分析和解决
背景:
多台Linux服务器需要安装Oracle客户端,实现和Oracle数据库连接做业务处理。
安装完第一台后,直接将安装的目录压缩并复制到其他几台机器上,启动sqlplus连接数据库时,一直提示输入用户名和密码。
[xxxxxxx]$ sqlplus user/pass@orcl SQL*Plus: Release 11.2.0.4.0 Production on Fri Feb 5 10:56:38 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified Enter user-name: user
Enter password:
ERROR:
ORA-12545: Connect failed because target host or object does not exist Enter user-name: user
Enter password:
使用strace跟踪发现有错误ORA-21561: OID generation failed输出。
strace sqlplus user/pass@orcl
close(5) = 0
write(1, "ERROR:\n", 7ERROR:
) = 7
write(1, "ORA-21561: OID generation failed"..., 33ORA-21561: OID generation failed
) = 33
write(1, "\n", 1
) = 1
write(1, "\n", 1
) = 1
write(1, "Enter user-name: ", 17Enter user-name: ) = 17
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7feaa51c9000
read(0, ^C <unfinished ...>
出现错误ORA-21561: OID generation failed的原因是主机名和hosts文件中的主机名不一致导致。
解决方法:
使用命令hostname 查询机器的主机名
[xxxxx]$ hostname
billingserver001
修改/etc/hosts文件,将主机名加入到hosts文件中。
[xxxxx]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.2 billingserver001
重新用sqlplus user/pass@orcl连接数据库,连接成功。
[xxxxx]$ sqlplus user/pass@orcl SQL*Plus: Release 11.2.0.4.0 Production on Fri Feb 5 11:05:57 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>
Done.
sqlplus连接oracle失败分析和解决的更多相关文章
- 【快速查阅】SQLPLUS连接ORACLE
使用SQLPLUS连接ORACLE常用的有两种方式. 一.简易方式 sqlplus 用户名/密码@IP或主机名:端口/数据库服务名称 二.预先配置TNSNAMES的方式 在“%ORACLE_HOME% ...
- Asp.Net 应用程序在IIS发布后无法连接oracle数据库问题的解决方法
asp.net程序编写完成后,发布到IIS,经常出现的一个问题是连接不上Oracle数据库,具体表现为Oracle的本地NET服务配置成功:用 pl/sql 等工具也可以连接上数据库,但是通过浏览器中 ...
- Windows转到linux中,文件乱码,文件编码转换 & 解决sqlplus连接oracle乱码
转载:http://www.cnblogs.com/wanyao/p/3399269.html 最近,学习又重新开始Linux学习,所以一直在Centos中,昨天一朋友把他在Windows下写的C程序 ...
- ArcGis连接oracle失败:ORA-6413:连接未打开
问题: 通过ARCMap 添加Oracle数据库连接时提示,ORA-6413:连接未打开. 运行环境: ArcGis 10.2 Oracle 10g 解决方法: 通过上网查找解决方法,网友说" ...
- SSIS 使用OLEDB/ADO NET Source 数据流source控件 连接Oracle失败
在做数据提取的时候发现一个非常奇怪的问题. Oracle客户端是安装正确并且Toad可以正常运行的,但是在新建OLEDB/ADO NET Source 数据流source控件连接Oracle的时候一直 ...
- PL/SQL连接ORACLE失败,ORA-12154: TNS: could not resolve the connect identifier specified
项目需要使用ORACLE,安装了oracle之后,使用PL/SQL连接,先是提示NOT logger ,后续不知道改了什么提示解析服务器id失败,重新装了之后更狠的直接来了个空白提示 一.安装PLS ...
- sqlplus连接oracle问题
第一次在自己电脑上连接远端数据库,尝试了一上午居然还没成功,后来在网上找了一堆的方法终于是连接上了 -_-!! 总结一下:简单操作:一步到位 我主要是用的oracle 11g的数据库,sqlpl ...
- EF6 连接Oracle 迁移数据错误解决方法
环境:vs2015 + EF6 +ODP 数据库Oracle 11G add-migratioin 正常,但在update-database 时报如下错误: System.Runtime.Serial ...
- 使用SQLPlus连接Oracle实例
使用Windows徽标+R,打开运行对话框,输入cmd并回车. Microsoft Windows Microsoft Corporation.保留所有权利. C:\Users\user> 在C ...
随机推荐
- 抓鼠标的猫(Win32实现,Codeblocks+GCC编译)
程序效果: 猫的眼睛一直跟着鼠标移动: 鼠标经过猫的右脚附近时,猫会抓住鼠标.(未使用Hook) 代码: //main.cpp 1 #include <windows.h> #includ ...
- Ubuntu raid5+lvm实验
首先说一下本次实验的环境:VMware12+Ubuntu (虚拟硬盘+mdadm) 本次实验参照http://allenyu.blog.51cto.com/193668/162067中的流程,下面总结 ...
- [No000087]Linq排序,SortedList排序,二分法排序性能比较
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; ...
- 简单服务接口访问时权限以及缓存HashMap实现
实现拦截器: package com.zqc.share.framework.interceptor; import javax.annotation.Resource; import javax.s ...
- java多线程系类:JUC线程池:05之线程池原理(四)(转)
概要 本章介绍线程池的拒绝策略.内容包括:拒绝策略介绍拒绝策略对比和示例 转载请注明出处:http://www.cnblogs.com/skywang12345/p/3512947.html 拒绝策略 ...
- iis6403、 iis7403.14
iis6ie显示:您无权查看该网页,http错误403-禁止访问.chorme显示:Directory Listing Denied iis7显示:403.14-Forbidden Web 服务器被配 ...
- Java通过ODBC链接数据库并遍历结果的一个问题
上一篇文章谈到怎么连接Oracle数据库,其实通过ODBC也差不多,只是driver要换成JdbcOdbcDriver.配置文件如下: driver=sun.jdbc.odbc.JdbcOdbcDri ...
- MarkdownPad2 Pro v2.4.2.29969 专业中文破解版完美支持table表格语法
在网上搞了半天,终于搞定了支持table简写语法的markdown软件. 下载地址:http://download.csdn.net/detail/wang_jun_hua/8180717 下载包内含 ...
- 在VS中用正则表达式查找或替换
2005VS和2008VS正则替换规则如下(2013VS不适合,不需要的同学可以直接跳到2013VS的操作办法): Example: 查找#incldue中带有gl开头的头文件的,用include.+ ...
- linux shell if
if用法: if [ ] ;then command; elif [ ] ;then command; else command fi if 参数: shell 编程中使用到得if语句内判断参数 –b ...