userenv('ISDBA') : To check the Current Oracle Session has DBA Privilege

USERENV provides the current oracle session details. Userenv(‘ISDBA’) will give you true or false information whether your session has SYSDBA privilege through operating system or a password file.

Please find some example on the same.


  1. Connected as normal user
SQL>  CONNECT APPINSTALL@PROD
Enter password:
Connected.
SQL> SELECT userenv('ISDBA'),  SYS_CONTEXT( 'USERENV', 'AUTHENTICATION_METHOD' ) AUTHENTICATION FROM DUAL;

USEREN AUTHENTICA
------ ----------
FALSE  PASSWORD
  1. Connected as sysdba user
SQL> CONNECT APPINSTALL@PROD as sysdba
Enter password:
Connected.
SQL> SELECT userenv('ISDBA'),  SYS_CONTEXT( 'USERENV', 'AUTHENTICATION_METHOD' ) AUTHENTICATION FROM DUAL;

USEREN AUTHENTICA
------ ----------
TRUE   PASSWORD

SQL> connect / as sysdba
Connected.
SQL> SELECT userenv('ISDBA'),  SYS_CONTEXT( 'USERENV', 'AUTHENTICATION_METHOD' ) AUTHENTICATION FROM DUAL;

USEREN AUTHENTICA
------ ----------
TRUE   OS
DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google