联系:手机/微信(+86 17813235971) QQ(107644445)
标题:使用dd复制asm中文件
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
随着数据库新版本的推广ASM肯定会越来越被重视,最近准备系统的学习下ASM,以备突发情况需要,这是asm深入学习第一篇,参考:dd复制ASM中的datafile
查询ASM某个数据文件AU信息
SQL> SELECT GROUP_NUMBER, FILE_NUMBER, NAME 2 FROM v$asm_alias 3 WHERE NAME LIKE '%USER%' 4 GROUP BY GROUP_NUMBER, FILE_NUMBER, NAME; GROUP_NUMBER FILE_NUMBER NAME ------------ ----------- ----------------------------- 2 259 USERS.259.776961317 SQL> SELECT disk_kffxp, au_kffxp, xnum_kffxp 2 FROM x$kffxp 3 WHERE GROUP_KFFXP=2 4 AND NUMBER_KFFXP=259; DISK_KFFXP AU_KFFXP XNUM_KFFXP ---------- ---------- ---------- 1 817 0 0 507 1 1 818 2 0 508 3 1 819 4 1 820 5 SQL> select DISK_NUMBER,GROUP_NUMBER,PATH from v$asm_disk 2 where GROUP_NUMBER=2 and DISK_NUMBER in(1,0); DISK_NUMBER GROUP_NUMBER PATH ----------- ------------ ----------------------------------- 1 2 /dev/oracleasm/disks/VOL4 0 2 /dev/oracleasm/disks/VOL3
查询ASM DISK对应的磁盘或者分区
[grid@rac1 ~]$ /etc/init.d/oracleasm querydisk -d VOL3 Disk "VOL3" is a valid ASM disk on device [8,17] [grid@rac1 ~]$ /etc/init.d/oracleasm querydisk -d VOL4 Disk "VOL4" is a valid ASM disk on device [8,18] [grid@rac1 ~]$ cat /proc/partitions |grep "8 17" 8 17 2409718 sdb1 [grid@rac1 ~]$ cat /proc/partitions |grep "8 18" 8 18 3879697 sdb2
dd操作磁盘或者分区
[root@rac1 ~]# dd if=/dev/sdb2 bs=1024k count=1 skip=817 of=/tmp/user_1.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.188362 seconds, 5.6 MB/s [root@rac1 ~]# dd if=/dev/sdb1 bs=1024k count=1 skip=507 of=/tmp/user_2.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.259001 seconds, 4.0 MB/s [root@rac1 ~]# dd if=/dev/sdb2 bs=1024k count=1 skip=818 of=/tmp/user_3.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.182559 seconds, 5.7 MB/s [root@rac1 ~]# dd if=/dev/sdb1 bs=1024k count=1 skip=508 of=/tmp/user_4.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.10011 seconds, 10.5 MB/s [root@rac1 ~]# dd if=/dev/sdb2 bs=1024k count=2 skip=819 of=/tmp/user_5.dbf 2+0 records in 2+0 records out 2097152 bytes (2.1 MB) copied, 0.22389 seconds, 9.4 MB/s [root@rac1 ~]# ll /tmp/user_* -rw-r--r-- 1 root root 1048576 Apr 29 18:50 /tmp/user_1.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_2.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_3.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_4.dbf -rw-r--r-- 1 root root 2097152 Apr 29 18:51 /tmp/user_5.dbf [root@rac1 ~]# dd if=/tmp/user_1.dbf bs=1024k count=1 of=/tmp/user_dd.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.0104619 seconds, 100 MB/s [root@rac1 ~]# dd if=/tmp/user_2.dbf bs=1024k count=1 seek=1 of=/tmp/user_dd.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.0129077 seconds, 81.2 MB/s [root@rac1 ~]# dd if=/tmp/user_3.dbf bs=1024k count=1 seek=2 of=/tmp/user_dd.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.00737324 seconds, 142 MB/s [root@rac1 ~]# dd if=/tmp/user_4.dbf bs=1024k count=1 seek=3 of=/tmp/user_dd.dbf 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.0143482 seconds, 73.1 MB/s [root@rac1 ~]# dd if=/tmp/user_5.dbf bs=1024k count=2 seek=4 of=/tmp/user_dd.dbf 2+0 records in 2+0 records out 2097152 bytes (2.1 MB) copied, 0.0809296 seconds, 25.9 MB/s [root@rac1 ~]# ll /tmp/user_* -rw-r--r-- 1 root root 1048576 Apr 29 18:50 /tmp/user_1.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_2.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_3.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_4.dbf -rw-r--r-- 1 root root 2097152 Apr 29 18:51 /tmp/user_5.dbf -rw-r--r-- 1 root root 5242880 Apr 29 18:54 /tmp/user_dd.dbf [root@rac1 ~]# chown oracle.oinstall /tmp/user_dd.dbf [root@rac1 ~]# ll /tmp/user_* -rw-r--r-- 1 root root 1048576 Apr 29 18:50 /tmp/user_1.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_2.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_3.dbf -rw-r--r-- 1 root root 1048576 Apr 29 18:51 /tmp/user_4.dbf -rw-r--r-- 1 root root 2097152 Apr 29 18:51 /tmp/user_5.dbf -rw-r--r-- 1 oracle oinstall 6291456 Apr 29 18:55 /tmp/user_dd.dbf
验证dd拷贝数据文件
[oracle@rac1 ~]$ dbv file='/tmp/user_dd.dbf' DBVERIFY: Release 11.2.0.3.0 - Production on Sun Apr 29 18:56:31 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /tmp/user_dd.dbf DBVERIFY - Verification complete Total Pages Examined : 640 Total Pages Processed (Data) : 15 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 2 Total Pages Failing (Index): 0 Total Pages Processed (Other): 590 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 33 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 782778 (0.782778) [oracle@rac1 ~]$ dbv userid=sys/xifenfei file='+XIFENFEI/xff/datafile/users.259.776961317' > blocksize=8192 DBVERIFY: Release 11.2.0.3.0 - Production on Sun Apr 29 18:58:13 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = +XIFENFEI/xff/datafile/users.259.776961317 DBVERIFY - Verification complete Total Pages Examined : 640 Total Pages Processed (Data) : 15 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 2 Total Pages Failing (Index): 0 Total Pages Processed (Other): 590 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 33 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 0 (0.0)