solidDB Help : Programming : Using SQL for database administration : Managing user privileges and roles
  
Managing user privileges and roles
You can use solidDB tools, and many ODBC compliant SQL tools to modify user privileges. Users and roles are created and deleted by using SQL statements. A file that consists of several SQL statements is called an SQL script.
solidDB includes a sample script that creates users and roles, see SQL sample scripts. To create your own users and roles, you can make your own script that describes your user environment.
The following table describes the statements used to perform common user management tasks.
Note If the autocommit mode is set to OFF, you must commit your work by using the following SQL statement:
COMMIT WORK;
If the autocommit mode is set to ON, the transactions are committed automatically.
 
Task
Example
Reference
Create a user
CREATE USER CALVIN IDENTIFIED BY P33W1T56;
Delete a user
DROP USER CALVIN;
Change a password
ALTER USER CALVIN IDENTIFIED BY TW1G44RT;
Create a role
CREATE ROLE GUEST_USERS;
Delete a role
DROP ROLE GUEST_USERS;
Grant privileges to a user or role
GRANT INSERT, DELETE ON TEST_TABLE TO GUEST_USERS;
Assign a role to a user
GRANT GUEST_USERS TO CALVIN;
Revoke privileges from a user or role
REVOKE INSERT ON TEST_TABLE FROM GUEST_USERS;
Remove a role from a user
REVOKE GUEST_USERS FROM CALVIN;
Assign administrator privileges to a user
GRANT SYS_ADMIN_ROLE TO CALVIN;
Assign DDL privileges to a user
GRANT DDL TO CALVIN
Revoke DDL privileges from a user
REVOKE DDL FROM CALVIN;
Note The database system administrator user name cannot be changed by using the ALTER USER statement. Instead, you must create a new user account, grant the new user the SYS_ADMIN_ROLE, and drop the original administrator account.
Revoking DDL privileges
Even if DDL operations are revoked, a user can still use the ALTER USER statement to change their own password.
If the user has been revoked of the DDL privileges, but the user has been granted a role such as the SYS_ADMIN_ROLE or the SYS_SYNC_ADMIN role, the role takes precedence, and the user is able to perform DDL functions.
The DDL privileges granted or revoked for a user who is already logged into the database become active only when the user reconnects to the database.
Go up to
Using SQL for database administration