sqlplus / as sysdba 报错:ora-01031 insufficient privileges

今天在使用sqlplus / as sysdba登陆时,竟然报错:ora-01031 insufficient privileges。当时我直接就纳闷掉了,平时等的时候都好好的啊,怎么现在就不行了。

这时我想,我这样是属于操作系统认证的登陆方法啊,而且用户也是oracle用户啊。

[oracle@normal ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 7 21:54:21 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-01031: insufficient privileges

[oracle@normal ~]$ id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(vboxsf)
这时,郁闷的时候我随便又试了一下用其他账户登竟然可以登陆,这真是太神奇了:

[oracle@test ~]$ sqlplus chenhao/oracle
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 7 21:57:45 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
在我抓狂的时候,想了下是不是在哪里有设置啊,能设置使用sqlplus登陆相关文件也就只用tnsnames.ora、listener.ora、sqlnet.ora。应该和tnsnames.ora、listener.ora没有很大的关系吧。于是就去看了一下sqlnet.ora其中有SQLNET.AUTHENTICATION_SERVICES选项:

SQLNET.AUTHENTICATION_SERVICES

Purpose

To enable one or more authentication services. If authentication has been installed, then it is recommended that this parameter be set to either none or to one of the authentication methods.

Default

None

Note:

When installing the database with Database Configuration Assistant (DBCA), this parameter may be set to  nts in the sqlnet.ora file.

Values

  • Authentication Methods Available with Oracle Net Services:

    • none for no authentication methods, including Microsoft Windows native operating system authentication. When SQLNET.AUTHENTICATION_SERVICESis set to none, a valid user name and password can be used to access the database.

    • all for all authentication methods.

    • nts for Microsoft Windows native operating system authentication.

  • Authentication Methods Available with Oracle Advanced Security:

    • kerberos5 for Kerberos authentication.

    • radius for RADIUS authentication.

    • tcps for SSL authentication.

根据官方推荐的使用默认值none,于是我就设置为none:

[oracle@test admin]$ cat sqlnet.ora 
SQLNET.AUTHENTICATION_SERVICES= (NONE) 
NAMES.DIRECTORY_PATH= (TNSNAMES,HOSTNAME) 
再次使用sqlplus / as sysdba登陆成功:

[oracle@test ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 7 21:57:45 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

提示:如设置none不行那就直接把SQLNET.AUTHENTICATION_SERVICES个删了;

你可能感兴趣的:(oracle,sqlplus,实战,11g)