Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

--TP4

--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;

--3 connect tp3/tp3


/*
create table etudiants
(matricule number,
nom varchar(20),
prenom varchar(20),
tel number,
dateNaissance date );
*/

--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;
/
*/

You might also like