Dear readers of our blog, we'd like to recommend you to visit the main page of our website, where you can learn about our product SQLS*Plus and its advantages.
 
SQLS*Plus - best SQL Server command line reporting and automation tool! SQLS*Plus is several orders of magnitude better than SQL Server sqlcmd and osql command line tools.
 

REQUEST COMPLIMENTARY SQLS*PLUS LICENCE

Enteros UpBeat offers a patented database performance management SaaS platform. It proactively identifies root causes of complex revenue-impacting database performance issues across a growing number of RDBMS, NoSQL, and deep/machine learning database platforms. We support Oracle, SQL Server, IBM DB2, MongoDB, Casandra, MySQL, Amazon Aurora, and other database systems.

Revoke Grant Oracle Privileges

20 August 2020

Revoke Grant Oracle Privileges

You can grant and revoke privileges for different database objects in Oracle. We will first look at how to grant and remove table privileges, and then how to grant and remove privileges to functions and procedures in Oracle.

Grant Oracle Privileges for tables

You can give users different privileges to the tables. These privileges can be any combination of SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER, INDEX, or others.

Syntax to provide table privileges in Oracle/PLSQL

GRANT privileges ON object TO user;
privileges

Privileges for appointment. This can be any of the following values:

PrivilegesDescription
SELECTAbility to execute SELECT on a table
INSERTAbility to perform INSERT on a table
UPDATEAbility to run UPDATE on a table
DELETEAbility to execute DELETE on a table
REFERENCESThe ability to create a CONSTRAINT that refers to the table.
ALTERAbility to execute the ALTER TABLE operator to change the table description.
INDEXAbility to create an INDEX table using the CREATE INDEX operator.
ALLAll table privileges

 

  • object – the name of the database object to which you grant privileges. If you are granting privileges to a table, this must be the name of the table.
  • user – the name of the user to whom the privilege will be granted.

Let’s look at some examples of giving table privileges in Oracle

For example, if you want to grant SELECT, INSERT, UPDATE and DELETE privileges to a table named suppliers for a user named trizor, you need to run the following GRANT sentence:

GRANT SELECT, INSERT, UPDATE, DELETE ON TO trizor;

You can also use the keyword ALL to specify that all permissions must be given to a user named trizor.

For example:

GRANT ALL ON TO trizor;

If you want to give your table only SELECT access for all users, you will give privileges with the public keyword.

For example:

GRANT SELECT ON TO public;

Revoke Privileges for tables

Once you have granted the privileges, you may have to cancel all or some of these privileges. To do this, you can run the revoke command. You can override any combination of SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER INDEX, or ALL.

Syntax for revoke privileges for a table in Oracle/PLSQL:

REVOKE privileges ON object FROM user;
privileges

Privileges for cancellation. This can be any of the following values:

PrivilegesDescription
SELECTAbility to execute SELECT on a table
INSERTAbility to perform INSERT on a table
UPDATEAbility to run UPDATE on a table
DELETEAbility to execute DELETE on a table
REFERENCESThe ability to create a CONSTRAINT that refers to the table.
ALTERAbility to execute the ALTER TABLE operator to change the table description.
INDEXAbility to create an INDEX table using the CREATE INDEX operator.
ALLAll table privileges

 

  • object – The name of the database object for which the privileges are revoked. If the privileges for a table were canceled, that would be the name of the table.
  • user – The name of the user for whom the privileges are to be cancelled.

Consider some examples of how to override table privileges in Oracle/PLSQL.

For example, if you want to undo DELETE privileges for a table named suppliers for a user named anzor, then follow the following REVOKE sentence:

REVOKE DELETE ON FROM anzor;

If you want to override all table privileges for a user named anzor, you can use ALL keyword as follows:

REVOKE ALL ON FROM anzor;

If you have granted privileges to all users on the suppliers table and it is necessary to cancel these privileges, you can run the following REVOKE offer:

REVOKE ALL ON FROM public;

Grant Privileges on functions/procedures

When working with functions and procedures, you can give users the ability to perform these functions and procedures.

