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

Oracle數據庫遷移幾種方式

2022-06-13   來源: Oracle 
我們常常需要對數據進行遷移遷移到更加高級的主機上遷移到遠程的機房上遷移到不同的平台下……

  exp/imp

  這也算是最常用最簡單的方法了一般是基於應用的owner級做導出導入

  操作方法為在新庫建立好owner和表空間停老庫的應用在老庫做exp user/pwd owner=XXX file=exp_xxxdmp log=exp_xxxlog buffer=傳dmp文件到新庫在新庫做imp user/pwd fromuser=XXX touser=XXX file=exp_xxxdmp log=imp_xxxlog ignore=y

  優缺點優點是可以跨平台使用;缺點是停機時間長停機時間為從exp到網絡傳輸到新庫再加上imp的時間

  存儲遷移

  這種情況下數據文件控制文件日志文件spfile都在存儲上(一般情況下是裸設備)我們可以直接把存儲掛到新機器上然後在新機器上啟動數據庫

  操作方法將老庫的pfile(因為裡面有指向裸設備的spfile鏈接)tnsnamesoralistenerora密碼文件傳到新庫的對應位置將存儲切至新機或者用文件拷貝或dd的方式復制數據文件啟動數據庫

  優缺點優點是該遷移方式非常簡單主要的工作是主機工程師的工作dba只需配合即可停機時間為當庫切存儲起庫的時間缺點是要求新老庫都是同一平台是相同的數據庫版本

  利用data guard遷移

  用dg我們不僅可以用來做容災物理的dg我們還可以作為遷移的方式

  操作方法可見或者edatafile/或者其他相關網文注意switch over之後可以將dg拆掉去掉log_archive_dest_FAL_SERVERFAL_CLIENTstandby_file_management參數另外還要注意如果用rman做dg注意手工添加tempfile

  優缺點優點是停機時間短停機時間為switch over的時間缺點主機必須雙份存儲必須雙份

  用rman做遷移

  rman比較適合於跨文件系統的遷移如同平台下的不同文件系統

  操作方法

  停第三方的歸檔備份如legato或dp

  backup數據庫

  在一次周末的課程試驗中頻繁的看到 Data file init write 等待事件

  在這裡做一點記錄說明以下是來自跟蹤文件的記錄信息

   以下是引用片段
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=
  WAIT #: nam=Data file init write ela=  count= intr= timeout= obj#= tim=

  測試數據庫是Oracleg 實際上這個等待事件也是從Oracle g開始引入的用來標識表空間或數據文件擴展時的等待

  Oracle 需要將系統塊格式化為Oracle數據塊然後才能提供數據庫使用

  在這個流程處理中Oracle經過如下三個步驟

  擴展數據文件

  select file# from file$ where ts#=:

  更新用戶空間限額

  update tsq$ set blocks=:maxblocks=:grantor#=:priv=:priv=:priv=: where ts#=: and user#=:

  擴展數據段

  update seg$ set type#=:blocks=:extents=:minexts=:maxexts=:extsize=:extpct=:user#=:iniexts=:lists=decode(: NULL :)groups=decode(: NULL :) cachehint=: hwmincr=: spare=DECODE(:NULL:)scanhint=: where ts#=: and file#=: and block#=:

  這就是Oracleg中空間擴展時內部流程


From:http://tw.wingwit.com/Article/program/Oracle/201311/17024.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.