赞
踩
由于各种原因,在实际工作中可能会出现oracle服务器数据盘空间被占满的情况,这个时候单纯的添加新磁盘,后续表空间文件放新盘的方案已经不适用了,因为源盘已经占用满了,数据库服务会异常,且之前的表空间是自增长的,会一直顶死源盘),这个时候就必须得将这部分没到最大值的表空间文件一起迁移到新盘
推荐使用lvm
pvcreate /dev/sdb
vgcreate oravg /dev/sdb
lvcreate -n oralv -L 190G oravg
mkfs.ext4 /dev/oravg/oralv
mkdir /oradata
chown oracle:oinstall /oradata
echo "/dev/oravg/oralv /oradata ext4 defaults 0 0" >> /etc/fstab
mount -a
df -h
[oracle@testosa:/home/oracle]$ lsnrctl stop
[oracle@testosa:/home/oracle]$ sqlplus / as sysdba
sys@testdba(testosa)> shutdown immediate
[oracle@testosa:/oracle/oradata/testdba]$ mv sysaux01.dbf /oradata/
[oracle@testosa:/oracle/oradata/testdba]$ mv system01.dbf /oradata/
[oracle@testosa:/oracle/oradata/testdba]$ mv test01.dbf /oradata/
[oracle@testosa:/oracle/oradata/testdba]$ mv undotbs01.dbf /oradata/
[oracle@testosa:/oracle/oradata/testdba]$ mv users01.dbf /oradata/
#数据库启动至mount状态 sys@testdba(testosa)> startup mount #修改表空间文件信息 sys@testdba(testosa)> alter database rename file '/oracle/oradata/testdba/sysaux01.dbf' to '/oradata/sysaux01.dbf'; Database altered. sys@testdba(testosa)> alter database rename file '/oracle/oradata/testdba/system01.dbf' to '/oradata/system01.dbf'; Database altered. sys@testdba(testosa)> alter database rename file '/oracle/oradata/testdba/test01.dbf' to '/oradata/test01.dbf'; Database altered. sys@testdba(testosa)> alter database rename file '/oracle/oradata/testdba/undotbs01.dbf' to '/oradata/undotbs01.dbf'; Database altered. sys@testdba(testosa)> alter database rename file '/oracle/oradata/testdba/users01.dbf' to '/oradata/users01.dbf'; Database altered.
sys@testdba(testosa)> alter database open;
Database altered.
-- 启动监听程序
sys@testdba(testosa)> ! lsnrctl start
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。