From time to time, it becomes necessary to remove users from a database. Perhaps an employee leaves the company or an old application is being removed. In Oracle, the command to remove a user is
DROP USER
, and the syntax looks like this:
DROP USER username [CASCADE];
This syntax, as you can see, is very simple. The only option is the
CASCADE
option, which controls whether or not a user can be dropped when that user owns data. If you have a user who does not own any objects, use the command without the
CASCADE
option. For example:
SQL> DROP USER COIN_ADMIN;
User dropped.
Continuing with this example, if the
COIN_ADMIN
user had owned an object such as a stored procedure or a table, the drop would have failed, as this example illustrates: