The view DBA_ROLES doesn’t have the created date column to display when the role was created, but the information is stored in sys.user$ the underlying table. So using the following query one can find the date the role was created.

SQL> select name, to_char(ctime, ‘DD-MON-YYYY HH24:MI:SS’) from sys.user$ where name = ‘RESOURCE’;

NAME TO_CHAR(CTIME,’DD-MON-YYYYHH24:MI:SS’)
——– —————————————–
RESOURCE 22-JUL-2005 00:42:50

5 responses to “How to find the date when a role was created?”

  1. subbu Avatar
    subbu

    when i execute below query to find the dump date, it is throwing and error saying object(table or view) not exist. please suggest.

    SQL> select name, to_char(ctime, ‘DD-MON-YYYY HH24:MI:SS’) from sys.user$ where name = ‘RESOURCE’;

    NAME TO_CHAR(CTIME,’DD-MON-YYYYHH24:MI:SS’)
    ——– —————————————–
    RESOURCE 22-JUL-2005 00:42:50

    Like

  2. Gorakh Avatar
    Gorakh

    Thanks Nice info..It works..

    Like

  3. javed Avatar
    javed

    can you please help to find, when the role was deleted

    Like

  4. patricia lopez Avatar
    patricia lopez

    looking for same - when was role created or edited?

    Like

    1. Alex Lima Avatar

      can you try flashback?
      SELECT * FROM DBA_ROLES AS OF TIMESTAMP TO_TIMESTAMP(‘YYYY-MM-DD HH24:MI:SS’, ‘YYYY-MM-DD HH24:MI:SS’);

      If auditing was enabled at the time of deletion, there should be a record.
      SELECT * FROM DBA_STMT_AUDIT_OPTS WHERE AUDIT_OPTION LIKE ‘%ROLE%’;
      SELECT OS_USERNAME, USERNAME, USERHOST, TERMINAL, TIMESTAMP, OBJ_NAME, ACTION_NAME, SQL_TEXT
      FROM DBA_AUDIT_TRAIL
      WHERE ACTION_NAME = ‘DROP ROLE’;

      Like

Leave a reply to Alex Lima Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.