oracle創建表空間、用戶、用戶授權、刪除表空間、刪除用戶


 1 --創建臨時表空間 
 2 create temporary tablespace test_temp --test_temp表空間名稱
 3 tempfile 'E:\oracle\product\10.2.0\oradata\testserver\test_temp01.dbf'--oracle文件路徑
 4 size 32m 
 5 autoextend on 
 6 next 32m maxsize 2048m 
 7 extent management local; 
 8 
 9 --創建數據表空間 
10 create tablespace test_data --test_data臨時表空間名稱
11 logging 
12 datafile 'E:\oracle\product\10.2.0\oradata\testserver\test_data01.dbf'--oracle文件路徑
13 size 32m 
14 autoextend on 
15 next 32m maxsize 2048m 
16 extent management local; 
17 
18 --創建用戶並指定表空間 
19 create user username identified by password --username用戶名稱
20 default tablespace test_data --默認用戶表空間
21 temporary tablespace test_temp; --默認臨時表空間
22 
23 --給用戶授予權限 
24 grant connect,resource to username; 
25 grant dba to username
26 
27 --刪除空的表空間,但是不包含物理文件
28 drop tablespace tablespace_name;
29 --刪除非空表空間,但是不包含物理文件
30 drop tablespace tablespace_name including contents;
31 --刪除空表空間,包含物理文件
32 drop tablespace tablespace_name including datafiles;
33 --刪除非空表空間,包含物理文件
34 drop tablespace tablespace_name including contents and datafiles;
35 --如果其他表空間中的表有外鍵等約束關聯到了本表空間中的表的字段,就要加上CASCADE CONSTRAINTS
36 drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;
37 
38 --說明: 刪除了user,只是刪除了該user下的schema objects,是不會刪除相應的tablespace的。
39 drop user username cascade

 


免責聲明!

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



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