创建用户sql:
--查看表空间的位置和物理文件
select TABLESPACE_NAME,FILE_ID,FILE_NAME,BYTES/(1024*1024)TOTAL_SPACE from dba_data_files;
--先查看DBF文件的位置
--创建表空间
CREATE TABLESPACE "SPOON"
DATAFILE 'D:\SOFTWARE\ORACLE11G\ORADATA\ORCL\SPOON01.DBF' SIZE 100 M AUTOEXTEND ON NEXT 100
--创建用户并分配表空间
CREATE USER "SPOON" IDENTIFIED BY "123456" DEFAULT TABLESPACE "SPOON";
GRANT "DBA" TO "SPOON";
ALTER USER "SPOON" DEFAULT ROLE "DBA"
删除没有用的用户sql:
drop user SPOON cascade;
DROP TABLESPACE SPOON INCLUDING CONTENTS AND DATAFILES;
有时候提示不能删除正在连接的用户,需要将会话断掉,再删除
alter system kill session '24,15141';
alter system kill session '45,31654';
alter system kill session '158,63176';