Syntax to grant EXECUTE privilege to functions/procedures in Oracle/PLSQL:

GRANT EXECUTE ON object TO user;
EXECUTE

Ability to compile a function/procedure. Possibility to execute the function/procedure directly.

  • object – The name of the database object to which you grant privileges. If you grant EXECUTE privilege to a function or procedure, that would be the name of the function or procedure.
  • user – The name of the user who will be granted EXECUTE privileges.

Consider some examples of how to grant EXECUTE privileges to functions or procedures in Oracle/PLSQL.

For example, if you have a function named Get_Value and you want to grant EXECUTE access to the user trizor, you would do the following GRANT sentence:

GRANT EXECUTE ON Get_Value TO trizor;

If you want to allow all users to run Get_Value, follow the GRANT sentence below:

GRANT EXECUTE ON Get_Value TO public;

Revoke Privileges on functions/procedures

Once you have granted EXECUTE privileges to a function or procedure, you may need to cancel those privileges for the user. To do so, you can run the REVOKE command.

Syntax for removing privileges to functions or procedures in Oracle/PLSQL:

REVOKE EXECUTE ON object FROM user;
EXECUTE

Ability to compile a function/procedure. Ability to directly execute the function/procedure.

  • object – The name of the database object to which you cancel privileges. If you cancel the EXECUTE privilege of a function or procedure, that would be the name of the function or procedure.
  • user – The name of the user who will be granted an EXECUTE privilege if you cancel it.

Let’s look at some examples of how to override EXECUTE privileges on functions or procedures in Oracle/PLSQL.

If you want to override EXECUTE privileges on a function named Get_Value for a user named maximus, follow the following REVOKE sentence:

REVOKE execute ON Get_Value FROM maximus;

If you have provided EXECUTE privileges to all users for a function called Get_Value and you want to override these EXECUTE privileges then execute the following REVOKE sentence:

REVOKE EXECUTE ON Get_Value FROM Public;

Grant, Revoke and Grant Table View to other user in Oracle

 
Tags: , , , , ,

MORE NEWS

 

Preamble​​NoSql is not a replacement for SQL databases but is a valid alternative for many situations where standard SQL is not the best approach for...

Preamble​​MongoDB Conditional operators specify a condition to which the value of the document field shall correspond.Comparison Query Operators $eq...

5 Database management trends impacting database administrationIn the realm of database management systems, moreover half (52%) of your competitors feel...

The data type is defined as the type of data that any column or variable can store in MS SQL Server. What is the data type? When you create any table or...

Preamble​​MS SQL Server is a client-server architecture. MS SQL Server process starts with the client application sending a query.SQL Server accepts,...

First the basics: what is the master/slave?One database server (“master”) responds and can do anything. A lot of other database servers store copies of all...

Preamble​​Atom Hopper (based on Apache Abdera) for those who may not know is an open-source project sponsored by Rackspace. Today we will figure out how to...

Preamble​​MongoDB recently introduced its new aggregation structure. This structure provides a simpler solution for calculating aggregated values rather...

FlexibilityOne of the most advertised features of MongoDB is its flexibility.  Flexibility, however, is a double-edged sword. More flexibility means more...

Preamble​​SQLShell is a cross-platform command-line tool for SQL, similar to psql for PostgreSQL or MySQL command-line tool for MySQL.Why use it?If you...

Preamble​​Writing an application on top of the framework on top of the driver on top of the database is a bit like a game on the phone: you say “insert...

Preamble​​Oracle Coherence is a distributed cache that is functionally comparable with Memcached. In addition to the basic function of the API cache, it...

Preamble​​IBM pureXML, a proprietary XML database built on a relational mechanism (designed for puns) that offers both relational ( SQL / XML ) and...

  What is PostgreSQL array? In PostgreSQL we can define a column as an array of valid data types. The data type can be built-in, custom or enumerated....

Preamble​​If you are a Linux sysadmin or developer, there comes a time when you need to manage an Oracle database that can work in your environment.In this...

Preamble​​Starting with Microsoft SQL Server 2008, by default, the group of local administrators is no longer added to SQL Server administrators during the...