Oracle——用户、角色、权限的创建、删除、修改
在Oracle数据库中,创建用户、角色、授予权限、回收权限、以及修改用户或角色的语法如下:
创建用户:
CREATE USER username IDENTIFIED BY password;
创建角色:
CREATE ROLE rolename;
授予权限:
GRANT privilege TO username;
GRANT privilege ON object TO username;
GRANT role TO username;
回收权限:
REVOKE privilege FROM username;
REVOKE privilege ON object FROM username;
REVOKE role FROM username;
修改用户密码:
ALTER USER username IDENTIFIED BY new_password;
例子:
创建用户:
CREATE USER john IDENTIFIED BY secret;
创建角色:
CREATE ROLE report_user;
授予权限:
GRANT SELECT ON sales TO john;
GRANT report_user TO john;
回收权限:
REVOKE SELECT ON sales FROM john;
REVOKE report_user FROM john;
修改用户密码:
ALTER USER john IDENTIFIED BY new_secret;
评论已关闭