資料庫建庫的時候指定資料檔案多出來一個子目錄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.