/*创建表空间名为:DB_NAME*/
create tablespace DB_NAME
datafile 'E:\oracle_data\db_name.dbf' size 100M
autoextend on next 10M maxsize unlimited logging
extent management local autoallocate
segment space management auto;
/*创建用户lwj赋予权限并默认表空间为DB_NAME:*/
create user lwj identified by lwj123456
default tablespace DB_NAME;
grant connect,resource,dba to lwj;
grant create any sequence to lwj;
grant create any table to lwj;
grant delete any table to lwj;
grant insert any table to lwj;
grant select any table to lwj;
grant unlimited tablespace to lwj;
grant execute any procedure to lwj;
grant update any table to lwj;
grant create any view to lwj;
/*删除用户:*/
drop user lwj cascade;
/*删除表空间: */
drop tablespace DB_NAME including contents and datafiles;
/*如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,则需要加上CASCADE CONSTRAINTS。*/
drop tablespace DB_NAME including contents and datafiles CASCADE CONSTRAINTS;
/*注:事先创建文件夹 E:\oracle_data,db_name.dbf为表空间的文件*/