0% found this document useful (0 votes)
11 views2 pages

Role Hirarchy

The document creates roles and grants privileges in Oracle database. It creates roles called DUMMY_ROLE and DUMMY_ROLE2, grants them usage on database, schema and warehouse. It also grants roles to each other and checks grants. Finally it drops the roles.

Uploaded by

clouditlab9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Role Hirarchy

The document creates roles and grants privileges in Oracle database. It creates roles called DUMMY_ROLE and DUMMY_ROLE2, grants them usage on database, schema and warehouse. It also grants roles to each other and checks grants. Finally it drops the roles.

Uploaded by

clouditlab9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/* CREATE DATABASE AND SCHEMA*/

USE DATABASE LA_DB;


USE SCHEMA LA_SCHEMA;

/* Use acccountadmin role and WH */

USE ROLE ACCOUNTADMIN;

USE WAREHOUSE COMPUTE_WH;

USE ROLE SECURITYADMIN;

CREATE OR REPLACE ROLE DUMMY_ROLE;

-- GRant the privilage

GRANT USAGE ON DATABASE LA_DB TO ROLE DUMMY_ROLE;


GRANT USAGE ON SCHEMA LA_DB.LA_SCHEMA TO ROLE DUMMY_ROLE;

GRANT USAGE ON WAREHOUSE COMPUTE_WH TO DUMMY_ROLE;

CREATE OR REPLACE ROLE DUMMY_ROLE2;

GRANT USAGE ON SCHEMA LA_DB.LA_SCHEMA2 TO ROLE DUMMY_ROLE2;

-- Grant rfirst role to new one

GRANT ROLE DUMMY_ROLE TO ROLE DUMMY_ROLE2;

-- Dont leave the role orphan

GRANT ROLE DUMMY_ROLE2 TO ROLE SYSADMIN;

-- Check grants on the role

SHOW GRANTS TO ROLE DUMMY_ROLE2;

-- Assign to a user

GRANT ROLE DUMMY_ROLE2 TO USER TRAINING;

-- Assume new role

USE ROLE DUMMY_ROLE2;

USE WAREHOUSE COMPUTE_WH;

-- Check the table data

SELECT * FROM LA_DB.LA_SCHEMA.CUSTOMERS;

-- Assign GRANT on the table


GRANT SELECT ON TABLE LA_DB.LA_SCHEMA.CUSTOMERS TO ROLE DUMMY_ROLE;

DROP ROLE DUMMY_ROLE2;


DROP ROLE DUMMY_ROLE;

You might also like