Oracle Linux

Oracle Grant All Privileges

Database privileges refer to permissions granted to a database user to allow that user to perform specific actions on the database. There are two types of privileges: system privileges and object privileges.

  1. System privileges allow users to perform specific actions, such as creating tables, running triggers, or running stored procedures across the entire database.
  2. On the other hand, object privileges allow a user to perform specific actions on a specific database object, such as a table or a view.

In Oracle, you can assign or grant permissions to database users directly or group the privileges into various roles and then add specific users to those roles. The user will then inherit the privileges of the role they are assigned.

This makes user and permission management easy and efficient, as you can grant a single role to multiple users rather than having to grant each privilege individually.

This tutorial will show you how to grant all privileges to a specific user. This can be useful when adding an administrator-like account to the database.

Oracle Create User

Before granting permissions to a user, the first step is to ensure that the user exists in the database. If not, you will need to setup that user account as shown in the queries below:

CREATE USER db_sudo IDENTIFIED BY supersecurepassword;

In the previous example, we use the CREATE USER statement to create a new user with the account name db_sudo. We also set the password for the user using the IDENTIFIED BY clause.

NOTE: Replace the “supersecurepassword” with a more secure password.

Once we run the previous statement, the user can use the specified username and password to login into the database.

However, since the user has no privileges on the database, the account cannot perform any actions unless we allow various permissions.

Oracle Grant All Privileges

To assign all privileges to the created user, we can run the following:

grant all privileges to db_sudo;

Running the previous command allows the db_sudo user to perform any actions on the database, including creating tables, querying data, inserting data, removing data, etc.

You check the permissions of the user by logging into the user account as shown below:

$ sqlplus db_sudo/supersecurepassword;

Once logged in, check the user permissions as follows:

select * from session_privs;

This should return all the user privileges as shown below:

Granting all permissions to a user in Oracle is a very powerful and convenient way to give a user the ability to perform any action in the database. However, it also comes with various concerns. For example:

  1. It can be challenging to manage and control the user’s access to the database. Having permission to perform any task on the database can lead to mistakes and even loss of data.
  2. It’s also difficult to audit user actions. Due to the numerous tasks a user can carry out, managing and tracing their steps can be impossible.


The key takeaway is that granting all privileges to a user can be helpful in some cases. However, careful considerations should be put into place to reduce the risks associated with it. It is recommended to grant only the specific privileges the user needs to carry out the intended rather than giving them unrestricted access.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list