Oracle实验
环境:win10,Oracle11g
1、创建角色change
create role change identified by change;
2、通过数据字典dba_roles查看角色change
select * from dba_roles where role='CHANGE';
#此处需要主要角色名大写
#Oracle 11g及以后版本用户名、密码区分大小写,Oracle 11g以前的版本不区分大小写
3、给角色赋权select any table
grant select any table to change;
4、通过数据字典role_sys_privs查看角色change的系统权限
select * from role_sys_privs where role='CHANGE';
5、创建用户Teddy
#方法一:
create user teddy
identified by 123
default tablespace teddy
quota 10M on teddy
quota 5M on system
temporary tablespace temp
profile default
account unlock;
#方法二:
create user Teddy identified by teddy;
#建议选择第一种方法创建用户,因为后面有一个题要用到这些
6、给用户Teddy授权 (connect、resource,change)
grant connect,resource,change to Teddy with admin option;
7、给用户Teddy默认角色
alter user Teddy default role change identified by change;
8、查看Teddy用户信息 (dba_users)
select * from dba_users where username='TEDDY';
9、查看用户Teddy使用表空间限制(dba_ts_quotas)
select * from dba_ts_quotas where username='TEDDY';
10、创建profile
创建概要文件my_profile
1)密码复杂性要求:启用;
2)密码长度最小值:8位;
3)密码错误输入三次,锁定账户,2分钟后自动解锁
@C:\oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlpwdmg.sql
#直接输入下面的代码,可能会提示没有verify_function函数,
#在安装目录找到utlpwdmg.sql文件运行一下即可
create profile my_profile limit
failed_login_attempts 3
PASSWORD_LOCK_TIME 2/1440
password_verify_function verify_function;
11、修改Teddy用户的概要文件为my_profile
alter user Teddy profile my_profile;
12、修改Teddy密码(自行设定)
alter user Teddy identified by q1w2e4r#R$;