Oracle:创建数据库表空间以及授予用户表空间与权限
1、创建表空间的方法如下
create tablespace 表空间名 --创建一个叫shopping的表空间 datafile '表空间.dbf' --物理文件名 size 50m --大小 autoextend on --自动增长 next 50m maxsize 20480m --每次扩展50m,最大为20480m extent management local;
2、为表空间增加一个数据文件
--Unix中 alter tablespace 表空间名 add datafile '/u1/oradata/user.ora' size 50m; --Windows NT中 alter tablespace 表空间名 add datafile 'c:\oradata\user.ora' size 50m;
3、重新调整数据文件的大小
--Unix中 alter database datafile '/u1/oradata/user.ora' resize 50M; --Windows NT中 alter database datafile 'c:\oradata\user.ora' resize 50M;
4、以具有授权权限的用户登录数据库,使用GRANT语句授予用户使用表空间的权限,语法如下:
GRANT unlimited tablespace TO 用户名;
其中,“unlimited tablespace”表示无限制使用表空间的权限,“用户名”为需要授权的用户账号。
确认授权成功,可以使用如下语句查询用户的权限:
SELECT * FROM dba_sys_privs WHERE grantee='用户名' and privilege = 'UNLIMITED TABLESP'