数据库建库的时候指定数据文件多出来一个子目录htdisdb
现在要做的操作是让oracle 认出移动数据文件,
1)确认当前的模式,并且把关闭归档模式
- SQL> archive log list; 查看归档模式是否打开
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination /oradata/htdisdbarc2
- Oldest online log sequence 37
- Next log sequence to archive 39
- Current log sequence 39
关闭归档模式
- SQL> startup nomount;
- ORACLE instance started.
- Total System Global Area 1610612736 bytes
- Fixed Size 2084296 bytes
- Variable Size 385876536 bytes
- Database Buffers 1207959552 bytes
- Redo Buffers 14692352 bytes
- SQL> alter database mount;
- Database altered.
- SQL> alter database noarchivelog
- 2 ;
- Database altered.
- SQL> alter database open;
- Database altered.
2)查看数据文件位置
- SQL> select name from v$datafile;
- NAME
- ---------------------------------------------------
- /oradata/htdisdb/htdisdb/system01.dbf
- /oradata/htdisdb/htdisdb/undotbs01.dbf
- /oradata/htdisdb/htdisdb/sysaux01.dbf
- /oradata/htdisdb/htdisdb/users01.dbf
3)移动数据文件到目标文件夹
- [oracle@htdtest htdisdb]$ mv *.dbf ../
4)重启数据库到mount状态
- SQL> startup nomount;
- SQL> alter database mount;
5)重命名数据文件
- SQL> alter database rename file '/oradata/htdisdb/htdisdb/sysaux01.dbf' to '/oradata/htdisdb/sysaux01.dbf';
- Database altered.
- SQL> alter database rename file '/oradata/htdisdb/htdisdb/undotbs01.dbf' to '/oradata/htdisdb/undotbs01.dbf';
- Database altered.
- SQL> alter database rename file '/oradata/htdisdb/htdisdb/users01.dbf' to '/oradata/htdisdb/users01.dbf';
- Database altered.
- SQL> alter database rename file '/oradata/htdisdb/htdisdb/temp01.dbf' to '/oradata/htdisdb/temp01.dbf';
- Database altered.
- SQL>
6)重命名重做日志文件
- alter database rename file '/oradata/htdisdb/htdisdb/redo01.log' to '/oradata/htdisdb/redo01.log';
- alter database rename file '/oradata/htdisdb/htdisdb/redo02.log' to '/oradata/htdisdb/redo02.log';
- alter database rename file '/oradata/htdisdb/htdisdb/redo03.log' to '/oradata/htdisdb/redo03.log';
7)更改数据库到open状态,重新查询数据文件位置
- SQL> alter database open;
- Database altered.
- SQL> select name from v$datafile;
- NAME
- --------------------------------------------------------------------------------
- /oradata/htdisdb/system01.dbf
- /oradata/htdisdb/undotbs01.dbf
- /oradata/htdisdb/sysaux01.dbf
- /oradata/htdisdb/users01.dbf
- /oradata/htdisdb/isaccdb.dbf
- /oradata/htdisdb/isposdb.dbf
- /oradata/htdisdb/ismngdb.dbf
- /oradata/htdisdb/isstldb.dbf
- /oradata/htdisdb/istxndb.dbf
- /oradata/htdisdb/isacqdb.dbf
- 10 rows selected.
本文转自 珏石头 51CTO博客,原文链接:http://blog.51cto.com/gavinshaw/791093,如需转载请自行联系原作者