oracle创建表空间、用户及删除表空间、用户

创建表空间

CREATE SMALLFILE TABLESPACE 表空间名称 NOLOGGING DATAFILE
'oracle安装地址\ORADATA\ORCL\TBMDAT01.DBF' SIZE 2G AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED
SEGMENT SPACE MANAGEMENT AUTO;

 

创建用户

CREATE USER 用户名 IDENTIFIED BY "密码" DEFAULT TABLESPACE 表空间名称;

 

用户授权

GRANT DBA TO 用户名;

GRANT SELECT ANY TABLE TO 用户名;
GRANT UNLIMITED TABLESPACE TO 用户名;

 

删除用户

DROP USER ×× CASCADE;

 

删除表空间


--删除空的表空间,但是不包含物理文件
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;

 

posted @ 2020-10-29 14:06  xxm_0122  阅读(87)  评论(0)    收藏  举报