首页 > 应用开发 > IT综合 > SG_007_CHAPTER 10
User Access and Security
对象权限,系统权限,角色权限。
Creating and Modifying User Accounts:
Configuring Account Authentication:
用户连接到数据库,必须做认证,一般有3种认证类型。
1.数据库认证。Oracle检查用户是否合法,check用户名和密码。
Database-authenticated user accounts
默认账号类型。
建立账号例子:
Create user piyush IDENTIFIED BY welcome;
2.oracle只check用户名的合法性,密码由系统和网络来检验。
Externally authenticated user accounts
这些账户一般称之为OPS$,
例子:
Create user ops$appl IDENTIFIED EXTERNALLY;
一般用来处理一些批处理,定时操作,非交互程序。
3.global 认证。
X.509企业目录服务.适用于大型组织。
Assigning Attributes to Accounts:
例子:(修改密码)
Alter user piyush IDENTIFIED BY saraswati;
Assigning a Default Tablespace:
例子:
Create user piyush IDENTIFIED BY saraswati
DEFAULT TABLESPACE user_date;
Assigning a Temporary Tablespace
例子:
Create user piyush IDENTIFIED BY saraswati
TEMPORARY TABLESPACE temp;
改变数据库的默认表空间,使用
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp;
Assigning Tablespace Quotas:
表空间的使用量,和增长量。
Create user piyush IDENTIFIED BY saraswati
DEFAULT TABLESPACE user_date
QUOTA UNLIMITEDE ON user_date
QUOTA 20M ON tools;
Using Profiles:
Limit 资源,包括连接时间,空闲时间,每个连接的逻辑读,错误登入尝试,密码认证。
Enabling or Disabling Roles:
例子:
Alter user manoj DEFAULT ROLE ALL EXCEPT salary_adm;
Setting Password Expiration:
例子:
Alter user manoj IDENTIFIED BY welcome;
Alter user manoj PASSWORD EXPIRE;
Account Locking:
ALTER USER gl ACCOUNT LOCK;
Account Unlocking:
ALTER USER scott ACCOUNT UNLOCK;
Using Account Licensing Controls:
限制连接到数据库的连接数,数据库中的建立的账号数量。
三个参数:
License_max_users : 限制数据库中可以建立的用户账号数。
License_sessions_warning : 设置什么时候发出警告,设置同时连接数据库的连接数的数量
License_max_sessions :设置同时连接数据库的连接数的数量
Creating and Using Roles
Create role role_name identify by password
-----------------------------------------Externally : 由操作系统做认证
-----------------------------------------globally : 由oracle security service做认证
Set role role_name IDENTIFIED BY password;
Granting and Revoking Privileges:
三种类型的特权:
1. 对象特权:表,视图,存储过程,
2. 系统特权:系统级的操作,连接到数据库,建立表,建立用户
3. 角色特权:用户拥有角色的特权
Object Privileges:
P465 table10.1
The ALTER Privilege:
可以执行ALTER TABLE 或者LOCK TABLE .
ALTER TABLE: rename 表,add column,drop column,
The DELETE Privilege:
允许从表或者视图中remove数据。 Select 和delete特权应该一同赋予。
The EXECUTE Privilege:
运行特定的程序,PL/SQL
The INDEX Privilege:
允许建立索引,或者锁住表
The INSERT Privilege:
在表或者视图中建立行。
The READ Privilege:
允许用户读数据字典。
The REFERENCE Privilege:
让用户(不是角色)可以引用表。
The SELECT Privilege:
可以使用select 查询语句。
The UPDATE Privilege:
必须和select权限同时使用。
The ALL Privilege:
Select ,insert,update,delete,index,alter,reference 权限。
System Privileges:
Cluster Privileges: create cluster,
create any cluster
alter any cluster
drop any cluster
Database Privileges: alter database
Alter system
Audit system
Index Privileges: create any index
Alter any index
Drop any index
Procedure Privileges: create procedure
Create any procedure
Alter any procedure
Drop any procedure
Execute any procedure
Profile Privileges: create profile
Alter profile
Drop profile
Role Privileges: create role
Alter any role
Drop any role
Grant any role
Rollback Segment Privileges: create rollback segment
Alter rollback segment
Drop rollback segment
Sequence Privileges: create sequence
Create any sequence
Alter any sequence
Drop any sequence
Select any sequence
Session Privileges: create session
Alter session
Alter resource cost
Restricyed session
Synonym Privileges: create synonym
Create any synonym
Create public synonym
Drop any synonym
Drop public synonym
Table Privileges: create table
Create any table
Alter any table
Drop any table
Select any table
Inserte any table
Update any table
Delete any table
Lock any table
Tablespace Privileges: create tablespace
Alter tablespace
Drop tablespace
Manage tablespace
Unlimited tablespace
User Privileges: create user
Alter user
Become user
Drop user
View Privileges: create view
Create any view
Drop any view
Assigning Privileges:
Grant role to user/role/public with admin option
Grant system privilege to user/role/public with admin option
Grant object privilege to user/role/public with grant option
Grant object privilege to user/role/public with grant option
Public说明给所有人赋予权限,用户被赋予权限的时候,不用登入或者登出。
Granting Object Privileges:
Object privileges 参数可以赋予with grant option参数。
A赋给B,B赋给C。
如果B被drop了,那么C被赋予的权限也没有了。
A赋给B和D,B和D都赋予权限给C,此时B被drop掉,也不会影响C的权限。
Granting System Privileges:
A 赋给B ,B赋给C。
如果B被drop,那么C照样保留权限。
Granting Role Privileges:
System privileges ,object privileges,role privileges 可以赋给role。
Role的enable 和disable可以使用set role
角色不能被赋予允许 存储过程,包,触发器等的权限。
Revoking Privileges:
对象权限可以被授予者取消,系统和role权限可以被任何偶权限的人取笑。
REVOKE ROLE/System Privilege/Object Privilege FROM user/role/public ;
Viewing Privileges in the Data Dictionary:
P481
Managing User Groups with Profiles:
Enabling Resource Settings:
分成两类,
Password resource : failed_logon_attempts password_life_time
Kernel resource : idle_time logical_reads_per_session
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11997930/viewspace-1028390/ ,如需转载,请注明出处,否则将追究法律责任。