Pre-Oracle Database backup protection site recommendations-ASM Environment

Source: Internet
Author: User
Tags dba file size reserved oracle database


In the previous article wrote the file system library, in the exception recovery before the backup method (Oracle exception recovery before the backup protection site recommended-filesystem environment), for the ASM Library, because the ASM inside the data file can not direct DD file header, As a result, the backup approach has changed. For ASM is mount, but the database cannot be opened, using Rman or ASM's CP command to back up all data files is too late or insufficient space, You can consider using Rman or CP commands to back up control files and system table space files, CP command backup REDO,DD command backup file headers, to complete the ASM situation before database exception recovery

Controlling file backups
11.2 and later versions are processed using the Asmcmd CP command
Select ' Asmcmd cp ' | | name| | ' &&backup_dir/' from V$datafile where ts#=0
UNION ALL
Select ' Asmcmd cp ' | | name| | ' &&backup_dir/crontrofile_ ' | | rownum| | '. CTL ' from V$controlfile
UNION ALL
Select ' Asmcmd cp ' | | member| | ' &&backup_dir/' | | thread#| | ' _'|| a.group#| | ' _'|| sequence#| | ' _'|| SUBSTR (Member,
InStr (Member, '/', -1) +1 "from V$log A, v$logfile b WHERE a.group# = b.group#;
Other versions use the Rman command to process
--rman Backup control file (/tmp directory own modification)
Copy current controlfile to '/tmp/ctl.ctl ';

--rman Backup system table space
Select ' Copy datafile ' | | file#| | ' to ' &backup_dir/system_ ' | | file#| | '. DBF '; '
from V$datafile where ts#=0;

--redo cannot be backed up directly
Back up file headers
[Grid@xifenfei ~]$ SS

Sql*plus:release 11.2.0.4.0 Production on Fri May 1 04:15:18 2015

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


Connected to:
Oracle Database 11g Enterprise Edition release 11.2.0.4.0-64bit Production
With the Automatic Storage Management option

Sql> Set Lines 150
Sql> Select ' dd if= ' | | c.path_kfdsk| | ' of=&&backup_path/' | | a.group_kffxp| | ' _'|| a.disk_kffxp| | ' _'||
2 b.number_kffil| | '. ASM count=1 bs= ' | | d.ausize_kfgrp| | ' skip= ' | | A.AU_KFFXP Backup_dd_cmd
3 from X$kffxp A, x$kffil b,x$kfdsk c,x$kfgrp D WHERE
4 A.group_kffxp=b.group_kffil
5 and A.number_kffxp=b.number_kffil
6 and B.ftype_kffil in (2,12)
7 and b.number_kffil>255
8 and A.xnum_kffxp=0
9 and A.group_kffxp=c.grpnum_kfdsk
A.disk_kffxp=c.number_kfdsk
One and A.GROUP_KFFXP=D.NUMBER_KFGRP;
Enter value for Backup_path:/tmp
Old 1:select ' dd if= ' | | c.path_kfdsk| | ' of=&&backup_path/' | | a.group_kffxp| | ' _'|| a.disk_kffxp| | ' _'||
New 1:select ' dd if= ' | | c.path_kfdsk| | ' of=/tmp/' | | a.group_kffxp| | ' _'|| a.disk_kffxp| | ' _'||

Backup_dd_cmd
--------------------------------------------------------------------------------------------------------------- ---
DD if=/dev/asm-disk1 of=/tmp/1_0_256.asm count=1 bs=1048576 skip=29
DD if=/dev/asm-disk2 of=/tmp/1_1_257.asm count=1 bs=1048576 skip=404
DD if=/dev/asm-disk2 of=/tmp/1_1_258.asm count=1 bs=1048576 skip=641
DD if=/dev/asm-disk1 of=/tmp/1_0_259.asm count=1 bs=1048576 skip=648
DD if=/dev/asm-disk3 of=/tmp/2_0_256.asm count=1 bs=1048576 skip=51
Restore File Headers
Sql> Set Lines 150
Sql> Select ' dd of= ' | | c.path_kfdsk| | ' if=&&backup_path/' | | a.group_kffxp| | ' _'|| a.disk_kffxp| |
2 ' _ ' | | b.number_kffil| | '. ASM count=1 conv=notrunc bs= ' | | d.ausize_kfgrp| | ' seek= ' | | A.AU_KFFXP Restore_dd_cmd
3 from X$kffxp A, x$kffil b,x$kfdsk c,x$kfgrp D WHERE
4 A.group_kffxp=b.group_kffil
5 and A.number_kffxp=b.number_kffil
6 and B.ftype_kffil in (2,12)
7 and b.number_kffil>255
8 and A.xnum_kffxp=0
9 and A.group_kffxp=c.grpnum_kfdsk
A.disk_kffxp=c.number_kfdsk
One and A.GROUP_KFFXP=D.NUMBER_KFGRP;
Old 1:select ' dd of= ' | | c.path_kfdsk| | ' if=&&backup_path/' | | a.group_kffxp| | ' _'|| a.disk_kffxp| |
New 1:select ' dd of= ' | | c.path_kfdsk| | ' if=/tmp/' | | a.group_kffxp| | ' _'|| a.disk_kffxp| |

