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

  • 相关阅读:
    PHP post接口返回数据
    wamp 安装多版本php
    关于WAMP的apache 人多了就访问非常卡的问题解决方法(转)
    在生产环境上重装wamp
    wamp不记录访问日志的办法
    oracle数据库锁表解决办法
    wampserver 中127.0.0.1可以访问,但localhost无法访问
    PLSQL中查询数据的时候查询结果显示中文乱码(转)
    Could not read from remote repository
    17-案例
  • 原文地址:https://www.cnblogs.com/zfox2017/p/7569088.html
Copyright © 2011-2022 走看看