0% found this document useful (0 votes)
10 views

Module 5 Session 2

The document provides instructions on changing user passwords, managing object privileges, granting and revoking privileges, and creating database links. It details how to use SQL statements for altering user accounts, granting specific privileges to users, and confirming granted privileges. Additionally, it explains how to create a database link for accessing remote data.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Module 5 Session 2

The document provides instructions on changing user passwords, managing object privileges, granting and revoking privileges, and creating database links. It details how to use SQL statements for altering user accounts, granting specific privileges to users, and confirming granted privileges. Additionally, it explains how to create a database link for accessing remote data.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Changing Your Password

• The DBA creates your user account and initializes


your password.
• You can change your password by using the
ALTER USER statement.

ALTER USER scott


IDENTIFIED BY
lion;
User altered.
Object Privileges

Object
Privilege Table View Sequence Procedure
ALTER √ √
DELETE √ √
EXECUTE √
INDEX √
INSERT √ √
REFERENCES √ √
SELECT √ √ √
UPDATE √ √
Object Privileges

• Object privileges vary from object to object.


• An owner has all the privileges on the object.
• An owner can give specific privileges on that
owner’s object.

GRANT object_priv
ON [(columns)]
TO object
[WITH GRANT {user|role|PUBLIC}
OPTION];
Granting Object Privileges

• Grant query privileges on the EMPLOYEES


table.
GRANT select
ON employees
TO
sue, rich;
Grant succeeded.

• Grant privileges to update specific columns to


users and roles.
GRANT update (department_name, location_id)
ON departments
TO scott,
manager; Grant
succeeded.
Using the WITH GRANT OPTION and
PUBLIC
Keywords
• Give a user authority to pass along privileges.

GRANT select, insert


ON departments
TO scott
WITH GRANT OPTION;
Grant succeeded.

• Allow all users on the system to query data from


Alice’s DEPARTMENTS table.
GRANT select
ON alice.departments
TO PUBLIC;
Grant succeeded.
Confirming Privileges Granted
Data Dictionary View Description

ROLE_SYS_PRIVS System privileges granted to roles


ROLE_TAB_PRIVS Table privileges granted to roles
USER_ROLE_PRIVS Roles accessible by the user
USER_TAB_PRIVS_MADE Object privileges granted on
the user’s objects
USER_TAB_PRIVS_RECD Object privileges granted to
the user
USER_COL_PRIVS_MADE Object privileges granted on
the columns of the user’s
objects
USER_COL_PRIVS_RECD Object privileges granted to
the user on specific columns
USER_SYS_PRIVS Lists system privileges granted
How to Revoke Object Privileges

• You use the REVOKE statement to revoke


privileges granted to other users.
• Privileges granted to others through the WITH
GRANT OPTION clause are also revoked.

REVOKE {privilege [, privilege...]|


ALL} ON object
FROM {user[, user...]|role|PUBLIC}
[CASCADE CONSTRAINTS];
Revoking Object Privileges

As user Alice, revoke the SELECT and INSERT


privileges given to user Scott on the DEPARTMENTS
table.
REVOKE select, insert
ON departments
FROM scott;

Revoke succeeded.
Database Links

A database link connection allows local users to


access data on a remote database.

Local Remote

EMP
Table

SELECT * FROM HQ_ACME.COM


emp@HQ_ACME.COM; database
Database Links

• Create the database link.


CREATE PUBLIC DATABASE LINK hq.acme.com
USING 'sales';
Database link
created.
• Write SQL statements that use the database link.

SELECT *
FROM [email protected];

You might also like