asm-根据x$kffxp获取au的dd脚本

[grid@rac1 ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512             512   4096  4194304      4596     3632             1532            1050              0             Y  CRS/
MOUNTED  EXTERN  N         512             512   4096  4194304     51196    40060                0           40060              0             N  DATA/
ASMCMD> cd data
ASMCMD> ls
ORCL/
ASMCMD> cd orcl
ASMCMD> ls
998DDBCF1D91E20FE0539634A8C06305/
A0044C1C44692EE6E0539634A8C0A37C/
ARCHIVELOG/
AUTOBACKUP/
CONTROLFILE/
DATAFILE/
DATAGUARDCONFIG/
FLASHBACK/
ONLINELOG/
PARAMETERFILE/
PASSWORD/
TEMPFILE/
dr1orcl.dat
dr2orcl.dat
dr3orcl.dat
dr4orcl.dat
pdb/
ASMCMD> cd datafile
ASMCMD> ls
SYSAUX.280.1026902753
SYSTEM.259.1026902751
UNDOTBS1.279.1026902755
UNDOTBS2.270.1026902767
USERS.373.1026902767
ASMCMD> cd ../controlfile
ASMCMD> ls
Current.265.1026902749
ASMCMD> cd ../para*
ASMCMD> ls
spfile.287.1026905945
ASMCMD> exit
[grid@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 28 13:07:44 2020
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0

SQL> set line 160

取出au脚本:

Select 'dd if='||d.path||' bs=4194304 count=1 skip='||p.au_kffxp||' of=users_'||p.XNUM_KFFXP||'.dbf'
from x$kffxp p, v$asm_alias a,v$asm_disk d,v$asm_diskgroup dg
     where p.GROUP_KFFXP = a.GROUP_NUMBER
       and p.NUMBER_KFFXP = a.FILE_NUMBER
       and a.name in ('USERS.373.1026902767')
       and p.LXN_KFFXP=0
       and d.GROUP_NUMBER=p.GROUP_KFFXP
       and dg.GROUP_NUMBER=p.GROUP_KFFXP
       and p.DISK_KFFXP=d.disk_number
order by XNUM_KFFXP;

SQL> Select 'dd if='||d.path||' bs=4194304 count=1 skip='||p.au_kffxp||' of=users_'||p.XNUM_KFFXP||'.dbf'
  2  from x$kffxp p, v$asm_alias a,v$asm_disk d,v$asm_diskgroup dg
  3       where p.GROUP_KFFXP = a.GROUP_NUMBER
  4         and p.NUMBER_KFFXP = a.FILE_NUMBER
  5         and a.name in ('USERS.373.1026902767')
  6         and p.LXN_KFFXP=0
  7         and d.GROUP_NUMBER=p.GROUP_KFFXP
  8         and dg.GROUP_NUMBER=p.GROUP_KFFXP
  9         and p.DISK_KFFXP=d.disk_number
 10  order by XNUM_KFFXP;

'DDIF='||D.PATH||'BS=4194304COUNT=1SKIP='||P.AU_KFFXP||'OF=USERS_'||P.XNUM_KFFXP||'.DBF'
----------------------------------------------------------------------------------------------------------------------------------------------------------------
dd if=/dev/asm-data bs=4194304 count=1 skip=1993 of=users_0.dbf
dd if=/dev/asm-data bs=4194304 count=1 skip=1994 of=users_1.dbf

SQL> 
SQL> 

拼接au脚本:

SELECT 'dd if=users_'||p.XNUM_KFFXP||'.dbf bs=4194304 count=1 seek='||p.XNUM_KFFXP||' of=users.all.dbf'
from x$kffxp p, v$asm_alias a,v$asm_disk d,v$asm_diskgroup dg
     where p.GROUP_KFFXP = a.GROUP_NUMBER
       and p.NUMBER_KFFXP = a.FILE_NUMBER
       and a.name in ('USERS.373.1026902767')
       and p.LXN_KFFXP=0
       and d.GROUP_NUMBER=p.GROUP_KFFXP
       and dg.GROUP_NUMBER=p.GROUP_KFFXP
       and p.DISK_KFFXP=d.disk_number
order by XNUM_KFFXP;


SQL> 
SQL> SELECT 'dd if=users_'||p.XNUM_KFFXP||'.dbf bs=4194304 count=1 seek='||p.XNUM_KFFXP||' of=users.all.dbf'
  2  from x$kffxp p, v$asm_alias a,v$asm_disk d,v$asm_diskgroup dg
  3       where p.GROUP_KFFXP = a.GROUP_NUMBER
  4         and p.NUMBER_KFFXP = a.FILE_NUMBER
  5         and a.name in ('USERS.373.1026902767')
  6         and p.LXN_KFFXP=0
  7         and d.GROUP_NUMBER=p.GROUP_KFFXP
  8         and dg.GROUP_NUMBER=p.GROUP_KFFXP
  9         and p.DISK_KFFXP=d.disk_number
 10  order by XNUM_KFFXP;

'DDIF=USERS_'||P.XNUM_KFFXP||'.DBFBS=4194304COUNT=1SEEK='||P.XNUM_KFFXP||'OF=USERS.ALL.DBF'
----------------------------------------------------------------------------------------------------------------------------------------------------------------
dd if=users_0.dbf bs=4194304 count=1 seek=0 of=users.all.dbf
dd if=users_1.dbf bs=4194304 count=1 seek=1 of=users.all.dbf

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0
[grid@rac1 ~]$ dd if=/dev/asm-data bs=4194304 count=1 skip=1993 of=users_0.dbf
1+0 records in
1+0 records out
4194304 bytes (4.2 MB) copied, 0.0128604 s, 326 MB/s
[grid@rac1 ~]$ dd if=/dev/asm-data bs=4194304 count=1 skip=1994 of=users_1.dbf
1+0 records in
1+0 records out
4194304 bytes (4.2 MB) copied, 0.0375888 s, 112 MB/s
[grid@rac1 ~]$ du -sh *
4.0K    orapworcl1
4.0K    t.txt
4.0M    users_0.dbf
4.0M    users_1.dbf
[grid@rac1 ~]$ pwd
/home/grid
[grid@rac1 ~]$ dd if=users_0.dbf bs=4194304 count=1 seek=0 of=users.all.dbf
1+0 records in
1+0 records out
4194304 bytes (4.2 MB) copied, 0.00379943 s, 1.1 GB/s
[grid@rac1 ~]$ dd if=users_1.dbf bs=4194304 count=1 seek=1 of=users.all.dbf
1+0 records in
1+0 records out
4194304 bytes (4.2 MB) copied, 0.0125375 s, 335 MB/s
[grid@rac1 ~]$ du -sh *
4.0K    orapworcl1
4.0K    t.txt
4.0M    users_0.dbf
4.0M    users_1.dbf
8.0M    users.all.dbf
[grid@rac1 ~]$ dbv file=users.all.dbf

DBVERIFY: Release 19.0.0.0.0 - Production on Sun Jun 28 13:11:45 2020

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

DBVERIFY - Verification starting : FILE = /home/grid/users.all.dbf


DBVERIFY - Verification complete

Total Pages Examined         : 640
Total Pages Processed (Data) : 60
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 208
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 357
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 1309490 (0.1309490)
[grid@rac1 ~]$ 

 

https://www.enmotech.com/web/detail/1/506/2.html

你可能感兴趣的:(oracle,asm)