Restore_dd_cmd
--------------------------------------------------------------------------------------------------------------- --
DD of=/dev/asm-disk1 if=/tmp/1_0_256.asm count=1 conv=notrunc bs=1048576 seek=29
DD of=/dev/asm-disk2 if=/tmp/1_1_257.asm count=1 conv=notrunc bs=1048576 seek=404
DD of=/dev/asm-disk2 if=/tmp/1_1_258.asm count=1 conv=notrunc bs=1048576 seek=641
DD of=/dev/asm-disk1 if=/tmp/1_0_259.asm count=1 conv=notrunc bs=1048576 seek=648
DD of=/dev/asm-disk3 if=/tmp/2_0_256.asm count=1 conv=notrunc bs=1048576 seek=51

Sql>
Backup restore file Header test-test to prove that the method backs up the file header is OK
Close the database and use DD to back up the file headers
[Oracle@xifenfei ~]$ Sqlplus/as SYSDBA

Sql*plus:release 11.2.0.4.0 Production on Fri May 1 04:21:49 2015

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


Connected to:
Oracle Database 11g Enterprise Edition release 11.2.0.4.0-64bit Production
With the partitioning, Automatic Storage Management, OLAP, Data Mining
and real Application testing options

sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Dul View current dbname value is Xifenfei
[Oracle@xifenfei dul]$./dul

Data unloader:10.2.0.6.5-internal only-on Fri May 1 04:37:43 2015
With 64-bit IO functions

Copyright (c) 1994 2015 Bernard van Duijnen all rights reserved.

Strictly Oracle Internal Use only


Disk group DATA, Dul group_cid 0
Discovered Disk/dev/asm-disk1 as DiskGroup DATA, disk number 0 size 3922 Mb File1 starts at 2, Dul_disk_cid 0
Discovered Disk/dev/asm-disk2 as diskgroup data, disk number 1 size 3922 Mb without File1 meta DATA, dul_disk_cid 1
Disk group Xifenfei, Dul group_cid 1
Discovered Disk/dev/asm-disk3 as DiskGroup Xifenfei, disk number 0 size 4439 Mb File1 starts at 2, Dul_disk_cid 2

DUL:Warning:Dictionary Cache dc_asm_extents is empty
Probing for attributes in File9, the attributes directory, for disk group DATA
Attribute name "_extent_sizes", Value "1 4 16"
Attribute name "_extent_counts", value "20000 20000 2147483647"
Oracle data File size 775954432 bytes, block size 8192
Found db_id = 1495013434
Found db_name = Xifenfei <-----DB name
DUL:Error:Filedir block not allocated, file does not exist
DUL:Error:Could not load ASM Meta data for group Xifenfei file 9
Probing for filenames in File6, the alias directory, for disk group Xifenfei
+xifenfei/xifenfei/datafile/xifenfei.256.878397315
Probing for database datafiles in File1, the file directory, for disk group Xifenfei
File 256 datafile size 104865792, block size 8192
Disk group Xifenfei has one file of type datafile
Use DD to back up 1 file headers
[Oracle@xifenfei tmp]$ dd if=/dev/asm-disk1 of=/tmp/1_0_256.asm count=1 bs=1048576 skip=29
1+0 Records in
1+0 Records out
1048576 bytes (1.0 MB) copied, 0.0168209 seconds, 62.3 MB/s
Try to change the dbname from Xifenfei to ORCL
Sql> Select Dump (' Xifenfei ',) from dual;

DUMP (' Xifenfei ', 16)
-------------------------------------
typ=96 len=8:58,49,46,45,4e,46,45,49

sql> SELECT DUMP (' ORCL ',) from DUAL;

