六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 21|回复: 0

oracle 10g表空间操作

[复制链接]

升级  60%

6

主题

6

主题

6

主题

童生

Rank: 1

积分
30
 楼主| 发表于 2013-1-27 05:17:01 | 显示全部楼层 |阅读模式
<div class="postbody">---------------------------------------------- -表空间的操作----------------------------------------------------
1.创建表空间:
create tablespace tablespace_name datafile 'filepath' size filesize autoextend on next autosize maxsize filemaxsize [unlimited]
eg:
create tablespace sales datafile 'c:\1.txt' size 10m autoextend on next 1m maxsize 100m
2.为表空间增加数据文件:
alter tablespace tablespace_name add datafile 'filepath' size filesize autoextend on next autosize maxsize filemaxsize[unlimited]
eg:
alter tablespace sales datafile 'c:\2.txt' size 10m autoextend on next 1m maxsize unlimited
3.调整表空间:
alter database datafile 'filepath' resize filesize--重置表空间的大小
eg:
alter database datafile 'c:\2.txt' resize 10m
4.关闭表空间的自动扩展属性:
alter database datafile 'filepath' autoextend off
eg:
alter database datafile 'c:\2.txt' autoextend off
5.打开表空间的自动扩展属性:
alter database datafile 'filepath' autoextend on
eg:
alter database datafile 'c:\2.txt' autoextend on
6.使表空间脱机:
alter tablespace tablespace_name offline
7.使表空间联机:
alter tablespace tablespace_name online
8.设置表空间为只读:
alter tablespace tablespace_name read only
9.设置表空间为读写:
alter tablespace tablespace_name read write
11.删除表空间:
drop tablespace tablespace_name
12.删除表空间的同时,删除数据文件
drop tablespace tablespace_name including contents and datefiles
13.查看每个表空间占用空间的大小:
select tablespace_name,sum(bytes)/1024/1024 from dba_segments group by tablespace_name
10.移动表空间数据文件步骤:
a.使表空间脱机:alter tablespace tablespace_name offline
b.物理移动数据文件到目的地(可以是表空间的部分数据文件或者是修改数据文件的名称)
c.逻辑移动:alter tablespace tablespace_name rename datafile '源文件地址'to '目的文件地址'--注意可以将多个源文件转移到同一个目的文件地址(多个源文件地址用逗号分隔)
d.将表空间联机:alter tablespace tablespace_name online
11.查询表空间的信息:
select tablespace_name,bytes/1024/1024  file_size_mb,file_name from DBA_DATE_FILES--注意书籍库中的实体都是以大写表示
12.当数据文件被删除的时候,如果对该数据文件操作的时候,oracle会报不能找到该数据文件的错误。如何处理。
1shutdown—关闭oracle实例
2startup  --开启oracle实例并打开数据库
3alter database datafile ‘datafile_name’ offline drop;
4alter database open
------------------------------------------------------------------------------------------------------------------
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表