2017-10-29
1.创建一个profile pro_hr
要求:连接不超过100分 空闲事件不超过10分钟 口令时间 不超过100天 输错口令次数不超过3次 使用函数 verify_function_11g
create profile pro_hr limit idle_time 10 connect_time 100 password_life_time 100
FAILED_LOGIN_ATTEMPTS 3
PASSWORD_VERIFY_FUNCTION verify_function_11g;
2创建两个角色
hr1 拥有连接数据库 create session 和unlimited tablespace权限
create role hr1;
grant connect,create session,unlimited tablespace to hr1;
hr2 拥有创建表,索引,视图 权限
create role hr2;
grant create table,create any index,create view to hr2;
3创建一个hr用户,profile pro_hr,使用这个用户登陆创建 emp表 表空间位hr
先创建表空间:
select tablespace_name,file_id,bytes/1024/1024,file_name
from dba_data_files order by file_id;查看表空间位置路径
路径 +DATA/test/datafile
创建临时表空间
create temporary tablespace hr_temp
tempfile '+DATA/test/datafile/hr_temp.dbf'
size 20m
autoextend on;
创建数据表空间
create tablespace hr
datafile '+DATA/test/datafile/hr.dbf'
size 20m
autoextend on;
创建用户:
create user hr identified by Oracle123456
default tablespace hr
temporary tablespace hr_temp
profile pro_hr;
授权
grant hr1 to hr;
grant hr2 to hr;
登陆 sqlplus hr/Oracle123456
创建表
create table emp(name varchar(20),
sex varchar(20));