1、查询Oracle表空间状态
select tablespace_name,status from dba_tablespaces;
2、更改Oracle表空间状态
alter tablespace book offline/online/read only/read write;
离线/在线/只读/读写
3、数据文件移动
select tablespace_name,file_name from dba_data_files; alter tablespace book offline;
将要修改的文件移动到新目录下
alter tablespace book rename datafile '/u01/oradata/oracle8i/sales01.dbf' to '/u02/oradata/oracle8i/sales01.dbf';
4、修改数据文件的online/offline属性
archivelog模式下
alter database datafile '/u01/oradata/oracle8i/sales01.dbf' offline;
noarchivelog模式下
alter database datafile '/u01/oradata/oracle8i/sales01.dbf' offline drop;
5、数据字典表空间与本地化管理表空间的转化为
select tablespace_name,extent_management,allocation_type from dba_tablespace; exec dbms_space_admin.tablespace_migrate_to_local('book')
系统表空间system和临时表空间temp不得转换
exec dbms_space_admin.tablespace_migrate_from_local('book')
6、删除表空间
drop tablespace student including contents;
including contents将表空间及实体删除
create table test(id number(3)) tablespace test_tablesapce;