Sunday, July 18, 2010

Use of role in SQL

CREATE USER u_asst_gm identified by asst_gm;
CREATE USER u_operator identified by operator;

//here create two users u_asst_gm and u_operator



CREATE ROLE r_asst_gm;
CREATE ROLE r_operator;
GRANT CREATE SESSION,CREATE TABLE,UNLIMITED TABLESPACE to r_asst_gm;
GRANT CREATE SESSION,UNLIMITED TABLESPACE to r_operator;

//here creates the role and grant privileges to the role


GRANT r_asst_gm to u_asst_gm;
GRANT r_operator to u_operator;

//here grant role to users


GRANT SELECT,INSERT,DELETE,UPDATE on customer to u_asst_gm;
GRANT SELECT,INSERT,DELETE,UPDATE on bill to u_asst_gm;
GRANT SELECT,INSERT,DELETE,UPDATE on payee to u_asst_gm;
GRANT SELECT,INSERT,UPDATE on bill to u_operator;
commit;

//grant table accessing privileges to users.


Enjoy SQL

No comments:

Post a Comment