Oracle用户管理和授权
-- 创建用户
CREATE USER john IDENTIFIED BY password;
-- 给予角色权限
GRANT CONNECT TO john;
GRANT RESOURCE TO john;
GRANT CREATE TABLE TO john;
GRANT CREATE VIEW TO john;
GRANT CREATE SEQUENCE TO john;
-- 创建角色
CREATE ROLE manager;
-- 给角色授权
GRANT CREATE TABLE TO manager;
GRANT CREATE VIEW TO manager;
GRANT CREATE SEQUENCE TO manager;
GRANT INSERT ON my_table TO manager;
GRANT UPDATE ON my_table TO manager;
GRANT DELETE ON my_table TO manager;
GRANT SELECT ON my_table TO manager;
-- 将角色授予用户
GRANT manager TO john;
-- 撤销用户的CONNECT权限
REVOKE CONNECT FROM john;
-- 删除用户
DROP USER john CASCADE;
这个例子展示了如何在Oracle数据库中创建用户、授予权限、创建角色、授予角色权限、撤销权限以及删除用户。这些操作都是数据库管理和安全管理的常用操作。
评论已关闭