Database version: 11GR2
First, Introduction
In Oracle, there is no concept of databases in other database systems, and objects are created under the user. The current user has all the permissions for all objects under the current user, regardless of whether the object is created by the current user. Give a simple example create a user to grant the user connection permissions, and then create a table under that user with an administrator user who can delete the tables that the administrator created under that user.
Second, the Authority
Permissions can be divided into three main categories: System permissions, Roles, object permissions. A role is a grouping of a class of permissions.
1. System permissions
System permissions are actually the permissions that the user has under the current user schema. There are 200 system privileges in 11g, such as Create table,unlimited tablespace.
To query the system permissions that the current user has:
SELECT * from User_sys_privs;
2. Roles
A role is actually a group of permissions, so assigning a role to a user is actually assigning permissions to the user. There are three more commonly used roles in Oracle. For generally not very strict systems can be granted to the development of the user Connect, resource role permissions can be.
DBA: The role has all the permissions of the database.
Connect: The role has permissions to connect to the database, as well as the permissions of the create session.
RESOURCE: This role is an application development role with the following permissions
To query the roles owned by the current user:
SELECT * from User_role_privs;
3. Object permissions
Object permissions refer to the permissions of other objects that own the user. Permissions for other user objects include: select,delete,update,alter,insert,index,references,flashback,debug,query rewrite,on COMMIT REFRESH; Note the permissions for other user objects do not have drop permissions.
To query object permissions owned by the current user:
SELECT * from User_tab_privs;
The current user chenmh has all the permissions for the student table under user Zhang.
Third, Grant authorization
1. Grant user connect, Resource role permissions. Generally creating application development users can grant permissions to both roles.
GRANT to Zhang;
2. Grant the user CHENMH Select,delete,update,insert permission to the person table under the user Zhang, and grant specific object permissions is a scheme for strict control of permissions.
GRANT SELECT,DELETE,update,insert on to CHENMH;
3. Grant user CHENMH All rights to the person table under the user Zhang
GRANT All Privileges on to CHENMH;
Grant Permission graph:
Iv. Revoke recovery rights
1. Reclaim Role Permissions
REVOKE from CHENMH;
2. Reclaim System permissions
REVOKE CREATE from CHENMH;
3. Reclaim User object permissions, reclaim all permissions of the person table under the Zhang user, if the individual granted permission requires a single retract
REVOKE All Privileges on from CHENMH;
Revoke chart:
Five, batch operation
1. Batch grant permission, grant the user chenmh to have all tables under the Zhang additions and deletions to change permissions. Production batch Execution SQL
SELECT ' GRANT select,delete,update,insert on ' | | owner| | '. ' | | table_name| | ' to CHENMH; ' From Dba_tables WHERE owner= ' ZHANG ';
You can query the Dba_objects table if you want to query other objects.
2. Batch Reclaim system privileges, recover all system privileges of user CHENMH
SELECT ' REVOKE ' | | privilege| | ' from CHENMH; ' From Dba_sys_privs WHERE grantee= ' chenmh ';
Copy the stitched SQL out to execute the query.
3. Bulk recall of Role permissions
SELECT ' REVOKE ' | | granted_role| | ' from CHENMH; ' From Dba_role_privs WHERE grantee= ' chenmh ';
4. Bulk recover User object permissions, recover user chenmh under the schema Zhang All rights
SELECT ' REVOKE ' | | privilege| | ' On ' | | owner| | '. ' | | table_name| | ' from CHENMH; ' From Dba_tab_privs WHERE grantee= ' chenmh ' and owner= ' the ' ZHANG ' ORDER by Table_name,privilege;
Note: pursuer.chen Blog:http://www.cnblogs.com/chenmh This site all the essays are original, welcome to reprint, but reprint must indicate the source of the article, and at the beginning of the article clearly give the link. Welcome to the exchange of discussions |
Oracle permissions (Grant, REVOKE)