$cat /U01/app/oracle/product/11.2.0.4/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_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)
使用tnsping来检测tns连接串的情况,也没有发现任何问题。当然这个地方和sqlplus / as sysdba 应该没有直接关系,但是通过这个可以说明网络服务配置都是合理的。
[admin]$tnsping cytj
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 07-MAR-2016 18:02:35
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/U01/app/oracle/product/11.2.0.4/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.127.131.190)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cytj)))
OK (20 msec)
使用一个普通用户来本地连接测试,发现scott用户是锁定的,通过这个也能够说明连接是起了作用了。
[admin]$sqlplus scott/tiger
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 7 18:03:40 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-28000: the account is locked
然后换做tns连接的方式,发现错误也是一样,说明走网络连接的方式也起作用了。
[admin]$sqlplus scott/tiger@cytj
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 7 18:03:40 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-28000: the account is locked
然后对于这个错误,在这个系统中摸索了一番,发现这个路径着实够乱,竟然存在两个ORACLE_HOME,
当前的是:
/U01/app/oracle/product/11.2.0.4/dbs
发现的新ORACLE_HOME是
/home/U01/app/oracle/product/11.2.0.4/dbs
但是经过一番论证发现然并卵,这个路径对这个问题实际上没有造成什么影响。
因为ORACLE_HOME这些配置完全和另外一个ORACLE_HOME没有任何关联。
还有一些可能就是和密码文件有关,于是我手工修改了sys密码,再次登录。
[dbs]$sqlplus system/oracle
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 7 22:12:11 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning and Real Application Testing options
SQL> alter user sys identified by oracle;
User altered.
然后再次登录,问题依旧。
这个时候还可以进一步排除密码文件的影响,比如我指定了一个不存在的实例test,这个时候sqlplus / as sysdba应该接入一个空实例。
$export ORACLE_SID=test
$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 7 19:28:42 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
然后进一步测试,发现dg broker登录也有问题。
[dbs]$dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
ORA-01017: invalid username/password; logon denied
使用rman来登录发现也是同样的错误。
[dbs]$rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 7 19:29:36 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01017: invalid username/password; logon denied
好了,事已至此,可以充分肯定问题出在这个本地操作系统认证上,oracle所在的用户组都是没有问题的。
操作系统认证在$ORACLE_HOME/network/admin/sqlnet.ora也有一些关系。
我们看看这个文件是怎么配置的。
[admin]$vi sqlnet.ora
# sqlnet.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_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)
xxxx
看到这个问题,一下子明白了原委,就是下面的配置导致的问题。
SQLNET.AUTHENTICATION_SERVICES= (NTS)
这个应该是在windows中的配置,怎么在linux里面设置这个,可见最开始就是从windows中拷贝的这个文件,怎么进一步印证呢,可以看看sqlnet.ora的注释部分,里面的路径就是D盘的路径,也有注释说了是在NT环境下,在linux环境中,这个参数其实是不需要的。
注释掉之后。
再次登录就没有任何问题了。