Wednesday, November 21, 2018

ORA-01031: insufficient privileges in Oracle DB on Linux


If you get
ERROR: ORA-01031: insufficient privileges.
while trying to connect as sysdba in sqlplus:
SQL> connect / as sysdba
after installation of Oracle 11g on CentOS.
One reason might be that you should be connecting as oracle OS user which has the privileges.

That user didn't have a default password so I had to create one:
$ sudo passwd oracle
then
$ su - oracle

$ sqlplus '/ as sysdba'

and create a regular non sysdba user:
SQL> CREATE USER admin IDENTIFIED BY passwd;

Then you might want to open TCP port in the firewall on your CentOS box for remote connect:

Main Oracle Net service port:
$ sudo firewall-cmd --zone=public --add-port=1521/tcp --permanent

This is the default port for admin GUI:

$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent

$ sudo firewall-cmd --reload

The GUI is enabled by running this function:
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
The GUI URL will be:
http://<CentOS box IP address>:8080/apex/f?p=4950:1