重庆思庄Oracle、Redhat认证学习论坛

标题: LINUX sqlplus / as sysdba 无法登陆 [打印本页]

作者: mahan    时间: 2023-9-28 10:12
标题: LINUX sqlplus / as sysdba 无法登陆
最最常见的就是ORACLE_SID和ORACLE_HOME设置错了
假如ORACLE正常运行,那么sqlplus只需要正确的ORACLE_HOME和ORACLE_SID就能使用操作系统认证方式登录。

但是还是有一些不常见的错误,总结如下

1. 检查sqlnet.ora文件
Linux规范为:



[oracle@ora1 admin]$ cat sqlnet.ora.bak

# sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.



NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)



ADR_BASE = /u01/app/oracle


[oracle@mpos_sc admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 28 15:23:31 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied
这种情况一般就是因为配置文件中多了


[oracle@mpos_sc admin]$ cat sqlnet.ora
# sqlnet.ora Network Configuration File: /home/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)

ADR_BASE = /home/oracle/product/11.2.0
sqlnet.authentication_services=(nts)
SQLNET.EXPIRE_TIME = 5
这个参数在Windows下默认就是NTS,是正常的,但是在Linux下,需要为ALL或者没有这个参数,才能够使用操作系统进行登陆


2. 检查.bash_profile 文件
[oracle@ora1 admin]$ cat /home/oracle/.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



export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_SID=orcl

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

TZ='America/New_York'; export TZ


3. 检查密码文件,尝试重新生成之后使用密码文件登录
mv 原来的密码文件 .baK 进行备份

[oracle@ora1 dbs]$ orapwd file=orapw$SID password=oracle

然后使用sqlplus sys/oracle@orcl as sysdba   尝试登录

这种方法需要配置静态监听

后面添加:

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

     (GLOBAL_DBNAME = orcl)

     (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)

     (SID_NAME = orcl)

    )

   )


4. 检查oracle权限
[oracle@ora1 bin]$ ll oracle

-rwsr-s--x. 1 oracle oinstall 239626683 8月  30 07:18 oracle

# chmod 6751 oracle

5. 检查用户组权限
检查oracle用户是不是在oinstall 组中,是不是在dba组中







欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2