DUMP (' ORCL ', 16)
-------------------------
typ=96 len=4:4f,52,43,4c

Sql>
Bbed modified Xifenfei for ORCL
[Oracle@xifenfei tmp]$ bbed filename= '/tmp/1_0_256.asm ' Mode=edit
Password:

Bbed:release 2.0.0.0.0-limited Production on Fri May 1 04:24:06 2015

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

************* !!! For Oracle Internal with only!!! ***************

Bbed> Set BlockSize 8192
BLOCKSIZE 8192

Bbed> Set block 1
block# 1

Bbed> Map
File:/tmp/1_0_256.asm (0)
Block:1 dba:0x00000000
------------------------------------------------------------
Data File Header

struct KCVFH, 860 bytes @0

UB4 Tailchk @8188

Bbed> P KCVFHHDR
struct Kcvfhhdr, Bytes @20
UB4 KCCFHSWV @20 0x00000000
UB4 KCCFHCVN @24 0x0b200400
UB4 kccfhdbi @28 0x591c183a
Text Kccfhdbn[0] @32 X
Text Kccfhdbn[1] @33 I
Text Kccfhdbn[2] @34 F
Text Kccfhdbn[3] @35 E
Text Kccfhdbn[4] @36 N
Text Kccfhdbn[5] @37 F
Text Kccfhdbn[6] @38 E
Text Kccfhdbn[7] @39 I

Bbed> D seek 32
File:/tmp/1_0_256.asm (0)
Block:1 seeks:32 to dba:0x00000000
------------------------------------------------------------------------
58494645 4e464549 12040000 00720100 00200000 01000300 00000000 00000000

<32 bytes per line>
DD restores the modified block to ASM
[Oracle@xifenfei dul]$ dd of=/dev/asm-disk1 if=/tmp/1_0_256.asm count=1 conv=notrunc bs=1048576 seek=29
1+0 Records in
1+0 Records out
1048576 bytes (1.0 MB) copied, 0.00253244 seconds, 414 MB/s
Dul validation dbname modified to ORCL successful
[Oracle@xifenfei dul]$./dul

Data unloader:10.2.0.6.5-internal only-on Fri May 1 04:41:33 2015
With 64-bit IO functions

Copyright (c) 1994 2015 Bernard van Duijnen all rights reserved.

Strictly Oracle Internal Use only


Disk group DATA, Dul group_cid 0
Discovered Disk/dev/asm-disk1 as DiskGroup DATA, disk number 0 size 3922 Mb File1 starts at 2, Dul_disk_cid 0
Discovered Disk/dev/asm-disk2 as diskgroup data, disk number 1 size 3922 Mb without File1 meta DATA, dul_disk_cid 1
Disk group Xifenfei, Dul group_cid 1
Discovered Disk/dev/asm-disk3 as DiskGroup Xifenfei, disk number 0 size 4439 Mb File1 starts at 2, Dul_disk_cid 2

DUL:Warning:Dictionary Cache dc_asm_extents is empty
Probing for attributes in File9, the attributes directory, for disk group DATA
Attribute name "_extent_sizes", Value "1 4 16"
Attribute name "_extent_counts", value "20000 20000 2147483647"
Oracle data File size 775954432 bytes, block size 8192
Found db_id = 1495013434
Found db_name = ORCL <----modified dbname
DUL:Error:Filedir block not allocated, file does not exist
DUL:Error:Could not load ASM Meta data for group Xifenfei file 9
Probing for filenames in File6, the alias directory, for disk group Xifenfei
+xifenfei/xifenfei/datafile/xifenfei.256.878397315
Probing for database datafiles in File1, the file directory, for disk group Xifenfei
File 256 datafile size 104865792, block size 8192
Disk group Xifenfei has one file of type datafile
Back up the ASM disk header for ASM cannot mount
The backup of the ASM disk is primarily the backup disk head 100M space and is backed up directly using the DD command
Set Lines 150
Set pages 1000
Select ' dd if= ' | | path| | ' of=&asmbackup_dir/' | | group_number| | ' _'|| disk_number| | '. ASM bs=1048576
Count=100 ' from V$asm_disk;
Set Lines 150
Set pages 1000
Select ' dd of= ' | | path| | ' if=&asmbackup_dir/' | | group_number| | ' _'|| disk_number| | '. ASM bs=1048576
Count=100 Conv=notrunc ' from V$asm_disk;
Asmlib need to pay attention to the ORCL: Replace with the/dev/oracleasm/disks/corresponding directory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.