0% found this document useful (0 votes)
140 views7 pages

Compte Rendu TP2: Gestion Des Droits Et Des Utilisateurs

1. The document discusses managing database users and privileges in Oracle. It creates two users, invit1 and invit2, and grants them various privileges including CREATE SESSION, CREATE TABLE, and REFERENCES. 2. Roles are created and granted to the users, and the privileges associated with the roles are checked. Issues that come up from insufficient privileges are resolved by granting additional privileges to invit1. 3. A sequence, seq_joker, is created and used to generate primary keys for inserting records into tables. The sequence is later altered.

Uploaded by

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

Compte Rendu TP2: Gestion Des Droits Et Des Utilisateurs

1. The document discusses managing database users and privileges in Oracle. It creates two users, invit1 and invit2, and grants them various privileges including CREATE SESSION, CREATE TABLE, and REFERENCES. 2. Roles are created and granted to the users, and the privileges associated with the roles are checked. Issues that come up from insufficient privileges are resolved by granting additional privileges to invit1. 3. A sequence, seq_joker, is created and used to generate primary keys for inserting records into tables. The sequence is later altered.

Uploaded by

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

Compte rendu TP2

Nesrine Haffar
2 INFO D
Gestion des droits et des utilisateurs:

1
grant dba to tpsgbd ;

2.1

CREATE user invit1


IDENTIFIED BY 1234
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;

2.2

CREATE user invit2


IDENTIFIED BY 4321
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;

2.3

SELECT * FROM all_users WHERE username LIKE UPPER('%invit1%');

SELECT * FROM all_users WHERE username LIKE UPPER('%invit2%');

3.1

On peut pas se connecter en tant que invit1.

3.2

GRANT CREATE SESSION TO invit1 ;


3.3
SELECT PRIVILEGE FROM dba_sys_privs WHERE
grantee=UPPER('%invit1%');

SELECT PRIVILEGE FROM dba_tab_privs


WHERE grantee=UPPER('%invit1%');

4.1

CREATE TABLE
tab_act_familles ( nofam
NUMERIC(7) NOT NULL,
noact VARCHAR(10) NOT
NULL,
descr VARCHAR(80)0 );
ERROR : Insufficient Privileges
L’utilisateur invit1 ne peut pas créer la table car il n’a pas le privilège
CREATE TABLE.

4.2
SOLUTION: on lui attribut le privilège CREATE TABLE

GRANT CREATE TABLE TO invit1;

4.3
D’abord on doit préciser le QUOTA

ALTER USER invit1 QUOTA 5M ON users;


Ensuite passer à créer la table

CREATE TABLE
tab_act_familles
( nofam
NUMERIC(7) NOT
NULL, noact
VARCHAR(10) NOT
NULL, descr
VARCHAR(80));
5
GRANT REFERENCES (noact) ON ACTION to invit1;
GRANT REFERENCES(nofam) ON famille TO invit1;

6.1
ALTER TABLE tab_act_familles add constraint act_ref foreign key (noact)
references tpsgbd.action(noact) ;
ALTER TABLE tab_act_families add constraint fam_ref foreign key (nofam)
references tpsgbd.famille(nofam) ;

6.2

INSERT INTO tab_act_familles VALUES(4,'Act4','3


niveaux scolaires: 1er primaire(F), 3eme primaire(G),
4eme primaire(G)');

6.3

REVOKE REFERENCES ON action FROM invit1 CASCADE CONSTRAINTS

6.4

>SELECT CONSTRAINT_NAME,SEARCH_CONDITION FROM


DBA_CONSTRAINTS WHERE TABLE_NAME LIKE
UPPER('Tab_Act_familles') ;

7.1
CREATE ROLE RL_tresorier NOT IDENTIFIED;
GRANT SELECT, INSERT, UPDATE ON donation TO RL_tresorier;

7.2

CREATE ROLE RL_membre NOT IDENTIFIED;

GRANT SELECT ON donation TO RL_membre;


GRANT SELECT, INSERT ON Action TO RL_membre;
8

GRANT RL_tresorier TO invit1;

GRANT RL_membre TO invit2;

SELECT role, Table_name,column_name, privilege, owner from


role_tab_privs WHERE role LIKE UPPER('rl_tresorier') OR role LIKE
UPPER('rl_membre');

9
GRANT CREATE SESSION TO invit2 ;

SELECT typeact, COUNT(noact) FROM tpsgbd.Action GROUP BY typeact;


10

DROP ROLE RL_membre;


11
SELECT * FROM tpsgbd.Action ;

ERROR : TABLE OR VIEW DOES NOT EXIST (car on’a supprimé Le role de
invit2)
12

SELECT role, Table_name,column_name, privilege from role_tab_privs


WHERE owner LIKE UPPER('invit1');

Les Séquences:

13
CREATE SEQUENCE seq_joker start with 1;
14
INSERT INTO adherent values ( seq_joker.nextval , 'benyahya' , 'amine' ,
54778899 , 'Actif' , '[email protected]' , 56743817);
INSERT INTO action values('Act'||to_char(seq_joker.nextval),'rentree scolaire ' ,
'08/05/2014' , '08/05/2015' , '' , 100);
INSERT INTO adherent values(seq_joker.nextval,'ben said
','sondes',92058391,'Porte parole' , '[email protected]' ,90123897);
INSERT INTO action values('Act'||to_char(seq_joker.nextval),'rentree scolaire' ,
'08/05/2015' , '09/05/2015' ,'',100);
15
DELETE from adherent where noadh=1;
SELECT * from adherent;
16
INSERT INTO adherent values(seq_joker.nextval,'benahmed ' , 'amir' , 96098764 ,
'Actif' , '[email protected]' ,90125697);
SELECT * from adherent;
17
SELECT sequence_name ,min_value,max_value ,increment_by,last_number from
user_sequences ;
18

ALTER SEQUENCE seq_joker increment by 5;

19

INSERT INTO action values('Act'||to_char(seq_joker.nextval),'lunette de vue ' ,


'01/05/2015' , '09/05/2015' ,'',100);

20

SELECT seq_joker.currval from sys.dual;

You might also like