[Study notes] Oracle create users, assign permissions, set role

Create a user

create user student          --用户名
  identified by "123456"     --密码
  default tablespace USERS   --表空间名
  temporary tablespace temp  --临时表空间名
  profile DEFAULT            --使用默认数据文件
  account unlock;            --解锁账户(lock:锁定、unlock解锁)

alter user STUDENT
  identified by "654321"    --修改密码
  account lock;             --修改锁定状态(LOCK|UNLOCK )

assign permissions

System privileges: create session database connection permissions, create table, create view create database objects and other privileges. Authorized by the DBA user.

Object Permissions: the data in the table CRUD operations, objects owned by the corresponding operation. Authorized by the object that owns the rights to the object.

# 授权
--GRANT 对象权限 on 对象 TO 用户
grant select, insert, update, delete on JSQUSER to STUDENT;
 
--GRANT 系统权限 to 用户
grant select any table to STUDENT;

# 取消
-- Revoke 对象权限 on 对象 from 用户
revoke select, insert, update, delete on JSQUSER from STUDENT;
 
-- Revoke 系统权限 from 用户
revoke SELECT ANY TABLE from STUDENT;

Setting Role

CONNECT role: the basic role. CONNECT role represents users can connect to Oracle server session is established.

RESOURCE role: the role of the development process used. RESOURCE role can create your own objects, including: tables, views, sequences, procedures, triggers, indexes, packages, and other types.

DBA role: manage the database administrator role. It has all the rights, including rights to other authorized users. SYSTEM user with DBA authority.

# 授权
--GRANT 角色 TO 用户
grant connect to STUDENT;
grant resource to STUDENT;

# 取消
-- Revoke 角色 from 用户
revoke RESOURCE from STUDENT;

Guess you like

Origin www.cnblogs.com/danhuang/p/12398263.html