用重建控制檔案的方法修改oracle資料檔案路徑

gjm008發表於2009-02-04


1、檢視資料檔案的位置:
SQL> select file_name,tablespace_name,status from dba_data_files;

FILE_NAME                                                                                                                      
-----------------------------------------------------------------------------------------------------------------------------
E:\ORACLE\ORADATA\TONES\SYSTEM01.DBF                                                                                           
E:\ORACLE\ORADATA\TONES\UNDOTBS01.DBF                                                                                          
E:\ORACLE\ORADATA\TONES\CWMLITE01.DBF                                                                                          
E:\ORACLE\ORADATA\TONES\DRSYS01.DBF                                                                                            
E:\ORACLE\ORADATA\TONES\EXAMPLE01.DBF                                                                                          
E:\ORACLE\ORADATA\TONES\INDX01.DBF                                                                                             
E:\ORACLE\ORADATA\TONES\ODM01.DBF                                                                                              
E:\ORACLE\ORADATA\TONES\TOOLS01.DBF                                                                                            
E:\ORACLE\ORADATA\TONES\USERS01.DBF                                                                                            
E:\ORACLE\ORADATA\TONES\XDB01.DBF                                                                                              
E:\ORACLE\ERP\ERP01.DBF                                                                                                        

FILE_NAME                                                                                                                      
-----------------------------------------------------------------------------------------------------------------------------
E:\ORACLE\ORADATA\TONES\BRM01.DBF                                                                                              
E:\ORACLE\ERP\RMANDB01.DBF                                                                                                     

已選擇13行。

2、關閉資料庫,拷貝ERP下的檔案到E:\ORACLE\ORADATA\TONES\中
SQL> shutdown immediate;
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。

3、啟動到mount下
SQL> startup mount
ORACLE 例程已經啟動。

Total System Global Area  126950220 bytes
Fixed Size                   453452 bytes
Variable Size             109051904 bytes
Database Buffers           16777216 bytes
Redo Buffers                 667648 bytes
資料庫裝載完畢。

4、備份控制檔案,在udump目錄下產生trace檔案:
SQL> alter database backup controlfile to trace;
資料庫已更改。

5、關閉資料庫,編輯產生的trc檔案。
SQL> shutdown immediate;
ORA-01109: 資料庫未開啟

已經解除安裝資料庫。
ORACLE 例程已經關閉。

6、啟動資料庫到nomount下,執行建立控制檔案的語句
SQL> startup nomount;
ORACLE 例程已經啟動。

Total System Global Area  126950220 bytes
Fixed Size                   453452 bytes
Variable Size             109051904 bytes
Database Buffers           16777216 bytes
Redo Buffers                 667648 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "TONES" NORESETLOGS FORCE LOGGING ARCHIVELOG
  2      MAXLOGFILES 50
  3      MAXLOGMEMBERS 5
  4      MAXDATAFILES 100
  5      MAXINSTANCES 1
  6      MAXLOGHISTORY 226
  7  LOGFILE
  8    GROUP 1 'E:\ORACLE\ORADATA\TONES\REDO01.LOG'  SIZE 100M,
  9    GROUP 2 'E:\ORACLE\ORADATA\TONES\REDO02.LOG'  SIZE 100M,
 10    GROUP 3 'E:\ORACLE\ORADATA\TONES\REDO03.LOG'  SIZE 100M
 11  DATAFILE
 12    'E:\ORACLE\ORADATA\TONES\SYSTEM01.DBF',
 13    'E:\ORACLE\ORADATA\TONES\UNDOTBS01.DBF',
 14    'E:\ORACLE\ORADATA\TONES\CWMLITE01.DBF',
 15    'E:\ORACLE\ORADATA\TONES\DRSYS01.DBF',
 16    'E:\ORACLE\ORADATA\TONES\EXAMPLE01.DBF',
 17    'E:\ORACLE\ORADATA\TONES\INDX01.DBF',
 18    'E:\ORACLE\ORADATA\TONES\ODM01.DBF',
 19    'E:\ORACLE\ORADATA\TONES\TOOLS01.DBF',
 20    'E:\ORACLE\ORADATA\TONES\USERS01.DBF',
 21    'E:\ORACLE\ORADATA\TONES\XDB01.DBF',
 22    'E:\ORACLE\ORADATA\TONES\ERP01.DBF',
 23    'E:\ORACLE\ORADATA\TONES\BRM01.DBF',
 24    'E:\ORACLE\ORADATA\TONES\RMANDB01.DBF'
 25  CHARACTER SET ZHS16GBK;

控制檔案已建立

7、開啟資料庫,
SQL> alter database open;
alter database open
*
ERROR 位於第 1 行:
ORA-16014: ?? 2 ???? 15 ????????????
ORA-00312: ???? 2 ?? 1: 'E:\ORACLE\ORADATA\TONES\REDO02.LOG'

8、系統提示出錯,重新關閉資料庫
SQL> shutdown immediate
ORA-01109: ??????
已經解除安裝資料庫。
ORACLE 例程已經關閉。

9、啟動到mount下,清除unarchived logfile 'e:\ORACLE\ORADATA\TONES\REDO02.LOG';
SQL> conn sys/gjm001 as sysdba;
已連線到空閒例程。
SQL> startup mount
ORACLE 例程已經啟動。

Total System Global Area  126950220 bytes
Fixed Size                   453452 bytes
Variable Size             109051904 bytes
Database Buffers           16777216 bytes
Redo Buffers                 667648 bytes
資料庫裝載完畢。

SQL> alter database clear  unarchived logfile 'e:\ORACLE\ORADATA\TONES\REDO02.LOG';
資料庫已更改。

SQL> alter database open;
資料庫已更改。

10、重新檢視資料檔案位置
SQL> select name from v$datafile;

NAME
-----------------------------------------------------------------------------------------------------------------------------
E:\ORACLE\ORADATA\TONES\SYSTEM01.DBF
E:\ORACLE\ORADATA\TONES\UNDOTBS01.DBF
E:\ORACLE\ORADATA\TONES\CWMLITE01.DBF
E:\ORACLE\ORADATA\TONES\DRSYS01.DBF
E:\ORACLE\ORADATA\TONES\EXAMPLE01.DBF
E:\ORACLE\ORADATA\TONES\INDX01.DBF
E:\ORACLE\ORADATA\TONES\ODM01.DBF
E:\ORACLE\ORADATA\TONES\TOOLS01.DBF
E:\ORACLE\ORADATA\TONES\USERS01.DBF
E:\ORACLE\ORADATA\TONES\XDB01.DBF
E:\ORACLE\ORADATA\TONES\ERP01.DBF

NAME
-----------------------------------------------------------------------------------------------------------------------------
E:\ORACLE\ORADATA\TONES\BRM01.DBF
E:\ORACLE\ORADATA\TONES\RMANDB01.DBF

已選擇13行。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16486600/viewspace-545263/,如需轉載,請註明出處,否則將追究法律責任。

相關文章