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

  • 相关阅读:
    如何让背景图片全屏显示
    浅谈图片如何在页面中居中显示
    clientHeight、offsetHeight 区别 笔记
    使用Flexible实现手淘H5页面的终端适配
    max(min)-device-width和max(min)-width的区别
    HTML5 meta最全使用手册
    常见浏览器兼容性问题与解决方案
    响应式设计的性能优化(转)
    移动H5前端性能优化指南
    SQL Server Profiler使用方法
  • 原文地址:https://www.cnblogs.com/zfox2017/p/7569088.html
Copyright © 2011-2022 走看看