計(jì)算機(jī)學(xué)習(xí)積累

          ----轉(zhuǎn)載有理,轉(zhuǎn)載是想研究,想研究才會看,看了才會有感想,轉(zhuǎn)載后我有時(shí)會寫一些自己的感受
          數(shù)據(jù)加載中……

          Oracle數(shù)據(jù)文件移動方法 - 轉(zhuǎn)

          6.2 參考資料:Oracle數(shù)據(jù)庫移動方法
          這里所指“數(shù)據(jù)庫移動”是將Oracle數(shù)據(jù)文件(系統(tǒng)數(shù)據(jù)文件或用戶數(shù)據(jù)文件)、控制文件、重做日志移動至新的存儲路徑,并修改Oracle相關(guān)配置,使之可以重新正常啟動。這種應(yīng)用常見于系統(tǒng)擴(kuò)容后的Oracle數(shù)據(jù)存儲路徑的調(diào)整。
          以下面為例,移動系統(tǒng)表空間的相關(guān)文件位置,并重新配置Oracle。假設(shè)原存儲路徑為/oradata,新存儲路徑為/oratest。
          6.2.1 移動數(shù)據(jù)庫文件
          1) 獲取數(shù)據(jù)庫相關(guān)信息
          查看一下數(shù)據(jù)庫的文件內(nèi)容:
          sqlplus /nolog
          SQL> connect /as sysdba
          SQL> select * from v$datafile;
          SQL> select * from v$controlfile
          SQL> select * from v$logfile;

          2) 移動數(shù)據(jù)庫文件
          以shutdown immediate模式關(guān)閉數(shù)據(jù)庫,復(fù)制數(shù)據(jù)文件到新路徑/oratest/下。需復(fù)制的文件有:
          system01.dbf
          indx01.dbf
          undotbs01.dbf
          drsys01.dbf
          users01.dbf
          tools01.dbf
          control01.ctl
          control02.ctl
          control03.ctl
          redo01.log
          redo02.log
          redo03.log

          3)修改數(shù)據(jù)文件的位置
          以mount模式啟動Oracle,
          SQL>startup mount;
          SQL>alter database rename file '/oradata/system01.dbf' to '/oratest/system01.dbf" ;
          SQL>alter database rename file '/oradata/indx01.dbf' to '/oratest/indx01.dbf" ;
          SQL>alter database rename file '/oradata/undotbs01.dbf' to '/oratest/undotbs01.dbf" ;
          SQL>alter database rename file '/oradata/drsys01.dbf' to '/oratest/drsys01.dbf" ;
          SQL>alter database rename file '/oradata/users01.dbf' to '/oratest/users01.dbf" ;
          SQL>alter database rename file '/oradata/tools01.dbf' to '/oratest/tools01.dbf" ;

          注意:在此步驟只能更改已移動的數(shù)據(jù)庫文件,不能更改控制文件、日志文件和TEMP文件。
          6.2.2 移動控制文件
          1)備份SPFILE中的內(nèi)容:
          重新啟動數(shù)據(jù)庫:
          SQL> startup;
          SQL> create pfile=’/init.ora’ from spfile;

          2)修改init.ora文件內(nèi)容:
          將*.control_files='/oradata/control01.ctl','/oradata/control02.ctl','/oradata/control03.ctl' 更改為新目錄位置的控制文件,如:
          *.control_files='/oratest/control01.ctl','/oratest/control02.ctl','/oratest/control03.ctl'
          關(guān)閉數(shù)據(jù)庫。

          3)倒入?yún)?shù)文件
          以init.ora為參數(shù)啟動數(shù)據(jù)庫,
          SQL> startup pfile=’/init.ora’;
          SQL> create spfile from pfile=’/ init.ora’;
          SQL> shutdown immediate;
          從spfile中進(jìn)行啟動,
          SQL> startup;
          控制文件移動更改完成。
          6.2.3 重定位LOG文件
          日志文件的移動方式有兩種,一種是移動(rename方式),另一種是重建。下面僅舉例說明移動方式。
          移動Redo Log文件:
          SQL>alter database rename file '/oradata/redo01.log' to '/oratest/redo01.log" ;
          SQL>alter database rename file '/oradata/redo02.log' to '/oratest/redo02.log" ;
          SQL>alter database rename file '/oradata/redo03.log' to '/oratest/redo03.log" ;
          6.2.4 重建系統(tǒng)臨時(shí)(temp)文件系統(tǒng)
          在移動數(shù)據(jù)庫表空間時(shí),TEMP文件是不能被移動的,可以重建一個(gè)TEMP表空間,并設(shè)置為系統(tǒng)默認(rèn)的TEMP文件系統(tǒng)。再刪除原來的TEMP表空間,達(dá)到移動表空間的目的。
          SQL>create temporary tablespace TEMP02 tempfile ‘/oratest/temp02.dbf’ size 500m extent management local uniform size 10m;
          SQL>alter database default temporary tablespace TEMP02;

          確認(rèn)創(chuàng)建設(shè)置成功后,再刪除原來的TEMP文件。
          SQL>drop tablespace TEMP including contents and datafiles;
          6.2.5 測試數(shù)據(jù)庫
          重啟ORACLE數(shù)據(jù)
          $ sqlplus “/as sysdba”
          SQL> startup;
          SQL> show sga;
          SQL>


          這看來相當(dāng)于SQLSERVER的附加數(shù)據(jù)庫了,即為oracle的冷備份。
          oracle看來主要有三種文件:數(shù)據(jù)庫文件、控件文件、日志文件
          依次對以上三種文件進(jìn)行移動和修改。

          posted on 2009-08-02 15:39 freebird 閱讀(781) 評論(0)  編輯  收藏 所屬分類: 數(shù)據(jù)庫

          主站蜘蛛池模板: 磐安县| 峨边| 丰顺县| 海城市| 滦平县| 平原县| 饶平县| 木里| 铅山县| 洛隆县| 商都县| 武平县| 溧阳市| 明溪县| 阜新市| 淮安市| 永和县| 富锦市| 浮山县| 体育| 丰顺县| 永丰县| 成安县| 子洲县| 台山市| 通河县| 临夏县| 泽普县| 习水县| 卓资县| 石城县| 琼结县| 游戏| 哈尔滨市| 翁牛特旗| 道孚县| 和田市| 永康市| 开封市| 湘乡市| 大悟县|