-- 1.创建表空间
create tablespace zhu_tablespace
datafile 'D:/oracleTableSpace/zhu/zhu_tablespace.dbf'
size 512M
extent management local segment space management auto;
-- 查看表空间
select dba_tablespaces.tablespace_name,bytes,file_name
from dba_tablespaces left join dba_data_files
on dba_tablespaces.tablespace_name = dba_data_files.tablespace_name
where dba_tablespaces.tablespace_name = 'ZHU_TABLESPACE'
-- 删除表空间
drop tablespace zhu_tablespace including contents and datafiles;
-- 2.建用户并指定默认表空间
create user zhu identified by 123456
default tablespace zhu_tablespace;
-- 查看用户
select * from dba_users where username = 'ZHU'
-- 删除用户
drop user zhu cascade
-- 3.赋予权限
grant connect,resource to zhu;
grant create any sequence to zhu;
grant create any table to zhu;
grant delete any table to zhu;
grant insert any table to zhu;
grant select any table to zhu;
grant unlimited tablespace to zhu;
grant execute any procedure to zhu;
grant update any table to zhu;
grant create any view to zhu;
-- 查看权限与角色
select * from dba_sys_privs where grantee='ZHU';
select * from dba_role_privs where grantee='ZHU';
-- 回收权限
revoke CREATE ANY VIEW from zhu;
-- 4.查看用户,权限,表空间
select * from dba_users where username = 'ZHU';
oracle用户,权限,表空间管理
最新推荐文章于 2024-08-22 20:56:09 发布