Professional Documents
Culture Documents
Script 4
Script 4
--1
/*
DROP role role_tp3;
CREATE ROLE ROLE_TP3;
GRANT create session,
create table, create role
TO role_tp3;
GRANT create procedure TO role_tp3
with admin option;
GRANT select ON HR.employees
TO role_tp3;
GRANT select ON HR.departments
TO role_tp3;
*/
--2
--GRANT role_tp3 to TP3;
--4
/*
CREATE USER TP3_2
identified by "system?"
default tablespace users
quota 5M on users
profile profil_tp3;
*/
--5
--GRANT role_tp3 to TP3_2;
--6
/*
GRANT select, insert ON
TP3.etudiants TO TP3_2;
--test
insert into TP3.etudiants
values(123,'test','test', 98079854,
to_date('12/10/1980','dd/mm/yyyy'));
*/
--7
/*
CREATE OR REPLACE PROCEDURE proc_sys_privs
(utilisateur varchar)
IS
BEGIN
for i in (select privilege A from
dba_sys_privs
where grantee=UPPER(utilisateur) )
LOOP
dbms_output.put_line(i.A);
END LOOP;
END;
/
*/
--8
/*
CREATE OR REPLACE PROCEDURE proc_role
(v_role varchar)
IS
BEGIN
for i in (select * from
role_tab_privs where role =v_role)
LOOP
dbms_output.put_line(i.privilege||
' ' || i.table_name);
END LOOP;
END;
/
*/