Oracle表空间常用操作

时间:2023-12-02 21:35:14

--创建表空间
create tablespace test datafile 'E:\test2_data.dbf' SIZE 20M autoextend

on next 5M

maxsize 5000M;

--查看表空间信息

select tablespace_name,file_name FROM dba_data_files ORDER BY file_name;

--删除表空间(不能是默认表空间)

drop tablespace test including contents and datafiles;

--查看用户使用的默认表空间

SELECT user_id,username,default_tablespace FROM dba_users ORDER BY user_id;

--修改默认表空间

ALTER database DEFAULT tablespace jzy;

--修改表空间名称

ALTER tablespace test_data RENAME TO test;