create controlfile for new SID

mengbing1990發表於2015-11-05
 如果SID更換或者ORACLE_HOME,ORACLE_BASE,
目錄手動更換名稱等,舊的controlfile不能識別現DB檔案的實際位置,
可以透過以下命令,重新建立Contriolfile.

1.進入sqlplus
alter database backup controlfile to trace;
進入db的udump資料夾。檢視最近的tracefile,檢視檔案。
2.  具體script參考tracefile中的指令碼。

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE SET DATABASE "E4MESMO" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 200
    MAXINSTANCES 8
    MAXLOGHISTORY 2336
LOGFILE
  GROUP 1 '/oracle/E4MESMO/data01/RedoLogs/redo01.log'  SIZE 200M,
  GROUP 2 '/oracle/E4MESMO/data01/RedoLogs/redo02.log'  SIZE 200M,
  GROUP 3 '/oracle/E4MESMO/data01/RedoLogs/redo03.log'  SIZE 200M,
  GROUP 4 '/oracle/E4MESMO/data01/RedoLogs/redo04.log'  SIZE 200M,
  GROUP 5 '/oracle/E4MESMO/data01/RedoLogs/redo05.log'  SIZE 200M,
  GROUP 6 '/oracle/E4MESMO/data01/RedoLogs/redo06.log'  SIZE 200M
-- STANDBY LOGFILE
DATAFILE
  '/oracle/E4MESMO/data01/SYSTEM/system01.dbf',
  '/oracle/E4MESMO/data01/UNDO/undo01.dbf',
  '/oracle/E4MESMO/data01/UNDO/undo02.dbf',
  '/oracle/E4MESMO/data01/SYSAUX/sysaux01.dbf',
  '/oracle/E4MESMO/data01/USERS/users01.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t02.bdf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t01.bdf',
  '/oracle/E4MESMO/data01/DEFT_I/deft_i02.bdf',
  '/oracle/E4MESMO/data01/DEFT_I/deft_i01.bdf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t03.bdf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t04.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t05.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t06.dbf',
  '/oracle/E4MESMO/data01/REAL_T/real_t01.bdf',
  '/oracle/E4MESMO/data01/HIST_T/hist_t01.bdf',
  '/oracle/E4MESMO/data01/HIST_I/hist_i01.bdf',
  '/oracle/E4MESMO/data01/CONF_T/conf_t01.bdf',
  '/oracle/E4MESMO/data01/CONF_I/conf_i01.bdf',
  '/oracle/E4MESMO/data01/REAL_I/real_i01.bdf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t07.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t08.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t09.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t10.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t11.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t12.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t13.dbf',
  '/oracle/E4MESMO/data01/HIST_I/hist_i02.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t14.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t15.dbf',
  '/oracle/E4MESMO/data01/DEFT_T/deft_t16.dbf',
  '/oracle/E4MESMO/data02/REAL_I/real_i02.bdf',
  '/oracle/E4MESMO/data02/HIST_I/hist_i03.dbf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t17.dbf',
  '/oracle/E4MESMO/data02/HIST_T/hist_t02.bdf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t18.dbf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t19.dbf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t20.dbf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t21.dbf',
  '/oracle/E4MESMO/data02/HIST_I/hist_i04.dbf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t22.dbf',
  '/oracle/E4MESMO/data02/UNDO/undo03.dbf',
  '/oracle/E4MESMO/data02/UNDO/undo04.dbf',
  '/oracle/E4MESMO/data02/DEFT_I/deft_i03.bdf',
  '/oracle/E4MESMO/data02/HIST_T/hist_t03.bdf',
  '/oracle/E4MESMO/data02/HIST_I/hist_i05.dbf',
  '/oracle/E4MESMO/data02/DMS900_T/dms900_t01.bdf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t23.dbf',
  '/oracle/E4MESMO/data02/DEFT_T/deft_t24.dbf'
CHARACTER SET AL32UTF8
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oracle/E4MESMO/oraarch/1_1_710003234.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/oracle/E4MESMO/oraarch/1_1_894099023.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/E4MESMO/data02/TEMP/temp04.dbf'
     SIZE 2048M REUSE AUTOEXTEND ON NEXT 134217728  MAXSIZE 32767M;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/E4MESMO/data01/TEMP/temp03.dbf'
     SIZE 2000M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/E4MESMO/data01/TEMP/temp02.dbf'
     SIZE 2000M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/E4MESMO/data01/TEMP/temp01.dbf'
     SIZE 2000M REUSE AUTOEXTEND OFF;
-- End of tempfile additions.
--

3.重建完的DB沒有temp tablespace;
再建立temp tablespace;即可。

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

相關文章