oracle12c移动表空间数据文件

环境:OS:Centos7.5   oracle 12c 生产环境

近期对磁盘进行了扩展,所以迫切需要移动几个数据文件到新的磁盘。这篇日志主要用来记录操作记录,以被后来者参考:

1.停止oracle库
[oracle@rpserver ~]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat May 19 17:29:28 2018

Copyright (c) 1982, 2016, Oracle. All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

2.oracle用户下移动数据文件
mv /u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_05.dbf /data/oracle/oradata/whdc
mv /u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_06.dbf /data/oracle/oradata/whdc
mv /u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_07.dbf /data/oracle/oradata/whdc
mv /u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_08.dbf /data/oracle/oradata/whdc

3.启动oracle 到mount状态
SQL> startup mount
ORACLE instance started.

Total System Global Area 3003121664 bytes
Fixed Size 8625224 bytes
Variable Size 905970616 bytes
Database Buffers 2080374784 bytes
Redo Buffers 8151040 bytes
Database mounted.

4.修改数据文件路径

SQL> alter database rename file ‘/u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_05.dbf’ to ‘/data/oracle/oradata/whdc/RPUSER_DATA_05.dbf’;

Database altered.

SQL> alter database rename file ‘/u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_06.dbf’ to ‘/data/oracle/oradata/whdc/RPUSER_DATA_06.dbf’;

Database altered.

SQL> alter database rename file ‘/u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_07.dbf’ to ‘/data/oracle/oradata/whdc/RPUSER_DATA_07.dbf’;

Database altered.

SQL> alter database rename file ‘/u01/app/oracle/product/12.2.0/dbhome_1/dbs/RPUSER_DATA_08.dbf’ to ‘/data/oracle/oradata/whdc/RPUSER_DATA_08.dbf’;

Database altered.

5.打开数据库

SQL> alter database open;

Database altered.

6.重启对数据库进行验证

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 3003121664 bytes
Fixed Size 8625224 bytes
Variable Size 905970616 bytes
Database Buffers 2080374784 bytes
Redo Buffers 8151040 bytes
Database mounted.
Database opened.

验证通过

发表评论