zoukankan      html  css  js  c++  java
  • 使用dd备份和恢复ASM中的数据文件头

    这里用大家随处可见的(除了extent分布的x$kffxp需要百度和google外),其余都是文档中有详细记载的常用ASM视图来实现同样功能:

    下面的用于从ASM中备份数据文件头:

    SQL> set pages 9999
    SQL> col "backup(dd) fileheader from asm" for a200
    SQL> SELECT 'dd if='||d.path||' of=&backup_path/'||e.GROUP_KFFXP||'_'||e.DISK_KFFXP||'_'||a.file_number||'.asm'||' count=1 conv=notrunc bs='||G.ALLOCATION_UNIT_SIZE||' skip='||e.AU_KFFXP "backup(dd) fileheader from asm" FROM x$kffxp e, v$asm_file f, v$asm_alias a, v$asm_disk d, V$ASM_DISKGROUP G WHERE e.number_kffxp=a.file_number and e.GROUP_KFFXP=a.GROUP_NUMBER and f.group_number=a.group_number and f.file_number=a.file_number and e.DISK_KFFXP=d.DISK_NUMBER and e.GROUP_KFFXP=d.GROUP_NUMBER and a.SYSTEM_CREATED='Y' and f.type='DATAFILE' and e.XNUM_KFFXP=0 AND D.GROUP_NUMBER=G.GROUP_NUMBER;
    Enter value for backup_path: /tmp
    old 1: SELECT 'dd if='||d.path||' of=&backup_path/'||e.GROUP_KFFXP||'_'||e.DISK_KFFXP||'_'
    new 1: SELECT 'dd if='||d.path||' of=/tmp/'||e.GROUP_KFFXP||'_'||e.DISK_KFFXP||'_'

    backup(dd) fileheader from asm
    -------------------------------------------------------------------------------------------
    dd if=/dev/asm-disk1 of=/tmp/1_0_260.asm count=1 conv=notrunc bs=1048576 skip=700
    dd if=/dev/asm-disk1 of=/tmp/1_0_261.asm count=1 conv=notrunc bs=1048576 skip=749
    dd if=/dev/asm-disk1 of=/tmp/1_0_263.asm count=1 conv=notrunc bs=1048576 skip=1101
    dd if=/dev/asm-disk2 of=/tmp/1_1_262.asm count=1 conv=notrunc bs=1048576 skip=978
    dd if=/dev/asm-disk2 of=/tmp/1_1_259.asm count=1 conv=notrunc bs=1048576 skip=103

    下面的用于使用bbed修改文件头后放回到ASM中:
    SQL> set linesize 200
    SQL> set pages 9999
    SQL> col"Restore(dd) fileheader to asm" for a200
    SQL> SELECT 'dd of='||d.path||' if=&backup_path/'||e.GROUP_KFFXP||'_'||e.DISK_KFFXP||'_'||a.file_number||'.asm'||' count=1 conv=notrunc bs='||G.ALLOCATION_UNIT_SIZE||' seek='||e.AU_KFFXP "Restore(dd) fileheader to asm" FROM x$kffxp e, v$asm_file f, v$asm_alias a, v$asm_disk d, V$ASM_DISKGROUP G WHERE e.number_kffxp=a.file_number and e.GROUP_KFFXP=a.GROUP_NUMBER and f.group_number=a.group_number and f.file_number=a.file_number and e.DISK_KFFXP=d.DISK_NUMBER and e.GROUP_KFFXP=d.GROUP_NUMBER and a.SYSTEM_CREATED='Y' and f.type='DATAFILE' and e.XNUM_KFFXP=0 AND D.GROUP_NUMBER=G.GROUP_NUMBER;
    Enter value for backup_path: /tmp
    old 1: SELECT 'dd of='||d.path||' if=&backup_path/'||e.GROUP_KFFXP||'_'||e.DISK_KFFXP||'_'
    new 1: SELECT 'dd of='||d.path||' if=/tmp/'||e.GROUP_KFFXP||'_'||e.DISK_KFFXP||'_'
    Restore(dd) fileheader to asm
    ---------------------------------------------------------------------------------------
    dd of=/dev/asm-disk1 if=/tmp/1_0_258.asm count=1 conv=notrunc bs=1048576 seek=45
    dd of=/dev/asm-disk1 if=/tmp/1_0_260.asm count=1 conv=notrunc bs=1048576 seek=700
    dd of=/dev/asm-disk1 if=/tmp/1_0_261.asm count=1 conv=notrunc bs=1048576 seek=749
    dd of=/dev/asm-disk1 if=/tmp/1_0_263.asm count=1 conv=notrunc bs=1048576 seek=1101
    dd of=/dev/asm-disk2 if=/tmp/1_1_262.asm count=1 conv=notrunc bs=1048576 seek=978
    dd of=/dev/asm-disk2 if=/tmp/1_1_259.asm count=1 conv=notrunc bs=1048576 seek=103

  • 相关阅读:
    环境变量不重启生效
    egret list不显示问题
    批处理收集
    吐槽阿里云数据库的备份还原
    一次没清缓存的坑
    imagepng或imagejpeg浏览器无显示问题
    xdebug调试一直等待连接
    Python快速学习07:文本文件的操作
    Python快速学习06:词典
    纸上谈兵: AVL树[转]
  • 原文地址:https://www.cnblogs.com/zfox2017/p/7569088.html
Copyright © 2011-2022 走看看