问题描述:
windows平台,数据库版本为Oracle 11.2.0.4,以sqlplus / as sysdba登录出现ora-01017
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期四 1月 21 11:06:43 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
请输入用户名:
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
请输入用户名:
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
用另一种方式登录,也出现相同的报错
C:\Users\Administrator>sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on 星期四 1月 21 11:06:49 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> exit
当前操作系统用户是administrator,已经是管理员权限了,不存在权限不够的问题,那应该就是操作系统认证的环节出现了问题,查看sqlnet.ora文件:
E:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\sqlnet.ora
# sqlnet.ora Network Configuration File: E:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES = (NONE)
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
ADR_BASE = E:\oracle
果然,SQLNET.AUTHENTICATION_SERVICES = (NONE)关闭了操作系统认证。
SQLNET.AUTHENTICATION_SERVICES有3个参数:
SQLNET.AUTHENTICATION_SERVICES = (NONE) 关闭操作系统认证
SQLNET.AUTHENTICATION_SERVICES = (ALL) 开启LINUX和AIX操作系统认证
SQLNET.AUTHENTICATION_SERVICES = (NTS) 开启windows操作系统认证
修改SQLNET.AUTHENTICATION_SERVICES参数
# sqlnet.ora Network Configuration File: E:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\sqlnet.ora
# Generated by Oracle configuration tools.
#SQLNET.AUTHENTICATION_SERVICES = (NONE)
#SQLNET.AUTHENTICATION_SERVICES = (ALL)
SQLNET.AUTHENTICATION_SERVICES = (NTS)
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
ADR_BASE = E:\oracle
连接数据库正常:
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期四 1月 21 12:02:09 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> set linesize 200
SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
------------------ ---------------------------------------- --------------------------------
ORCL READ WRITE PRIMARY
SQL>