Experiment 12: user and role management

The user's name and password (for example, the first two letters of the user's name and password in this exercise) can be created and assigned to the corresponding user's name and password in the system. Record all PL/SQL statements executed correctly. (where n is the last two digits of my student number)

(1) Connect to the database using the SYSTEM identity.

create user tb identified by m17 default tablespace users quota 15M on users temporary tablespace temp; 

(2) Create a user account (my initials), whose password is self-set, the default table space is USERS, the maximum quota on USERS is 15m, and the temporary table space is TEMP.

create user tb identified by m17 default tablespace users quota 15M on users temporary tablespace temp; 

(3) Create a user profile EXEn_PROF contains the following resources and password restrictions.
 the user can establish up to 3 Concurrent Session connections.
 the maximum CPU time used by users to execute statements is 10 minutes.
 disconnect the user after the idle time exceeds 15 minutes.
 limit the validity period of user password to 10 days and the grace period to 3 days
 limit the number of failures allowed when users log in to ORACLE database to 3 and the number of locking days to 10.

create profile exe17_prof limit 
sessions_per_user 3
cpu_per_call 60000 
idle_time 15 
failed_login_attempts 3 
password_lock_time 10
password_life_time 10 
password_grace_time 3; 

(4) Specify the resource profile for the user as EXEn_PROF.

alter user tb profile  exe17_prof; 

(5) Grant users permission to connect to the database system.

grant connect to tb;

(6) Grant HR to the user for the object SELECT and UPDATE permissions of EMPLOYEES, connect to the database as a user, and query the EMPLOYEES table.

grant select,update on hr.employees to tb; 

select * from hr.employees;

(7) Revoke the system and object permissions granted to the user and grant the CONNECT role to the user instead.

revoke select,update on hr.employees from tb;
revoke create session from tb;
grant connect to tb;

2. Role management

Please refer to page p334-337 of the textbook to manage user-defined roles. Record all PL/SQL statements executed correctly.

(1) Connect to the database using the SYSTEM identity.

(2) Use the CREATE ROLE statement to create the role UserManRole.

create role UserManRole;

(3) Use the GRANT statement to GRANT the role UserManRole to CONNECT, RESOURCE, CREATE TABLE, and UNLIMITED TABLESPACE permissions.

grant CONNECT,RESOURCE,CREATE TABLE,UNLIMITED TABLESPACE to UserManRole with admin option;

(4) Use the GRANT statement to GRANT the role UserManRole to the object Scott SELECT, INSERT and UPDATE permissions of EMP.

grant SELECT,INSERT,UPDATE on SCOTT.EMP to  UserManRole;

(5) Use the GRANT statement to specify the user (the user whose initials have been created) as the role UserManRole.

grant  UserManRole to tb with admin option;

(6) Connect to the database as a user (referring to the user whose initials have been created) and query Scott EMP table.

select * from scott.emp;
  1. Retrieve and understand the system permissions of the following predefined roles.
    (1). CONNECT role
Create cluster/database link/sequence/session/synonym/view/table

(2). RESOURCE role

Create cluster/procedure/sequence/table/trigger/type

(3). DBA role

Have all system permissions, but not sysdba,sysoper Your permission

(4). EXP_FULL_DATABASE role

Backup any table,execute any procedure,select any table,execute any type,administem_resource_manager,execute_catalog_role,select_catalog_role

(5). IMP_FULL_DATABASE role

Contains execute_catalog_role,select_catalog_role And a large number of system roles

(6). EXECUTE_CATALOG_ROLE role

All systems PL/SQL of EXECUTE jurisdiction

(7). DELETE_CATALOG_ROLE role

Sys,auds Upper delete jurisdiction

(8). SELECT_CATALOG_ROLE role

Of all data dictionaries select jurisdiction

(9). RECOVERY_CATALOG_OWNER role

Restore the system permissions of the directory owner
	Create cluster /sequence/session/synonym/view/table
	Create cluster/procedure/sequence/table/trigger

[no writing, go to dinner ~]

——Wooden heart "once upon a time slow"
Remember when I was a teenager
Everyone is sincere
One sentence is one sentence
Qingchen railway station
The long street is dark without pedestrians
The small shop selling soybean milk is steaming
The old Sun became slow
Cars, horses and mail are slow
Life is only enough to love one person
The old lock is also good-looking
The key looks exquisite
If you lock it, people will understand

Keywords: Database Oracle

Added by sayma on Tue, 08 Feb 2022 21:28:04 +0200