Oracle表空间基本操作

普通表空间:

1》  创建表空间:

  Create tablespace tablespace_name

  Datafile ‘E:oracle ablespace_datafile.dbf’ size 20M

  Autoextend on

  Next 5M

  Maxsize 50M;

2》  添加数据文件:

  Alter tablespace tablespace_name

  Add datafile ‘E:oracle ablespace_new_add_datafile.dbf’

  Size 20M

  Autoextnend off;

3》  更改数据文件大小:

  Alter database datafile ‘E:oracle ablespace_datafile.dbf’

  Resize 50M

4》  更改表数据文件自增:

  Alter database datafile ‘E:oracle ablespace_new_add_datafile.dbf’

  Autoextend on

5》  查询所有表空间名字等 :user_tablespaces;

6》  查询默认表空间,临时表空间:user_users

7》  查询表空间空闲情况:dba_free_space

8》  查询数据文件:dba_data_files

9》  查询表空间状态:dba_tablespaces

10》 移动数据文件:

  ①   :alter tablespace tablespace_name offline

  ②   :物理硬盘上移动数据文件

  ③   :alter tablespace tablespace_name

    rename datafile ‘E:oracleold ablespace_datafile.dbf’

    to ‘E:oracle ew ablespace_datafile.dbf’

11》   删除表空间:

  Drop tablespace tablespace_name

  Including contents and datafiles;(删除内容和文件)

临时表空间:  

1》  创建临时表空间:

  Create temporary tablespace tablespace_name

  Tempfile ‘E:oracle emptablespace_datafile.dbf’

  Size 5M

  Autoextend on

  Next 3M

  Maxsize 10M

2》  添加数据文件:

  Alter tablespace tablespace_name

  Add tempfile ‘E:oracle emptablespace_new_add_datafile.dbf’

  Size 5M;

3》  更改数据文件大小:

4》  更改临时文件状态:

  Alter database tempfile ‘E:oracle emptablespace_datafile.dbf’ offline

5》  创建临时表空间组:

  Create temporary tablespace temptablespace_name

  Tempfile ‘E:oracle emptablespace_datafile.dbf’

  Size 5M

  Tablespace group tablespace_group_name

6》  把临时表空间添加到表空间组:

  Alter tablespace temptablespace_name tablespace group tablespace_group_name

7》  删除表空间组 == 删除表空间组中的所有表空间

  Drop tablespace temptablespace_name including contents and datafiles  

原文地址:https://www.cnblogs.com/kaibing/p/7853349.html