ASM文件管理amdu/dd

ASM文件管理手札之----AMDU/DD

                随着数据库新版本的推广ASM肯定会越来越被重视,最近准备系统的学习下ASM,以备突发情况需要。在11g里未出来之前,能做的很有限,想要copyASM里一个文件出来,只有用DDexec dbms_file_transfer.copy_file(),如果块坏了,那只能用DD找到对应的文件DD出来,再做BBED分析。在11G里出了AMDU,这个可以使用在10G上。下面了解下其用法,并和DD对比,起一个抛砖的作用。

AMDUoracle 11g自带的一款asm文件抽取工具,也可以给oracle 10g用,用法参见oracle metalink 553639.1

下载下来:

unzip amdu_X86-64.zip

export LD_LIBRARY_PATH=./

抽取spfile

文本框: SQL />select name,file_number,alias_index,file_incarnation from v$asm_alias where name like '%spfile%';  NAME	  FILE_NUMBER	 ALIAS_INDEX  	FILE_INCARNATION  spfile.266.866828907		266		477		866828907  spfiledb.ora				266		227		866828907  [grid@mysql-1]$ amdu -diskstring '/dev/raw/raw*' -extract data.266  [grid@mysql-1]$ strings DATA_266.f   db1.__db_cache_size=134217728  db2.__db_cache_size=146800640  db1.__java_pool_size=4194304  db2.__java_pool_size=4194304  db1.__large_pool_size=8388608  db2.__large_pool_size=8388608  db2.__oracle_base='/opt/oracle' #ORACLE_BASE set from environment  …………..    文本框: SQL /> SELECT a.GROUP_KFFXP, a.DISK_KFFXP, a.AU_KFFXP, b.path,c.name   FROM x$kffxp a, v$asm_disk b, v$asm_alias c  WHERE a.number_kffxp = c.file_number  AND a.GROUP_KFFXP = b.group_number  AND a.disk_kffxp = b.disk_number  AND b.group_number=1  AND c.name LIKE '%spfile%';  GROUP_KFFXP	DISK_KFFXP	AU_KFFXP	PATH		NAME  1				0			208		/dev/raw/raw4	spfiledb.ora  1				0			208		/dev/raw/raw4	spfile.266.866828907      文本框: SQL />select name,block_size,allocation_unit_size,state,type from v$asm_diskgroup;  NAME	BLOCK_SIZE	ALLOCATION_UNIT_SIZE	STATE	TYPE  DATA	4096		4194304			CONNECTED	EXTERN  ARCH	4096		0				DISMOUNTED	      文本框: $dd if=/dev/raw/raw4 bs=4096 count=1 skip=212992 of=spfile.ora    文本框: [grid@mysql-1 ~]$ strings spfile.ora   db1.__db_cache_size=134217728  db2.__db_cache_size=150994944  ……………………………………………………….  db1.thread=1  db2.thread=4  db1.undo_tablespace='UNDOTBS1'  db2.undo_tablespace='UNDOTBS4'    文本框: SQL />select file#,name,bytes/1024/1024 from v$datafile where name like '%users%';  FILE#	NAME	BYTES/1024/1024  4	+DATA/db/users01.dbf					2728.75  5	+DATA/db/datafile/users.274.896306467	100  #amdu -diskstring '/dev/raw/raw*' -extract data.274  #cat report.txt  ************************** EXTRACTING FILE DATA.274 **************************              Creating file: DATA_274.f           Extraction wrote: 104865792 bytes                Stripe size: 4194304 bytes             Stripe columns: 1              Mirror copies: 1                 Block size: 8192 bytes                  File size: 12801 blocks                  File type: 2             Extent size #1: 4294967295 extents of  1 AUs             Extent size #2:          0 extents of  1 AUs             Extent size #3:          0 extents of  1 AUs             Extent size #4: 4294967295 extents of  1 AUs              Creation time: 2015/11/20 22:01:07.797000              Modified time: 2015/12/18 20:00:00.000000            Data extents in file: 26            Data extents found: 26           Blocks not found: 0 blocks    文本框: SQL />select 'dd if='||b.path||' bs=4194304 count=1 skip='||au_kffxp||' of=users_'||XNUM_KFFXP||'.dbf'   FROM x$kffxp a, v$asm_disk b, v$asm_alias c  WHERE a.number_kffxp = c.file_number  AND a.GROUP_KFFXP = b.group_number  AND a.disk_kffxp = b.disk_number  AND b.group_number=1  AND c.name LIKE '%USERS.274%'  order by XNUM_KFFXP  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=392 of=users_0.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=571 of=users_1.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=384 of=users_2.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=393 of=users_3.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=572 of=users_4.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=385 of=users_5.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=573 of=users_6.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=394 of=users_7.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=574 of=users_8.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=386 of=users_9.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=575 of=users_10.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=395 of=users_11.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=387 of=users_12.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=704 of=users_13.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=396 of=users_14.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=705 of=users_15.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=388 of=users_16.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=706 of=users_17.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=397 of=users_18.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=389 of=users_19.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=707 of=users_20.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=398 of=users_21.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=708 of=users_22.dbf  dd if=/dev/raw/raw3 bs=4194304 count=1 skip=390 of=users_23.dbf  dd if=/dev/raw/raw2 bs=4194304 count=1 skip=709 of=users_24.dbf  dd if=/dev/raw/raw4 bs=4194304 count=1 skip=399 of=users_25.dbf

posted on 2015-12-21 16:00 snowhill 阅读(142) 评论(0)  编辑 收藏 引用 所属分类: 数据库-oracle


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

公告

又一年...........

留言簿(3)

随笔分类(13)

文章分类(131)

文章档案(124)

c++

java

linux

oracle

常用软件

其他

网络配置

系统安全

音乐

搜索

最新评论

阅读排行榜