USERS

Prerequisites

You have generated the demo data for the SQL Tutorial.

Log on to the demo database instance DEMODB as user MONA.

Define other database users. Proceed as described in SQL Tutorial, Database Users and Their Privileges.

Examples

You can use the system table USERS to determine the following database information, among other things:

?     All defined database users of the database user class STANDARD

SELECT owner, username
  FROM DOMAIN.USERS
    WHERE usermode = 'STANDARD'

?     All users who have not changed their passwords for more than 6 months

SELECT username, pwcreadate, pwcreatime
  FROM DOMAIN.USERS
    WHERE pwcreadate <= subdate(date,183)

?     All users who are allowed to log on to the database instance multiple times

SELECT username, usermode
  FROM DOMAIN.USERS
    WHERE connectmode = 'MULTIPLE'

?     Name of the database instance on which the current database session was opened. Name of the computer on which this database instance is running.

SELECT DISTINCT serverdb, servernode
  FROM DOMAIN.USERS

Currently active user: see SESSIONS