最近在使用官方给出的priv-build vm 的 oracle 12c 数据库,使用操作系统认证登录遇到错误:
[oracle@vbgeneric dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Dec 5 23:48:33 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
检查数据库 参数 remote_login_passwordfile 都是正确的设置
检查密码文件也是正确,查看sys 密码 与 密码文件的字符是否一致
密码加密也是一致,查看数据库参数 thread 线程是否为true
查看当前环境变量,发现有个疑问 变量 TWO_TASK
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if test "m$JAVAENV" = "m"
then
export TMZ="GMT"
export JAVA_HOME=`ls -d /home/oracle/java/jdk*`
export PATH=$JAVA_HOME/bin:/home/oracle/sqlcl/bin:/home/oracle/sqldeveloper:/opt/datamodeler:$PATH:/home/oracle/sqlcl/bin:/home/oracle/sqldeveloper:/home/oracle/bin
export JAVAENV=true
fi
if test "m$DBENV" = "m"
then
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_UNQNAME=orcl12c
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=orcl12c
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export DBENV=true
#export SQL_OR_SQLPLUS=sql -oci
export SQL_OR_SQLPLUS=sqlplus
fi
if test "m$DONOTSETTWO_TASK" = "m"
then
export TWO_TASK=ORCL
fi
尝试取消 unset TWO_TASK
unset TWO_TASK
[oracle@vbgeneric ~]$ echo $TWO_TASK
ORCL
[oracle@vbgeneric ~]$ echo $ORACLE_SID
orcl12c
[oracle@vbgeneric ~]$ unset TWO_TASK
[oracle@vbgeneric ~]$ echo $TWO_TASK
[oracle@vbgeneric ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Dec 5 23:47:26 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT