Wednesday, 2 November 2016

ORA-01031: insufficient privileges - sqlplus "/ as sysdba"

Summary 

When you try to connect from Linux (Unix) as sysdba you get the error:
$>sqlplus "/ as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 10 23:20:28 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

ERROR:
ORA-01031: insufficient privileges



Solution
++++++++
If the instance is RAC ,check config.c file on both nodes and find out the difference between two.


[oracle@cstsd12 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jun 14 12:59:50 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

ERROR:
ORA-01031: insufficient privileges


Enter user-name:


cstsd11
++++++++
[oracle@cstsd11 bin]$ cat $ORACLE_HOME/rdbms/lib/config.c
/*  $Header: config_ux.tmp 120.0 2005/10/13 10:30:15 ssuraj noship $ */

/*  SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access. */
/*  Refer to the Installation and User's Guide for further information.   */

#define SS_DBA_GRP "dba"
#define SS_OPER_GRP "dba"

char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP};
[oracle@cstsd11 bin]$




cstsd12
++++++++++

[oracle@cstsd12 ~]$  cat $ORACLE_HOME/rdbms/lib/config.c
/*  $Header: config_ux.tmp 120.0 2005/10/13 10:30:15 ssuraj noship $ */

/*  SS_DBA_GRP defines the UNIX group ID for sqldba adminstrative access. */
/*  Refer to the Installation and User's Guide for further information.   */

#define SS_DBA_GRP "oracle"
#define SS_OPER_GRP "oracle"

char *ss_dba_grp[] = {SS_DBA_GRP, SS_OPER_GRP};

[oracle@cstsd12 ~]$



So the workaround is: 
1. Edit $ORACLE_HOME/rdbms/lib/config.c and set the correct groups, for example

[oracle@cstsd12 ~]$ cp -r $ORACLE_HOME/rdbms/lib/config.c $ORACLE_HOME/rdbms/lib/config.c_latest
[oracle@cstsd12 ~]$ vi $ORACLE_HOME/rdbms/lib/config.c
[oracle@cstsd12 ~]$ diff $ORACLE_HOME/rdbms/lib/config.c $ORACLE_HOME/rdbms/lib/config.c_latest
7c7
< #define SS_OPER_GRP "dba"
---
> #define SS_OPER_GRP "oracle"
[oracle@cstsd12 ~]



2. Generate a new config.o 

cd $ORACLE_HOME/rdbms/lib

mv config.o config.bck

3. relink oracle 
make -f ins_rdbms.mk ioracle

No comments:

Post a Comment