-- 创建表空间 --语法: create tablespace 表空间名 datafile '路径' size 100M [aotuextend to]; create tablespace myspace datafile 'd:/myspace/myspace.dbf' size 100M autoextend on; --给表空间重命名 -- 语法: alter tablespace 旧名称 rename to 新名称; alter tablespace newspace rename to myspace; -- 删除表空间 --[including contents cascade constraints] 并把包含的数据和约束删除 -- 语法: drop tablespace 表空间名 [including contents cascade constraints]; drop tablespace myspace including contents cascade constraints; -- 创建一个临时表空间 --语法: create temporary tablespace 临时表空间名 tempfile '路径' size 100M; create temporary tablespace mytempspace tempfile 'd:/myspace/mytempspace.dbf' size 20M; -- 创建一个用户,并指定表空间和临时表空间 create user lisi identified by lisi default tablespace myspace temporary tablespace mytempspace; -- 一个新建的用户,是没有任何权限的,不能连接 -- 给用户授予权限 --连接数据库的权限 grant create session to lisi; --创建表的权限 grant create table to lisi; -- 使用表空间的权限 grant unlimited tablespace to lisi; -- 创建一张用户表 create table tb_user( u_id number primary key,u_name varchar2(50),u_pass varchar2(20) );
---查看表空间
select * from v$tablespace;