oracle 表空間下資料檔案遷移的三種方法

paulyibinyi發表於2009-03-28

       上個星期週末幫客戶做了一個歷史表空間的資料檔案遷移案例,主要是換儲存,有raid 0+1 遷移到 raid 5 儲存型別

上,下面記錄下幾種遷移方法,檔案系統是裸裝置型別,首先要在raid 5儲存上建好相應的lv 裸裝置資料檔案,注意大小一定要和原來一樣大或更大。

  1. 用cplv的方法

    alter tablespace  tablespace_name offline;

   cplv   old_lv  to  new_lv

    alter database rename file 'old_lv' to 'new_lv';

    alter tablespace tablespace_name online;

2.用rman copy的方法

    sqlplus 下

     alter tablespace tablespace_name offline;

    rman 工具下

    rman target  /

    copy datafile  'old_lv ' to 'new_lv';

    sqlplus 下

    alter database rename file 'old_lv' to 'new_lv';

   alter  tablespace tablespace_name online;

3. 全部用rman工具+rman copy 來實現的方法 一個指令碼搞定

   run{
  allocate channel c1 type disk;
  sql 'alter tablespace tablespace_name offline';
  copy datafile 'old_lv' to 'new_lv';
  set newname for datafile 6 to 'new_lv';
  switch datafile 6;
  sql 'alter tablespace tablespace_name online';
  release channel c1;
  }

     

  

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

相關文章