1. 程式人生 > >Oracle 10g使用amdu抽取資料檔案

Oracle 10g使用amdu抽取資料檔案

環境:OEL 5.7 + Oracle 10.2.0.5 RAC
需求:實驗在Oracle 10g環境使用amdu抽取資料庫檔案

本文主要目的是介紹3個知識點:

1.使amdu可以在oracle 10g環境中使用

在Oracle 10g環境,並沒有自帶amdu工具,需要自行去下載:
具體可以參考MOS文件:

  • Placeholder for AMDU binaries and using with ASM 10g, 11g, 12c (文件 ID 553639.1)
> $cd <your directory>
> $export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`   
> or $setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:`pwd`
> $export PATH=$PATH:`pwd`  or setenv PATH ${PATH}:`pwd`
> 
> or 
> 
> $cd <your directory>
> $export LIBPATH=$LIBPATH:`pwd` 
> or $setenv LIBPATH ${LIBPATH}:`pwd`
> $export PATH=$PATH:`pwd` or setenv PATH ${PATH}:`pwd`

注意:如果是AIX平臺,則對應的是設定LIBPATH環境變數。我這裡是Linux,所以設定LD_LIBRARY_PATH環境變數:

unzip /tmp/amdu_X86-64.zip 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd` 
export PATH=$PATH:`pwd`

2.使kfed可以在oracle 10g環境中使用

在Oracle 10g環境kfed需要編譯:

  • ASM tools used by Support : KFOD, KFED, AMDU (文件 ID 1485597.1)

KFED executable comes with installation from 11.1 onwards; for the older version you must build it.

編譯方法如下:

$cd $ORACLE_HOME/rdbms/lib
$make -f ins_rdbms.mk ikfed

3.amdu如何抽取損壞的ASM磁碟組資料

在ASM磁碟組損壞時,如何使用amdu工具來抽取資料庫檔案:

  • How to Restore the Database Using AMDU after Diskgroup Corruption (文件 ID 1597581.1)
1. Create pfile of lost database , from database alert.log startup messages.

2. Startup database in nomount

3. Get the controlfile number from db alert log , it will show while starting the database here in this eg. its 256
eg., control_files='+DATA/orcl/controlfile/current.256.709676643'

If you have controlfile backup already in non-asm location edit the pfile to point to location of non-asm and then mount the database
If you dont have controlfile backup then go to step 4 after determining the file# from step 3

4. $ amdu -diskstring <asm_diskstring> -extract DATA.256 

5. shutdown the database and change the control_file location to point to the extracted file location

6. startup mount the database

7. once mounted, get the datafile file numbers using "select name from v$datafile"
  And get online redo logfile from "select * from v$logfile".

8. Extract all datafiles and redolog files in similar manner

9. alter database rename <datafile 1> to < newly extracte location>

10. open the database

實際可以做實驗去驗證下MOS這個步驟的可行性:
1.建立引數檔案
2.啟動資料庫到nomount狀態
3.獲取到控制檔案的number
4.抽出控制檔案
5.關閉資料庫,修改control_file值
6.啟動資料庫到mount狀態
7.獲取到資料檔案、日誌檔案的number
8.抽取資料檔案和redo日誌檔案
9.重新命名資料庫檔案到新位置
10.開啟資料庫