Top Banner
16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges
24

16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

Jan 01, 2016

Download

Documents

Vernon Farmer
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16Copyright © Oracle Corporation, 2001. All rights reserved.

Managing Privileges

Page 2: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-2 Copyright © Oracle Corporation, 2001. All rights reserved.

Objectives

After completing this lesson, you should be able to do the following:

• Identify system and object privileges

• Grant and revoke privileges

Page 3: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-3 Copyright © Oracle Corporation, 2001. All rights reserved.

Two types of Oracle user privileges:

• System: Enables users to perform particular actions in the database

• Object: Enables users to access and manipulate a specific object

Managing Privileges

Page 4: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-4 Copyright © Oracle Corporation, 2001. All rights reserved.

• There are more than 100 distinct system privileges.

• The ANY keyword in privileges signifies that users have the privilege in any schema.

• The GRANT command adds a privilege to a user or a group of users.

• The REVOKE command deletes the privileges.

System Privileges

Page 5: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-5 Copyright © Oracle Corporation, 2001. All rights reserved.

Category Examples

INDEX CREATE ANY INDEXALTER ANY INDEXDROP ANY INDEX

TABLE CREATE TABLECREATE ANY TABLEALTER ANY TABLEDROP ANY TABLESELECT ANY TABLEUPDATE ANY TABLEDELETE ANY TABLE

SESSION CREATE SESSIONALTER SESSIONRESTRICTED SESSION

TABLESPACE CREATE TABLESPACEALTER TABLESPACEDROP TABLESPACEUNLIMITED TABLESPACE

System Privileges: Examples

Page 6: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-6 Copyright © Oracle Corporation, 2001. All rights reserved.

GRANT CREATE SESSION TO emi;

GRANT CREATE SESSION TO emi WITH ADMIN OPTION;

Granting System Privileges

• Use the GRANT command to grant system privileges.

• Grantee can further grant the system privilege with ADMIN option.

Page 7: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-7 Copyright © Oracle Corporation, 2001. All rights reserved.

Page 8: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-8 Copyright © Oracle Corporation, 2001. All rights reserved.

SYSDBA and SYSOPERPrivileges

ExamplesCategory

SYSOPER

RECOVER DATABASE

ALTER DATABASE BACKUP CONTROLFILE TO

ALTER DATABASE OPEN | MOUNT

SHUTDOWN

STARTUP

ALTER DATABASE ARCHIVELOG

RESTRICTED SESSION

SYSOPER PRIVILEGES WITH ADMIN OPTIONSYSDBA

ALTER TABLESPACE BEGIN/END BACKUP

RESTRICTED SESSION

RECOVER DATABASE UNTIL

CREATE DATABASE

Page 9: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-9 Copyright © Oracle Corporation, 2001. All rights reserved.

• O7_DICTIONARY_ACCESSIBILITY parameter

• Controls restrictions on SYSTEM privileges

• If set to TRUE, allows access to objects in SYS schema

• The default is FALSE: ensures that system privileges that allow access to any schema do not allow access to SYS schema

System Privilege Restrictions

Page 10: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-10 Copyright © Oracle Corporation, 2001. All rights reserved.

REVOKE CREATE TABLE FROM emi;

Revoking System Privileges

• Use the REVOKE command to remove a system privilege from a user.

• Users with ADMIN OPTION for system privilege can revoke system privileges.

• Can only revoke privileges granted with a GRANT command.

Page 11: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-11 Copyright © Oracle Corporation, 2001. All rights reserved.

Page 12: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-12 Copyright © Oracle Corporation, 2001. All rights reserved.

DBA

GRANT

REVOKE

Jeff Emi

Jeff EmiDBA

Revoking System Privileges with the ADMIN OPTION

Page 13: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-13 Copyright © Oracle Corporation, 2001. All rights reserved.

Object priv. Table View Sequence Procedure

ALTER

DELETE

EXECUTE

INDEX

INSERT

REFERENCES

SELECT

UPDATE

Object Privileges

Page 14: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-14 Copyright © Oracle Corporation, 2001. All rights reserved.

GRANT EXECUTE ON dbms_output TO jeff;

GRANT UPDATE ON emi.customers TO jeff WITH GRANT OPTION;

Granting Object Privileges

• Use the GRANT command to grant object privileges.

• Grant must be in grantors schema or grantor must have GRANT OPTION.

Page 15: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-15 Copyright © Oracle Corporation, 2001. All rights reserved.

Page 16: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-16 Copyright © Oracle Corporation, 2001. All rights reserved.

Page 17: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-17 Copyright © Oracle Corporation, 2001. All rights reserved.

REVOKE SELECT ON emi.orders FROM jeff;

Revoking Object Privileges

• Use the REVOKE command to revoke object privileges.

• User revoking the privilege must be the original grantor of the object privilege being revoked.

Page 18: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-18 Copyright © Oracle Corporation, 2001. All rights reserved.

Page 19: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-19 Copyright © Oracle Corporation, 2001. All rights reserved.

Page 20: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-20 Copyright © Oracle Corporation, 2001. All rights reserved.

GRANT

REVOKE

Bob Jeff Emi

EmiJeffBob

Revoking Object Privileges WITH GRANT OPTION

Page 21: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-21 Copyright © Oracle Corporation, 2001. All rights reserved.

Obtaining Privileges Information

Information about privileges can be obtained by querying the following views:

• DBA_SYS_PRIVS• SESSION_PRIVS• DBA_TAB_PRIVS• DBA_COL_PRIVS

Page 22: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-22 Copyright © Oracle Corporation, 2001. All rights reserved.

Summary

In this lesson, you should have learned how to:

• Identify system and object privileges

• Grant and revoke privileges

Page 23: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-23 Copyright © Oracle Corporation, 2001. All rights reserved.

Practice 16 Overview

This practice covers the following topics:

• Creating user and granting system privileges

• Granting object privileges to users

Page 24: 16 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Privileges.

16-24 Copyright © Oracle Corporation, 2001. All rights reserved.