Oracle中su切换进去sqlplus登录失败的问题处理
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Oracle中su切换进去sqlplus登录失败的问题处理,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4039字,纯文字阅读大概需要6分钟。
内容图文
生产环境的Oracle数据库突然登录不上去了,rlwrap生产环境的oracle数据库突然登录不上去了,rlwrap sqlplus / as sysdba报错如
问题描述:
生产环境的Oracle数据库突然登录不上去了,rlwrap生产环境的oracle数据库突然登录不上去了,rlwrap sqlplus "/ as sysdba"报错如下:rlwrap
[oracle@localhost root]$ rlwrap sqlplus "/ as sysdba"
rlwrap: warning: your $TERM is 'xterm' but rlwrap couldn't find it in the terminfo database. Expect some problems.
rlwrap: Cannot execute sqlplus: Permission denied
[oracle@localhost root]$ sqlplus "/ as sysdba"
bash: sqlplus: command not found
[oracle@localhost root]$
1,oracle登录报错
[oracle@localhost root]$ rlwrap sqlplus "/ as sysdba"
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
[oracle@localhost root]$
[oracle@localhost root]$
2,查看ORACLE_HOME变量,为空值
[oracle@localhost root]$ echo $ORACLE_HOME
[oracle@localhost root]$
3,在/etc/profile设置ORACLE_HOME变量
[root@localhost ~]# vim /etc/profile
export ORACLE_HOME=/opt/oracle/app/oracle/product/11.2.0/dbhome_1
[root@localhost ~]# source /etc/profile
[root@localhost ~]# su oracle
[oracle@localhost root]$
[oracle@localhost root]$ echo $ORACLE_HOME
/oracle/app/oracle/product/11.2.0/dbhome_1/
[oracle@localhost root]$
4,ORACLE_HOME环境变量有值了,再去用sqlplus登录一下,试试看
[oracle@localhost root]$ rlwrap sqlplus "/ as sysdba"
rlwrap: warning: your $TERM is 'xterm' but rlwrap couldn't find it in the terminfo database. Expect some problems.
rlwrap: Cannot execute sqlplus: Permission denied
[oracle@localhost root]$
5,做一下sqlplus的软连接
[oracle@localhost root]$ exit
exit
[root@localhost ~]# ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
[root@localhost ~]# su oracle
[oracle@localhost root]$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 16 10:19:39 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@localhost root]$
[oracle@localhost root]$ echo $ORACLE_SID
[oracle@localhost root]$
系统环境变量里面没有ORACLE_SID
6,设置ORACLE_SID
[oracle@localhost root]$ exit
exit
[root@localhost ~]# vim /etc/profile
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1/
export ORACLE_SID=pxxerxxs
[root@localhost ~]# source /etc/profile
[oracle@localhost root]$ exit
exit
[root@localhost ~]# vim /etc/profile
[root@localhost ~]# source /etc/profile
[root@localhost ~]# su oracle
[oracle@localhost root]$ rlwrap sqlplus "/ as sysdba"
rlwrap: warning: your $TERM is 'xterm' but rlwrap couldn't find it in the terminfo database. Expect some problems.
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 16 10:25:33 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
SQL>
SQL>
7,去oracle用户下查看系统变量
[oracle@localhost root]$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
内容总结
以上是互联网集市为您收集整理的Oracle中su切换进去sqlplus登录失败的问题处理全部内容,希望文章能够帮你解决Oracle中su切换进去sqlplus登录失败的问题处理所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。