数据库:oracle 19.12
系统:rhel 8.4
问题描述:oracle用户下ORACLE_HOME/network/admin/目录下sqlnet.ora文件存在时,sqlplus / as sysdba连接数据库异常,不存在时sqlplus / as sysdba连接正常
[oracle@dbserver admin]$ mv sqlnet01.ora sqlnet.ora
[oracle@dbserver admin]$ cat sqlnet.ora
# sqlnet.ora Network Configuration File: /u01/app/oracle/product/19.12.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
# 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.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)
[oracle@dbserver ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jul 23 15:52:11 2022
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@dbserver admin]$ mv sqlnet.ora sqlnet01.ora
[oracle@dbserver ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jul 23 15:52:45 2022
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.12.0.0.0
其实asm单实例环境在grid用户下ORACLE_HOME/network/admin目录下也有一个sqlnet.ora
[grid@dbserver grid]$ cd network/admin
[grid@dbserver admin]$ ll
total 16
-rw-r-----. 1 grid oinstall 558 Sep 11 2021 listener.ora
drwxr-xr-x. 2 grid oinstall 64 Apr 17 2019 samples
-rw-r--r--. 1 grid oinstall 1536 Feb 14 2018 shrept.lst
-rw-r-----. 1 grid oinstall 177 Sep 11 2021 sqlnet.ora
-rw-r--r--. 1 grid oinstall 402 Jul 4 10:15 tnsnames.ora
oracle用户下的sqlnet.ora是笔者后面添加用作测试,将其删掉后,就可以通过操作系统认证的方式连接数据库.
[oracle@dbserver admin]$ ll
total 12
drwxr-xr-x. 2 oracle oinstall 64 Jul 9 09:54 samples
-rw-r--r--. 1 oracle oinstall 1536 Feb 14 2018 shrept.lst
-rw-r--r--. 1 oracle oinstall 449 Jul 23 15:39 sqlnet.ora
-rw-r-----. 1 oracle oinstall 1274 Jul 21 17:34 tnsnames.ora