同义词(Synonyms)
创建同义词:
语法
CREATE [PUBLIC] SYNONYM synonym
FOR object;
CREATE SYNONYM d_sum
2
FOR
dept_sum_vu;
删除同义词
DROP SYNONYM
d_sum;
用户访问控制:
GRANT(赋予用户相关权限)和REVOKE(撤销用户的相关权限)
系统权限
在Oracle中至少有80种系统权限。
DBA由最高的系统权限。
Create
new users
Remove
users
Remove
tables
Backup tables
… …
应用程序开发需要以下系统权限:
CREATE SESSION
CREATE
TABLE
CREATE
SEQUENCE
CREATE
VIEW
CREATE
PROCEDURE
examples
GRANT create table, create sequence, create view TO scott;
创建并GRANT权限给角色和用户
CREATE
ROLE manager;
GRANT create table, create view to manager;
GRANT manager to BLAKE, CLARK;
grant对象权限
GRANT
object_priv [(columns)]
ON
object
TO
{user|role|PUBLIC}
[WITH GRANT
OPTION];
GRANT对象权限:使用 WITH GRANT OPTION和PUBLIC关键字
GRANT
select, insert
2 ON
dept
3 TO scott
4 WITH GRANT OPTION;
GRANT
select
2 ON alice.dept
3 TO PUBLIC;
撤销REVOKE系统权限
REVOKE
{privilege [, privilege...]|ALL}
ON
object
FROM {user[, user...]|role|PUBLIC}
[CASCADE
CONSTRAINTS];
如:REVOKE
RESOURCE FROM scott;
撤销REVOKE对象权限
REVOKE
select, insert
2 ON
dept
3 FROM
scott;
【吧用户scott的selec,insert权限给撤销掉】