To create a user in Oracle 12c, you can use the CREATE USER statement followed by the username and password for the user. You can also specify other attributes such as default tablespace, temporary tablespace, and profile for the user. Additionally, you can grant privileges to the user using the GRANT statement. Make sure you have the necessary permissions to create users and grant privileges in the Oracle database.
How to revoke privileges from a user in Oracle 12c?
To revoke privileges from a user in Oracle 12c, you can use the REVOKE statement with the following syntax:
1 2 3 |
REVOKE privilege_name ON object_name FROM user_name; |
Replace privilege_name
with the specific privilege you want to revoke (e.g. SELECT, INSERT, DELETE, UPDATE, etc.), object_name
with the name of the object the privilege is on (e.g. a table name), and user_name
with the name of the user you want to revoke the privilege from.
For example, if you want to revoke the SELECT privilege on a table named "employees" from a user named "john", you would use the following command:
1 2 3 |
REVOKE SELECT ON employees FROM john; |
After running this command, the user "john" will no longer have the SELECT privilege on the "employees" table.
What is a user in Oracle 12c?
In Oracle 12c, a user is an account that is granted specific privileges to access and manipulate data stored in the database. Each user has their own username and password, and can be given various levels of access to tables, views, procedures, and other database objects. Users can also be assigned roles, which are collections of privileges that can be granted to multiple users at once.
How to delete a user in Oracle 12c?
To delete a user in Oracle 12c, you can use the following steps:
- Connect to the Oracle database as a user with the necessary privileges (such as SYSDBA or a user with the DBA role).
- Run the following command to delete the user:
1
|
DROP USER username CASCADE;
|
Replace username
with the name of the user you want to delete. The CASCADE
keyword is used to delete all objects owned by the user.
- Confirm the deletion by entering Y when prompted.
Note: Dropping a user will permanently delete the user and all associated objects in the database. Make sure to back up any important data before deleting a user.