Security Roles   «Prev  Next»

Lesson 11Deleting a role
ObjectiveDrop role from the database.

Drop role from Database

A role is a type of database object. You remove it from the database by dropping it.

Drop role Syntax

To remove a role from the database, you use the SQL command illustrated in the following MouseOver.
DROP ROLE rolename
  1. The DROP ROLE keyword phrase is required.
  2. The name of an existing role.

Consequence of Dropping Role

Once a role is dropped, it is automatically removed from all users who have access to the role. Any future reference to the role in a SET ROLE statement will return an error.
If you create a role with the same name at a later time, you must re-grant privileges to the role and re-grant the role to other users and roles.

Example

To remove the role BIDDER from the database, use the following command:
DROP ROLE BIDDER;

The command must be issued by either the owner of the role or a user who had been granted the role with the ADMIN OPTION. The next lesson is the module wrap-up. You can take a quiz to see what you learned and discover topics that you might want to review.