您当前位置:
首页 >
数据库 >
数据库应用 > Oracle中su切换进去sqlplus登录失败的问题处理
Oracle中su切换进去sqlplus登录失败的问题处理
来源:程序员人生 发布时间:2015-01-20 08:13:29 阅读次数:7431次
问题描写:
生产环境的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*PlusSP2-0667: Message file sp1<lang>.msb not foundSP2-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/profileexport 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登录1下,试试看
[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,做1下sqlplus的软连接
[oracle@localhost root]$ exitexit[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 2015Copyright (c) 1982, 2009, Oracle. All rights reserved.ERROR:ORA⑴2162: TNS:net service name is incorrectly specifiedEnter user-name: ERROR:ORA⑴2162: TNS:net service name is incorrectly specifiedEnter user-name: ERROR:ORA⑴2162: TNS:net service name is incorrectly specifiedSP2-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_SID6,设置ORACLE_SID
[oracle@localhost root]$ exitexit[root@localhost ~]# vim /etc/profileexport ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1/export ORACLE_SID=pxxerxxs[root@localhost ~]# source /etc/profile [oracle@localhost root]$ exitexit[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 2015Copyright (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 functionsif [ -f ~/.bashrc ]; then. ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATH#added for oracleexport ORACLE_BASE=/oracle/app/oracleexport ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1export ORACLE_SID=pxxerxxsexport TNS_ADMIN=$ORACLE_HOME/network/adminexport PATH=$PATH:$ORACLE_HOME/bin[oracle@localhost root]$ 配置里面有值,问题在哪里?8,su的时候有差异
不加-的话的话只是切换用户 不去更换用户的配置,加上-后 再去sqlplus 试试
[oracle@localhost ~]$ exitlogout[root@localhost ~]# su oracle[oracle@localhost root]$ echo $ORACLE_BASE[oracle@localhost root]$ exitexit[root@localhost ~]# su - oracle[oracle@localhost ~]$ echo $ORACLE_BASE/oracle/app/oracle[oracle@localhost ~]$9,验证下su - oracle
[oracle@localhost ~]$ 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:36:51 2015Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, Oracle Label Security, OLAP, Data Mining,Oracle Database Vault and Real Application Testing optionsSQL> 10,OK,尝试使用非sys账号登录报错
[oracle@localhost ~]$ rlwrap sqlplus "plas_prd/plrd_1628@pxxerxxs 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 16:53:11 2015Copyright (c) 1982, 2009, Oracle. All rights reserved.ERROR:ORA⑴2154: TNS:could not resolve the connect identifier specifiedEnter user-name: ERROR:ORA-01017: invalid username/password; logon deniedEnter user-name: [oracle@localhost ~]$ 11,去check下,tnsping pxxerxxs 能否成功
[oracle@localhost ~]$ tnsping pxxerxxsTNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 16-JAN⑵015 16:53:27Copyright (c) 1997, 2009, Oracle. All rights reserved.Used parameter files:/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.oraTNS-03505: Failed to resolve name[oracle@localhost ~]$ tnsping失败,得知pxxerxxs这个失效12,去找tnsnames.ora
[oracle@localhost admin]$ more /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora也能够more $ORACLE_HOME/network/admin/tnsnames.ora找到MPMD2 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.16
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
------分隔线----------------------------
------分隔线----------------------------