sql建立用戶

--建立臨時表空間
create temporary tablespace test_temp --test_temp表空間名稱
tempfile 'E:\oracle\product\10.2.0\oradata\testserver\test_temp01.dbf'--oracle文件路徑
size 32m
autoextend on
next 32m maxsize 2048m
extent management local; oracle

--建立數據表空間
create tablespace test_data --test_data臨時表空間名稱
logging
datafile 'E:\oracle\product\10.2.0\oradata\testserver\test_data01.dbf'--oracle文件路徑
size 32m
autoextend on
next 32m maxsize 2048m
extent management local; ide

--建立用戶並指定表空間
create user username identified by password --username用戶名稱
default tablespace test_data --默認用戶表空間
temporary tablespace test_temp; --默認臨時表空間spa

--給用戶授予權限
grant connect,resource to username;
grant dba to usernameserver

--刪除空的表空間,可是不包含物理文件
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;table

--說明: 刪除了user,只是刪除了該user下的schema objects,是不會刪除相應的tablespace的。
drop user username cascadeclass

相關文章
相關標籤/搜索