熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

2013-11-15 11:50:34  來源: JSP教程 

  剛開始出現了些問題搞得我既郁悶又著急都不知道我在記什麼了大家將就著看吧!
  
  一個G數據庫的真實遷移過程(也可以說是一個數據庫系統崩潰下的恢復過程)要求停機的時間最短
  
  前提:擁有完整的數據庫備份和歸檔日志遷移的主機所有的目錄結構和原主機一樣
  
  Oracle版本:
  
  操作系統: linux
  
  備份程序:rman沒用恢復目錄
  
  把所有rman的備份(包括控制文件的自動備份)拷貝到新的服務器上路徑要和原來的一模一樣
  
  遷移過程如下:
  
  把參數文件tns等文件拷貝到新服務器上原數據庫停機開始把數據庫遷移到新的服務器上
  
  $set oracle_sid=service
  
  SQL> conn / as sysdba
  
  Connected
  
  SQL>startup nomount;
  
  恢復控制文件
  
  SQL> declare
  
  devtype varchar();
  
  done boolean;
  
  begin
  
  devtype :=dbms_backup_restoredeviceallocate(NULL);
  
  dbms_backup_restorerestoresetdatafile;
  
  dbms_backup_restorerestorecontrolfileto(/opt/data/SERVICE/controlctl); dbms_backup_restorerestorebackuppiece(/opt/backup/control_cDONE => done);
  
  end;
  
  /
  
  PL/SQL procedure successfully completed
  
  這個過程我到現在還解應該是只要控制文件自動備份通過restore controlfile from autobackup就能恢復過來但我在現場怎麼實現不了沒辦法只要用dbms_backup_restore包了
  
  把控制文件復制成三個文件
  
  $ cp controlctl controlctl
  
  $ cp controlctl controlctl
  
  SQL>alter database mount 數據庫啟動到mount狀態准備進行數據文件的恢復
  
  啟動rman
  
  Recovery Manager: Release Production
  
  Copyright (c) Oracle All rights reserved
  
  RMAN> connect target /
  
  connected to target database: SERVICE (DBID=)
  
  RMAN> restore database ;
  
  Starting restore at AUG
  
  using target database controlfile instead of recovery catalog
  
  allocated channel: ORA_DISK_
  
  channel ORA_DISK_: sid= devtype=DISK
  
  channel ORA_DISK_: starting datafile backupset restore
  
  channel ORA_DISK_: specifying datafile(s) to restore from backup set
  
  restoring datafile to /opt/data/SERVICE/systemdbf
  
  restoring datafile to /opt/data/SERVICE/undotbsdbf
  
  restoring datafile to /opt/data/SERVICE/sysauxdbf
  
  restoring datafile to /opt/data/SERVICE/usersdbf
  
  restoring datafile to /opt/data/SERVICE/businessdbf
  
  restoring datafile to /opt/data/SERVICE/advertisedbf
  
  restoring datafile to /opt/data/SERVICE/backupdbf
  
  channel ORA_DISK_: restored backup piece
  
  piece handle=/opt/backup/service_mpgrf___ tag=TAGT
  
  channel ORA_DISK_: restore complete
  
  Finished restore at AUG
  
  查看歸檔日志
  
  RMAN> list backup archivelog all;
  
  進行數據庫的恢復
  
  RMAN> recover database;
  
  Starting recover at AUG
  
  using channel ORA_DISK_
  
  starting media recovery
  
  channel ORA_DISK_: starting archive log restore to default destination
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restored backup piece
  
  piece handle=/opt/backup/service_mqgrjj___ tag=TAGT
  
  channel ORA_DISK_: restore complete
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  channel ORA_DISK_: starting archive log restore to default destination
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restored backup piece
  
  piece handle=/opt/backup/service_msgrom___ tag=TAGT
  
  channel ORA_DISK_: restore complete
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  channel ORA_DISK_: starting archive log restore to default destination
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restored backup piece
  
  piece handle=/opt/backup/service_mvgrafg___ tag=TAGT
  
  channel ORA_DISK_: restore complete
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  archive log filename=/opt/archive/SERVICE__dbf thread= sequence=
  
  channel ORA_DISK_: starting archive log restore to default destination
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log thread= sequence=
  
  channel ORA_DISK_: restoring archive log
  
  archive log
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19738.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.