Oracle表空间基本操作


普通表空间:

1》  创建表空间:

  Create tablespace tablespace_name

  Datafile ‘E:\oracle\tablespace_datafile.dbf’ size 20M

  Autoextend on

  Next 5M

  Maxsize 50M;

2》  添加数据文件:

  Alter tablespace tablespace_name

  Add datafile ‘E:\oracle\tablespace_new_add_datafile.dbf’

  Size 20M

  Autoextnend off;

3》  更改数据文件大小:

  Alter database datafile ‘E:\oracle\tablespace_datafile.dbf’

  Resize 50M

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

  Alter database datafile ‘E:\oracle\tablespace_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:\oracle\old\tablespace_datafile.dbf’

    to ‘E:\oracle\new\tablespace_datafile.dbf’

11》   删除表空间:

  Drop tablespace tablespace_name

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

 

 

临时表空间:  

1》  创建临时表空间:

  Create temporary tablespace tablespace_name

  Tempfile ‘E:\oracle\temptablespace_datafile.dbf’

  Size 5M

  Autoextend on

  Next 3M

  Maxsize 10M

2》  添加数据文件:

  Alter tablespace tablespace_name

  Add tempfile ‘E:\oracle\temptablespace_new_add_datafile.dbf’

  Size 5M;

3》  更改数据文件大小:

4》  更改临时文件状态:

  Alter database tempfile ‘E:\oracle\temptablespace_datafile.dbf’ offline

5》  创建临时表空间组:

  Create temporary tablespace temptablespace_name

  Tempfile ‘E:\oracle\temptablespace_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  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM