---
title: "迁移数据文件"
author: "fsclh"
date: "2007-06-12T15:25:00Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2007-06-12T15:25:00Z"
id: 89470
url: "https://fsclh.iteye.com/blog/89470"
---

今天查看一下数据库的数据文件的发现，发现oracle目录空间达到92%，并且SYSAUX表空间的数据文件不在Disk Array上，不知道当时创建数据的人是干啥的，今天决定把此表空间数据移到阵列柜中/oradata目录下。

SQL&gt; alter tablespace sysaux offline  
  2  ;

Tablespace altered.

SQL&gt; !cp /oracle/DB/oradata/aeoncn/sysaux01.dbf /oradata/aeoncn/sysaux01.dbf

SQL&gt; !cp /oracle/DB/oradata/aeoncn/sysaux02.dbf /oradata/aeoncn/sysaux02.dbf

编写一个脚本movedf.sh ：  
    alter tablespace sysaux rename datafile '/oracle/DB/oradata/aeoncn/sysaux01.dbf'  
           to  '/oradata/aeoncn/sysaux01.dbf';  
     alter tablespace sysaux rename datafile '/oracle/DB/oradata/aeoncn/sysaux02.dbf'  
           to  '/oradata/aeoncn/sysaux02.dbf';

SQL&gt; @/tmp/movedf.sh

Tablespace altered.

Tablespace altered.

SQL&gt; alter tablespace sysaux online;

Tablespace altered.

SQL&gt; select * from dba\_data\_files where tablespace\_name='SYSAUX';

FILE\_NAME                                                                          
\-----------------------------------------------------------------  
/oradata/aeoncn/sysaux01.dbf                                                       
/oradata/aeoncn/sysaux02.dbf  

$ df -m |grep oracle  
/dev/fslv00    38400.00   1738.92   96%    32894     8% /oracle

$ rm -r sysaux01.dbf

$ rm -r sysaux02.dbf

同上系统user表空间后的结果如下：

$ df -m |grep oracle  
/dev/fslv00    38400.00   7606.62   81%    32910     2% /oracle