Oracle實驗用戶、角色和概要文件

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$;
發佈了9 篇原創文章 · 獲贊 14 · 訪問量 3336
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章