如果数据库处于非归档模式下可以通过如下步骤更改文件路径:
关闭数据库
系统级进行文件复制
启动数据库到mount状态
通过SQL修改数据文件位置
打开数据库
以下是实际操作的步骤示范
数据库处于非归档模式
SQL> archive log list;
Database log modeNo Archive Mode
Automatic archival Enabled
Archive destination/opt/oracle/oradata/conner/archive
Oldest online log sequence
Current log sequence
需要移动testdbf文件
SQL> select name from v$datafile;
NAME
/opt/oracle/oradata/conner/systemdbf
/opt/oracle/oradata/conner/undotbsdbf
/opt/oracle/oradata/conner/usersdbf
/opt/oracle/testdbf
关闭数据库
SQL> shutdown immediate;
Database closed
Database dismounted
ORACLE instance shut down
复制文件到新的位置
SQL> ! cp /opt/oracle/testdbf /opt/oracle/oradata/conner/testdbf
启动数据库到mount状态
SQL> startup mount;
ORACLE instance started
Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted
SQL> select name from v$datafile;
NAME
/opt/oracle/oradata/conner/systemdbf
/opt/oracle/oradata/conner/undotbsdbf
/opt/oracle/oradata/conner/usersdbf
/opt/oracle/testdbf
修改文件位置
SQL> alter database rename file /opt/oracle/testdbf to /opt/oracle/oradata/conner/testdbf;
Database altered
SQL> alter database open;
Database altered
SQL> select name from v$datafile;
NAME
/opt/oracle/oradata/conner/systemdbf
/opt/oracle/oradata/conner/undotbsdbf
/opt/oracle/oradata/conner/usersdbf
/opt/oracle/oradata/conner/testdbf
SQL>