背景:
从线上环境copy OracleHome到线下做测试环境,修改完pfile后执行sqlplus / as sysdba报错
[erparc@xxx.com ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 14 16:26:00 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
解决办法:
检查文件$ORACLE_HOME/rdbms/lib/config.c
[erparc@xxx.com ~]$ 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用户的group设置的是dba,线下的则没有将dba加入到group里
[erparc@xxx.com ~]$ id
uid=510(erparc) gid=512(erparc) groups=512(erparc)
使用命令usermod追加到groups里即可
[root@xxx.com u01]# usermod -a -G dba erparc
[erparc@xxx.com ~]$ id
uid=510(erparc) gid=512(erparc) groups=512(erparc),508(dba)
[erparc@xxx.com ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 14 16:28:02 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
当然修改$ORACLE_HOME/rdbms/lib/config.c文件也是可以的
1.修改$ORACLE_HOME/rdbms/lib/config.c文件,将SS_DBA_GRP/SS_OPER_GRP/SS_ASM_GRP设置正确
2.cd $ORACLE_HOME/rdbms/lib/config.c && mv config.o config.bck
3.make -f ins_rdbms.mk ioracle