How do you connect to an oracle database with os authentication linux

Let’s say we want to create a database user who logs in with their OS account. To do so, we will use the “external authentication” option offered by oracle.

Check the value of the os_authent_prefix parameter

SQL> show parameter os_authent_prefix

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

os_authent_prefix                    string      ops$

The ops$ value is the prefix that oracle will use for each OS account. As we can see, our user is prefixed with ops$. Oracle uses the prefix to recognize OS users when they attempt to connect. It is also a way for Oracle to separate a database account and an OS account.

 

Let’s create the external user account in the database

SQL> create user ops$mikando identified externally;

As we can see, our user is prefixed with ops$.

 

Give the necessary privileges

SQL> grant connect, resource, create session to ops$mikando;

 

Let’s create the user named mikando and his password.

[root@svrosisdb ~]# useradd -g oinstall -G dba,oper,asmdba mikando
[root@svrosisdb ~]# passwd mikando

 

Open a new session and connect with the new operating system (os) user created “mikando”

login as: mikando

mikando@192.168.56.10's password

 

Load the  database

[mikando@svrosisdb ~]$  . oraenvoracle database 11

ORACLE_SID = [mikando] ? achats

ORACLE_BASE environment variable is not being set since this

information is not available for the current user ID mikando.

You can set ORACLE_BASE manually if it is required.

Resetting ORACLE_BASE to its previous value or ORACLE_HOME

The Oracle base has been set to /u01/app/oracle/product/12.1.0/db

Here, our target database is called achats

 

Connect to database

[mikando@svrosisdb ~]$ sqlplus /

SQL*Plus: Release 12.1.0.2.0 Production on Mon Dec 23 09:47:48 2019

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



Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

SQL>

 

Now the os user named “mikando” can connect to the database without being asked for a password.

KONE MIKANDO

An IT professional with more than 4 years of experience as an Oracle database administrator. Extensive installation experience (RAC and stand-alone), administration, implementation, troubleshooting, Oracle 12c / 11g tuning, export / import, OEM grid control, Data Guard on Unix, Rman backup / restore, upgrade, migration , correction (RDBMS, GRID) PSU & CPU, Database migration. I like everything about the Oracle & DB2 database. For me, sharing is the best thing we can offer in this job. And learning is not an option but a duty for database administrators.

One thought on “How do you connect to an oracle database with os authentication linux

  • January 14, 2020 at 8:18 pm
    Permalink

    Thank you bro, you are the best, it was a pleasure and still to be your student

    Reply

Leave a Reply

Do NOT follow this link or you will be banned from the site!
Visit Us On FacebookVisit Us On LinkedinVisit Us On Twitter