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;

--創建數據表空間
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;

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

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

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

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM