--======================================= --以下三步操作在System/manager用户中操作 --scott用户权限不足 --======================================= --(注:如果用户勿需建表等对象,使用create user jyp identified by jyp建用户即可。否则,走以下三步)
--第一步:建立表空间 create tablespace MYTS datafile 'e:\MyOracleData.dbf' size 5m
--第二步:建立用户 create user jyp identified by jyp--如果密码写数字,则需要加"" default tablespace MYTS temporary tablespace temp quota 1m on myts;--分配限额必须,否则在建表的时候将报"在表空间MYTS无权限"的错误
--第三步:授权 grant create session to jyp; grant create table to jyp; --注:当授予用户建表权限后,对于该用户所建的表,勿需再次授予用户对表中数据 --进行增、删、改的权限 grant create sequence to jyp; grant create synonym to jyp;
--其它对用户的操作 -- --修改密码 alter user jyp identified by "111"; --修改表空间限额 alter user jyp quota 2m on myts; --删除用户 drop user jyp drop user jyp cascade;--如果模式中含有数据库对象,则使用该操作 --删除表空间 drop tablespace myts; drop tablespace myts including contents;--如果表空间中含有数据库对象,则使用该操作
--============================= --角色授权 --============================= -------------------------------------------------------------- --在scott用户下操作 grant select on emp to jyp; revoke select on emp from jyp; grant insert on emp to jyp; revoke insert on emp from jyp; grant update on emp to jyp; revoke update on emp from jyp; grant delete on emp to jyp; revoke delete on emp from jyp; --------------------------------------------------------------
]--上述方法多次授权、收权,很麻烦 --使用角色授权 ------------------------------------------------------------------ --在system中授予scott用户create role权限后,在scott中进行下列操作 --第一步:建立角色 create role role_A --第二步:赋予角色相应的权限 grant select,insert,update,delete on emp to role_A; --第三步:将角色分配给用户 grant role_A to jyp; ------------------------------------------------------------------ --注意:在对jyp授予角色之后,有时需要再次登录jyp用户才能生效