如果数据库处于非归档模式下,可以通过如下步骤更改文件路径,这种方法可以把数据字典等数据文件
更改文件路径,因为一般用户表空间数据文件是可以在open状态下通过对这个数据文件置为offline状态
下mv移动到其他目录,然后再置为online就可以,但由于数据字典在open下是不能置为offline状态的所
以只能通过关闭数据然后运行到mount状态下进行移动如下:
1.关闭数据库
2.系统级进行文件复制
3.启动数据库到mount状态
3.通过SQL修改数据文件位置
4.打开数据库
以下是实际操作的步骤示范:
1.数据库处于非归档模式
SQL> archive log list; Database log mode No Archive Mode Automatic archival Enabled Archive destination /opt/oracle/oradata/conner/archive Oldest online log sequence 150 Current log sequence 153
|
2.需要移动test.dbf文件
SQL> select name from v$datafile;
NAME ------------------------------------------------------------ /opt/oracle/oradata/conner/system01.dbf /opt/oracle/oradata/conner/undotbs01.dbf /opt/oracle/oradata/conner/users01.dbf /opt/oracle/test.dbf
|
3.关闭数据库
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
|
4.复制文件到新的位置
SQL> ! cp /opt/oracle/test.dbf /opt/oracle/oradata/conner/test.dbf
|
5.启动数据库到mount状态
SQL> startup mount; ORACLE instance started.
Total System Global Area 101782828 bytes Fixed Size 451884 bytes Variable Size 37748736 bytes Database Buffers 62914560 bytes Redo Buffers 667648 bytes Database mounted. SQL> select name from v$datafile;
NAME ----------------------------------------------------------- /opt/oracle/oradata/conner/system01.dbf /opt/oracle/oradata/conner/undotbs01.dbf /opt/oracle/oradata/conner/users01.dbf /opt/oracle/test.dbf
|
6.修改文件位置
SQL> alter database rename file '/opt/oracle/test.dbf' to '/opt/oracle/oradata/conner/test.dbf';
Database altered.
SQL> alter database open;
Database altered.
SQL> select name from v$datafile;
NAME ---------------------------------------------------------------- /opt/oracle/oradata/conner/system01.dbf /opt/oracle/oradata/conner/undotbs01.dbf /opt/oracle/oradata/conner/users01.dbf /opt/oracle/oradata/conner/test.dbf
SQL>
|
阅读(1297) | 评论(0) | 转发(0) |