Saturday, August 2, 2014

'ORA-01031: insufficient privileges' , While Connecting as sysdba.

While connecting to database as sysdba, I was getting yhe following oracle error.
[oracle@test ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 2 09:09:06 2014

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

ERROR:
ORA-01031: insufficient privileges

Debugging.

1. Checked the ORACLE_SID and ORACLE_HOME by issue the 'env', which were Okay.
2. I checked the listener status which was fine.
3. Checked the Listener.ora,Tnsnames.ora and Sqlnet.ora file.

Entries of Sqlnet.ora

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
#SQLNET.AUTHENTICATION_SERVICES = (NONE)
AUTOMATIC_IPC = OFF
ADR_BASE = /u01/app/oracle

Entries of Listener file.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.0)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = db1)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
    )
  )

Entries of Tnsnames.ora file.
DB1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.0)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = db1)
    )
  )

The Entries for those above files look okay.

4. Tnsping the Database , which was pinging.

5. Created the Oracle database password file.

orapwd file=orapwdb1 password=xxxx entries=3 force=y

But still  couldn't able to login into the database.

Solution.

1. Go under the folder. $ORACLE_HOME/rdbms/lib.

cd /u01/app/oracle/product/11.2.0/db_1/rdbms/lib

2. Make the backup of file 'config.c' and 'config.o'.

[oracle@test lib]$ ls -l config.*
-rwxrwxr-x 1 oracle oinstall 454 Aug  2 21:11 config.c
-rwxr-xr-x 1 oracle oinstall 611 Aug  2 21:11 config.c.bkp
-rw-r--r-- 1 oracle oinstall 828 Aug  2 21:11 config.o
-rwxr-xr-x 1 oracle oinstall 828 Aug  2 09:53 config.o.bkp

3. [oracle@test lib]$ cat 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"

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

4. Need to crosscheck if the dba and oper group are correct or not and then accordinly take the action.

[oracle@test lib]$ id
uid=500(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),504(asmadmin)

So as can be see that the Group user is 'onstall' but the entries stored in the 'config.c' is 'dba'. So we need to change that.

oracle@test lib]$ cat 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 "oinstall"
#define SS_OPER_GRP "oinstall"

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

5. Now need to recreate the file 'config.o' with the below command.

[oracle@test lib]$ make -f ins_rdbms.mk config.o
/usr/bin/gcc -m32   -O2   -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/plsql/public -I/u01/app/oracle/product/11.2.0/db_1/network/public -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -DLDAP_CM       -c -o config.o config.c

6. Relink the Oracle Binaries.

[oracle@test lib]$ relink all
writing relink log to: /u01/app/oracle/product/11.2.0/db_1/install/relink.log

After doing the above steps , I was then able to log into the database.

[oracle@test lib]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 2 21:18:54 2014

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  464519168 bytes
Fixed Size                  1345660 bytes
Variable Size             146802564 bytes
Database Buffers          310378496 bytes
Redo Buffers                5992448 bytes
Database mounted.
Database opened.


Cheers. HTH. :)

No comments:

Post a Comment