[Translated from mos] New asmcmd commands of 11gR1 version: cp, md_backup, md_restore, 11gr1 -- cp
New asmcmd commands of 11gR1 version: cp, md_backup, md_restore
Reference Original:
ASMCMD-New commands in FIG (Doc ID 451900.1)
Applicable:
Oracle Database-Enterprise Edition-Version 11.1.0.6 to 11.1.0.7 [Release 11.1]
Information in this document applies to any platform.
* ** Checked for relevance on 02-Jan-2013 ***
Purpose:
Oracle has introduced three new features for the asmcmd command: To improve node recoverability when crash and repair Bad blocks; to copy files; To list asm disks in the asm disk group
Asmcmd can also be used for backup and restore of asm disk metadata.
This provides a method to create a disk group that uses the same disk path, disk name, fault group, attribute, template, and alias directory structure as an existing disk group.
Range:
New features introduced in asmcmd.
Details:
First: ASMCMD cp command
The asmcmd cp command allows you to copy files between the file system and the asm disk group. cp can also be used to copy files between two asm disk groups.
-ASM Diskgroup to OS file system
-OS file system to ASM Diskgroup
-ASM Diskgroup to another diskgroup
ASM Diskgroup to OS File system
ASMCMD> cp + DGEXT/orcl/datafile/tbsext.256.628847401/home/oracle/tbsext. dbf
Source + DGEXT/orcl/datafile/tbsext.256.628847401
Target/home/oracle/tbsext. dbf
Copying file (s )...
File,/home/oracle/tbsext. dbf, copy committed.
OS File system to ASM Diskgroup
ASMCMD> cp/home/oracle/tbsext. dbf + DGEXTBK/prod/datafile/tbsext. dbf
Source/home/oracle/tbsext. dbf
Target + DGEXTBK/prod/datafile/tbsext. dbf
Copying file (s )...
File, + DGEXTBK/prod/datafile/tbsext. dbf, copy committed.
ASM Diskgroup to another diskgroup
SQL> create diskgroup dgext external redundancy disk '/dev/raw/raw1','/dev
/Raw/raw2 ';
Diskgroup created.
SQL> create diskgroup DGEXTBK external redundancy disk '/dev/raw/raw3','/dev/raw/raw4 ';
Diskgroup created.
ASMCMD> cd DGEXTBK
ASMCMD> mkdir prod
ASMCMD> cd prod
ASMCMD> mkdir datafile
ASMCMD> cd datafile
ASMCMD> pwd
+ DGEXTBK/prod/datafile
SQL> create tablespace TBSEXT datafile '+ DGEXT' size 10 m;
Tablespace created.
SQL> select name from v $ datafile;
NAME
-------------------------------------------------------------
+ DGEXT/orcl/datafile/tbsext.256.628847401
Cp + DGEXT/orcl/datafile/tbsext.256.628847401 + DGEXTBK/prod/datafile/tbsext
ASMCMD> cp + DGEXT/orcl/datafile/tbsext.256.628847401 + DGEXTBK/prod/datafile/tbsext
Source + DGEXT/orcl/datafile/tbsext.256.628847401
Target + DGEXTBK/prod/datafile/tbsext
Copying file (s)... file, + DGEXTBK/prod/datafile/tbsext, copy committed.
The tbsext is alias name created in the folder + DGEXTBK/prod/datafile.
Refer Note 452158.1 ASMCMD cp command fails with ORA-15046
Second: ASMCMD md_backup and md_restore
Used to back up and restore the metadata of the asm disk group. This provides the ability to recreate an existing asm disk group with the same disk path, disk name, fault group, and attribute, disk groups in the template and alias directory structure
In oracle10g, if the disk group is lost, the only possible reason is to use rman to restore all files. Before that, you need to manually recreate the asm disk group and related directories and templates.
In oracle11g, we can back up the metadata of the asm disk group.
The md_backup command creates a backup file that contains one or more disk group metadata.
By default, all mounted disk groups are included in the backup file, which is placed in the current working directory.
If the backup file name is not specified, asm will name the file AMBR_BACKUP_INTERMEDIATE_FILE.
---> The following command backs up metadata of the dgext disk group:
ASMCMD> md_backup-B dgbk-g dgext
Disk group to be backed up: DGEXT
In restore Mode, oracle reads the previously generated file to reconstruct the disk group and metadata.
There are different restore modes: full, nodg, newdg
When the full mode restore disk is backed up to it
ASMCMD> md_restore-B dgbk-t full-g dgext
Current Diskgroup being restored: DGEXT
ASMCMD-09352: create diskgroup failed
ORA-15018: diskgroup cannot be created
ORA-15030: diskgroup name "DGEXT" is in use by another diskgroup (dbd error: OCIStmtExecute) ---> you can see that the used disk group cannot be restore
SQL> drop diskgroup dgext;
Diskgroup dropped.
ASMCMD> md_restore-B dgbk-t full-g dgext
Current Diskgroup being restored: DGEXT
Diskgroup DGEXT created!
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template completed uardconfig modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
SQL> select group_number, name, type from v $ asm_diskgroup;
GROUP_NUMBER NAME TYPE
--------------------------------------
1 DGEXT EXTERN
The attributes, templates, and aliases in the nodg mode restore backup file are structured into an existing disk group.
ASMCMD> md_restore-B dgbk-t nodg-g dgext
Current Diskgroup being restored: DGEXT
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template completed uardconfig modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
Newdg mode allows you to overwrite the disk name, disk, and fault group settings. However, attributes, templates, and alias directory structures are retained.
ASMCMD> md_restore-B dgbk-t newdg-o 'dgext: DG'
Current Diskgroup being restored: DGEXT
Current Diskgroup name replace by: DG
Diskgroup DG created!
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template completed uardconfig modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
SQL> select group_number, name, type from v $ asm_diskgroup
GROUP_NUMBER NAME TYPE
--------------------------------------
1 DG EXTERN