新建一个表空间,并把它分配给一个用户
以管理员身份登录的:
create user username identified by password;
username:新用户名的用户名
password: 新用户的密码
2.给用户授权
grant dba to username;
权限一般有:dba、resource、connect
收回权限:
revoke dba from username;
3.创建表空间:
create tablespace tablespacename datafile 'd:\data.dbf' size xxxm autoextend on
next 5M maxsize 3000M;
tablespacename:表空间的名字
d:\data.dbf':表空间的存储位置xxx表空间的大小,m单位为兆(M)
autoextend:表示空间不足时,自动增长
4.将空间分配给用户:
alert user username default tablespace tablespacename;
将名字为tablespacename的表空间分配给username
grant create session,create table,unlimited tablespace to username;
6.然后再以自己创建的用户登录,登录之后创建表即可。
conn username/password;
下面我们谈谈删除表空间:
--删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name;
--删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents;
--删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles;
--删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;
--如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;
这就是关于用户、表空间相关的基本操作,如有需要请相应详细研究。