Temporary Tablespace tablespace
Profile profile
Quota integer/unlimited on tablespace;
例:
SQL> Create user acc01
identified by acc01 // 如果密碼是數字,請用雙引號括起來
default tablespace account
temporary tablespace temp
profile default
quota 50m on account;
SQL> grant connect, resource to acc01;
[*] 查詢用戶缺省表空間、臨時表空間
SQL> select username, default_tablespace, temporary_tablespace from dba_users;
[*] 查詢系統資源文件名:
SQL> select * from dba_profiles;
資源文件類似表,一旦創建就會保存在數據庫中。
SQL> select username, profile, default_tablespace, temporary_tablespace from dba_users;
SQL> create profile common limit
failed_login_attempts 5
idle_time 5;
SQL> Alter user acc01 profile common;
三、修改用戶:
SQL> Alter User 用戶名
Identified 口令
Default Tablespace tablespace
Temporary Tablespace tablespace
Profile profile
Quota integer/unlimited on tablespace;
1、修改口令字:
SQL>Alter user acc01 identified by “12345”;
2、修改用戶缺省表空間:
SQL> Alter user acc01 default tablespace users;
3、修改用戶臨時表空間
SQL> Alter user acc01 temporary tablespace temp_data;
4、強制用戶修改口令字:
SQL> Alter user acc01 password expire;
5、將用戶加鎖
SQL> Alter user acc01 account lock; // 加鎖
SQL> Alter user acc01 account unlock; // 解鎖
四、刪除用戶
SQL>drop user 用戶名; //用戶沒有建任何實體
SQL> drop user 用戶名 CASCADE; // 將用戶及其所建實體全部刪除
*1. 當前正連接的用戶不得刪除。
五、監視用戶:
1、查詢用戶會話信息:
SQL> select username, sid, serial#, machine from v$session;
2、刪除用戶會話信息:
SQL> Alter system kill session ‘sid, serial#’;
3、查詢用戶SQL語句:
SQL> select user_name, sql_text from v$open_cursor;
Oracle 角色管理
一、何為角色
角色。角色是一組權限的集合,將角色賦給一個用戶,這個用戶就擁有了這個角色中的所有權限。
二、系統預定義角色
預定義角色是在數據庫安裝後,系統自動創建的一些常用的角色。下介簡單的介紹一下這些預定角色。角色所包含的權限可以用以下語句查詢:
sql>select * from role_sys_privs where role=’角色名‘;
1.CONNECT, RESOURCE, DBA
這些預定義角色主要是為了向後兼容。其主要是用於數據庫管理。oracle建議用戶自己設計數據庫管理和安全的權限規劃,而不要簡單的使用這些預定角色。將來的版本中這些角色可能不會作為預定義角色。
2.DELETE_CATALOG_ROLE, EXECUTE_CATALOG_ROLE, SELECT_CATALOG_ROLE
這些角色主要用於訪問數據字典視圖和包。
3.EXP_FULL_DATABASE, IMP_FULL_DATABASE
這兩個角色用於數據導入導出工具的使用。
4.AQ_USER_ROLE, AQ_ADMINISTRATOR_ROLE
AQ:Advanced Query。這兩個角色用於oracle高級查詢功能。
5. SNMPAGENT
用於oracle enterprise manager和Intelligent Agent
6.RECOVERY_CATALOG_OWNER
用於創建擁有恢復庫的用戶。關於恢復庫的信息,參考oracle文檔《Oracle9i User-Managed Backup and Recovery Guide》
7.HS_ADMIN_ROLE
A DBA using Oracle’s heterogeneous services feature needs this role to access appropriate tables in the data dictionary.
三、管理角色
1.建一個角色
sql>create role role1;
2.授權給角色
sql>grant create any table,create procedure to role1;
3.授予角色給用戶
sql>grant role1 to user1;
4.查看角色所包含的權限
sql>select * from role_sys_privs;
5.創建帶有口令以角色(在生效帶有口令的角色時必須提供口令)
sql>create role role1 identified by password1;
6.修改角色:是否需要口令
sql>alter role role1 not identified;
sql>alter role role1 identified by password1;
以下文章點擊率最高
Loading…