--創建用戶scott密碼pass,默認表空間使用的時臨時表空間temp;
create user scott identified by pass default tablespace scott temporary tablespace temp;--創建表空間scott初始大小是5m,當表空間滿的時候自動增長1m,最大增長無限制(無限制本地一個dbf文件最大約30G,會慢,需要追---加數據文件纔可以繼續擴充表空間)
create tablespace scott datafile 'D:\app\admin\oradata\orcl\scott.dbf' size 5m reuse autoextend on next 1m maxsize unlimited;
--datafile 表示數據文件,若創建臨時表空間,要使用臨時文件tempfile;
--size 後跟着大小,如果在操作系統上,該文件已存在,並且想要重用,需要加上reuse選項,表示重用。
--autoextend 表示是自動擴展該數據文件的選項。沒有autoextend 的話,也就不使用自動擴展,也沒有next和maxsize的選項。
--next 表示下一次自動擴展時,擴展的大小。
--maxsize 表示此數據文件能夠擴展的最大大小;如果無大小限制,則使用maxsize unlimited
--授予soctt用戶dba權限
grant dba to scott;
--scott用戶不可以隨便在其他的表空間建表
revoke unlimited tablespace from scott;
--授權給用戶可以修改表空間配額權限(配額爲0即無配額不受空間限制,unlimited無限制)
alter user soctt quota 0 on scott;
alter user scott quota unlimited on soctt;