是否忘记编辑 oracle 用户的 .bash_profile 文件了?echo $ORACLE_SID
echo $ORACLE_BASE
echo $ORACLE_HOME
echo $PATH
... ....
 
一、确定 oracle 用户属于 dba 组 (id 命令)
二、确定 oracle 用户对 $ORACLE_HOME 路径有读写权限。(ls -l 命令)

解决方案 »

  1.   

    [oracle@oracleDB1 bin]$ echo $ORACLE_SID
    ORCL
    [oracle@oracleDB1 bin]$ echo $ORACLE_BASE
    /u01/app/oracle
    [oracle@oracleDB1 bin]$ echo $ORACLE_HOME
    /u01/app/oracle/product/11.2.0/dbhome_1
    [oracle@oracleDB1 bin]$ echo $PATH
    /u01/app/oracle/product/11.2.0/dbhome_1/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/home/oracle/bin:/home/oracle/bin:/home/oracle/bin
    [oracle@oracleDB1 bin]$ id
    uid=500(oracle) gid=501(oinstall) 组=501(oinstall),502(dba) 环境=system_u:system_r:initrc_t:s0
    [oracle@oracleDB1 bin]$ cat $ORACLE_HOME/bin/dbstartLOGMSG="logger -puser.alert -s "trap 'exit' 1 2 3# for script tracing
    case $ORACLE_TRACE in
      T) set -x ;;
    esac
        
    # Set path if path not set (if called from /etc/rc)
    SAVE_PATH=/bin:/usr/bin:/etc:${PATH} ; export PATH
    SAVE_LLP=$LD_LIBRARY_PATH# First argument is used to bring up Oracle Net Listener
    ORACLE_HOME_LISTNER=$ORACLE_HOME
    if [ ! $ORACLE_HOME_LISTNER ] ; then
      echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
      echo "Usage: $0 ORACLE_HOME"
    else
      LOG=$ORACLE_HOME_LISTNER/listener.log
    [oracle@oracleDB1 bin]$ cd ~
    [oracle@oracleDB1 ~]$ cat .bash_profile
    # .bash_profile# Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
    ORACLE_SID=ORCL
    PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
    #LANG=C
    #LANG=zh_CN.UTF-8
    export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH LANG
    [oracle@oracleDB1 ~]$ cat /etc/oratab
    ## This file is used by ORACLE utilities.  It is created by root.sh
    # and updated by the Database Configuration Assistant when creating
    # a database.# A colon, ':', is used as the field terminator.  A new line terminates
    # the entry.  Lines beginning with a pound sign, '#', are comments.
    #
    # Entries are of the form:
    #   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
    #
    # The first and second fields are the system identifier and home
    # directory of the database respectively.  The third filed indicates
    # to the dbstart utility that the database should , "Y", or should not,
    # "N", be brought up at system boot time.
    #
    # Multiple entries with the same $ORACLE_SID are not allowed.
    #
    #
    orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N
    WJFCDB:/u01/app/oracle/product/11.2.0/dbhome_1:Y
    WJGCJSDB:/u01/app/oracle/product/11.2.0/dbhome_1:Y
    WJOADB:/u01/app/oracle/product/11.2.0/dbhome_1:Y
    [oracle@oracleDB1 ~]$ cat $ORACLE_HOME/network/admin/sqlnet.ora# sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
    # Generated by Oracle configuration tools.NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)ADR_BASE = /u01/app/oracleSQLNET.AUTHENTICATION_SERVICES = (ALL)
    [oracle@oracleDB1 ~]$ dbstart
    SQL*Plus: Release 11.2.0.1.0 Production on Mon May 12 19:30:41 2014Copyright (c) 1982, 2009, Oracle.  All rights reserved.SQL> ERROR:
    ORA-01031: ????
    我把主要的的配置文件都打印了一下.............
      

  2.   

    Troubleshooting ORA-1031 when connecting as SYSDBA using OS Authentication1. Check whether the OS user is part of the OSDBA group.A. See what are the groups of the user:[oracle@seclin4 ~]$ id
    uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba) context=user_u:system_r:unconfined_tB. See what is the OSDBA group defined in file $ORACLE_HOME/rdbms/lib/config.[cs]Example for Linux:[oracle@seclin4 ~]$ cat $ORACLE_HOME/rdbms/lib/config.c/* SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access. */
    /* Refer to the Installation and User's Guide for further information. *//* IMPORTANT: this file needs to be in sync with
    rdbms/src/server/osds/config.c, specifically regarding the
    number of elements in the ss_dba_grp array.
    */#define SS_DBA_GRP "dba"
    #define SS_OPER_GRP "dba"
    #define SS_ASM_GRP ""char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP, SS_ASM_GRP};In the above examples we see that the user is a member of the "dba" group which matches the value of  SS_DBA_GRP in config.c. If the groups seem to be correctly configured but the connection is still failing use the script from Note 67984.1  to see whether Oracle evaluates correctly the group membership.Intermittent ora-1031 errors for sysdba OS authentication can occur because of the nscd service that caches information from the /etc/passwd and /etc/group as configured in /etc/nscd.conf, if stopping this service makes the problem go away then please refer to the OS vendor.2. Check the value of the SQLNET.AUTHENTICATION_SERVICES parameter in file $ORACLE_HOME/network/admin/SQLNET.ORA On UnixThis parameter should not be set if no strong authentication method is used. If such a method is being used then set the parameter to one of the following values:  SQLNET.AUTHENTICATION_SERVICES = (ALL)
     or SQLNET.AUTHENTICATION_SERVICES = (BEQ,<the strong auth method>)Where  <the strong auth method> can be any combination of the following values: TCPS, KERBEROS5, RADIUSNOTE: If the definition of SQLNET.AUTHENTICATION_SERVICES is preceded by a leading blank space, an ORA-1031 error may occur
      

  3.   

    按照版主大人的建议,看了一下相关配置,还是不行啊,sqlplus / as sysdba 还是提示要密码。我要疯了!!!!
    救命啊![oracle@OracleDB ~]$ id
    uid=500(oracle) gid=501(oinstall) 组=501(oinstall),502(dba) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [oracle@OracleDB ~]$ cat $ORACLE_HOME/rdbms/lib/config.c/*  SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access.  */
    /*  Refer to the Installation and User's Guide for further information.  *//* IMPORTANT: this file needs to be in sync with
                  rdbms/src/server/osds/config.c, specifically regarding the
                  number of elements in the ss_dba_grp array.
     */#define SS_DBA_GRP "dba"
    #define SS_OPER_GRP "dba"
    #define SS_ASM_GRP ""char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP, SS_ASM_GRP};   
    [oracle@OracleDB ~]$ cat $ORACLE_HOME/network/admin/sqlnet.ora
    # sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
    # Generated by Oracle configuration tools.NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)ADR_BASE = /u01/app/oracleSQLNET.AUTHENTICATION_SERVICES=(ALL)[oracle@OracleDB ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
    # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.TEST2 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = OracleDB)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = TEST2)
        )
      )TEST1 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.213.132)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = TEST1)
        )
      )LISTENER_ORCL =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.213.132)(PORT = 1521))
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.213.132)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )[oracle@OracleDB ~]$ cat $ORACLE_HOME/network/admin/listener.ora
    # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (GLOBAL_DBNAME = orcl)
          (SID_NAME = orcl)
          (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
        )
        (SID_DESC =
          (GLOBAL_DBNAME = TEST1)
          (SID_NAME = TEST1)
          (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
        )
      (SID_DESC =
          (GLOBAL_DBNAME = TEST2)
          (SID_NAME = TEST2)
          (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
        )
      )LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = OracleDB)(PORT = 1521))
        )
      )ADR_BASE_LISTENER = /u01/app/oracle[oracle@OracleDB ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 26 15:39:01 2014Copyright (c) 1982, 2009, Oracle.  All rights reserved.ERROR:
    ORA-01031: insufficient privileges
    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