迁移数据文件
今天查看一下数据库的数据文件的发现,发现oracle目录空间达到92%,并且SYSAUX表空间的数据文件不在Disk Array上,不知道当时创建数据的人是干啥的,今天决定把此表空间数据移到阵列柜中/oradata目录下。
SQL> alter tablespace sysaux offline
2 ;
Tablespace altered.
SQL> !cp /oracle/DB/oradata/aeoncn/sysaux01.dbf /oradata/aeoncn/sysaux01.dbf
SQL> !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> @/tmp/movedf.sh
Tablespace altered.
Tablespace altered.
SQL> alter tablespace sysaux online;
Tablespace altered.
SQL> 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