oracle离线数据文件,Oracle 数据文件管理

本文详细介绍了如何在Oracle数据库中管理表空间,包括创建、修改和删除数据文件,以及切换表空间的读写和在线状态。通过实例展示了如何使用SQL语句进行操作,如调整数据文件大小、添加和移除数据文件,以及设置表空间为只读和在线/离线状态。此外,还提供了查询表空间和数据文件的相关SQL查询语句。
摘要由CSDN通过智能技术生成

1、手工改变数据文件的大小

SQL>conn / as sysdba

SQL>Createtablespace exampletb Datafile ‘E:\ examp01.dbf‘ size 10M ;

SQL>alter database datafile ‘E:\examp01.dbf‘ resize 20m;

SQL>alter database datafile ‘E:\examp01.dbf‘ resize 9m;

2、添加数据文件到表空间

SQL> alter tablespace exampletb add datafile ‘E:\ examp02.dbf‘ size 10M;

3、从表空间中删除数据文件

SQL> alter tablespace exampletb drop datafile ‘E:\ examp02.dbf‘;

4、将表空间设置为只读模式和读写模式

SQL>CREATETABLE scott.student (id NUMBER(5), name VARCHAR2(10)) TABLESPACE exampletb;

SQL>insertinto scott.student(id,name) values(1, ‘lucy‘);

SQL> alter tablespace exampletb read only;

SQL>insertinto scott.student(id,name) values(2, ‘lily‘);

SQL>select* from scott.student;

SQL> alter tablespace exampletb read write;

SQL>insertinto scott.student(id,name) values(2, ‘lily‘);

5、 将表空间设置为在线和离线

SQL> alter tablespace exampletb offline;

SQL>select* from scott.student;

SQL> alter tablespace exampletb online;

SQL>select* from scott.student;

6、查询表空间和数据文件

SQL>select * from v$tablespace;

SQL>select * from dba_tablespaces;

SQL>select * from v$datafile;

SQL> select * from dba_data_files;

原文:http://blog.csdn.net/fangchao3652/article/details/26246139

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值