ASMCMD - New commands in 11gR1

We have introduced three new functionalities to the ASMCMD utility to improve node recovery after a crash,repair bad blocks on a disk, copy files and simplify the listing of ASM disks in a diskgroup

ASMCMD is also extended to include ASM disk group metadata backup and restore functionality.This provides the ability to create a pre-existing ASM diksgroup with the same disk paths, disk names,failure groups,attributes,templates and alias directory structure

ASMCMD - New commands in 11gR1

1. ASMCMD cp command

The ASMCMD cp option allows you to copy files between ASM disk groups and OS file systems and between two ASM servers.

The following file copy can be performed

- ASM Diskgroup to OS file system
- OS file system to ASM Diskgroup
- ASM Diskgroup to another diskgroup

1ASM 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.

2OS 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.

3ASM 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 10m;
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
copyingfile(s)...file,+DGEXTBK/prod/datafile/tbsext,copycommitted.

Thetbsextisaliasnamecreatedinthefolder+DGEXTBK/prod/datafileand actual file is created in the ASMTESTING folder

ASMCMD>ls-ltr
TypeRedundStripedTimeSysName
Ntbsext=>+DGEXTBK/ASMTESTING/DATAFILE/TESTING.256.628848885

Also Refer Note 452158.1 ASMCMDcpcommandfailswithORA-15046

2. ASMCMD md_backup and md_restore

ASMCMD is extended to include ASM disk group metadata backup and restore functionality.This provides the ability to recreate a pre-existing ASM disk group with the same disk paths,disk names, failure groups, attributes, templates and alias directory structure

In 10g if an ASM disk group is lost, then it is only possible to restore the lost files using RMAN but you have to manually recreate the ASM disk group and any required user directories/templates.

In 11g we can take backup of ASM diskgroup metadata.The md_backup command creates a backup file containing metadata for one or more disk groups. By default all the mounted disk groups are included in the backup file which is saved in the current working directory.
If the name of the backup file is not specified, ASM names the file AMBR_BACKUP_INTERMEDIATE_FILE.


ASMCMD> md_backup -b dgbk -g dgext
Disk group to be backed up: DGEXT

In restore mode, it reads the previously generated file to reconstruct the diskgroup and its metadata. You have the possibility to control the behaviour in restore mode to do a full,nodg or newdg restore.

The full mode restores the diskgroup exactly as it was at the time of backup

ASMCMD>md_restore-bdgbk-tfull-gdgext
CurrentDiskgroupbeingrestored:DGEXT
ASMCMD-09352:CREATEDISKGROUPfailed
ORA-15018:diskgroupcannotbecreated
ORA-15030:diskgroupname"DGEXT"isinusebyanotherdiskgroup(DBDERROR:OCIStmtExecute)

SQL>dropdiskgroupdgext;
Diskgroupdropped.

ASMCMD>md_restore-bdgbk-tfull-gdgext
CurrentDiskgroupbeingrestored:DGEXT
DiskgroupDGEXTcreated!
SystemtemplateXTRANSPORTmodified!
SystemtemplateONLINELOGmodified!
SystemtemplateDATAGUARDCONFIGmodified!
SystemtemplateAUTOBACKUPmodified!
SystemtemplateTEMPFILEmodified!
SystemtemplateARCHIVELOGmodified!
SystemtemplateASM_STALEmodified!
SystemtemplateBACKUPSETmodified!
SystemtemplateDUMPSETmodified!
SystemtemplateFLASHBACKmodified!
SystemtemplatePARAMETERFILEmodified!
SystemtemplateCONTROLFILEmodified!
SystemtemplateDATAFILEmodified!
SystemtemplateCHANGETRACKINGmodified!

SQL>selectgroup_number,name,typefromv$asm_diskgroup;

GROUP_NUMBERNAMETYPE
--------------------------------------
1DGEXTEXTERN

The 'nodg' mode restore the attributes,templates, and alias directory structure specified in the backup file to an existing disk group.

ASMCMD>md_restore-bdgbk-tnodg-gdgext
CurrentDiskgroupbeingrestored:DGEXT
SystemtemplateXTRANSPORTmodified!
SystemtemplateONLINELOGmodified!
SystemtemplateDATAGUARDCONFIGmodified!
SystemtemplateAUTOBACKUPmodified!
SystemtemplateTEMPFILEmodified!
SystemtemplateARCHIVELOGmodified!
SystemtemplateASM_STALEmodified!
SystemtemplateBACKUPSETmodified!
SystemtemplateDUMPSETmodified!
SystemtemplateFLASHBACKmodified!
SystemtemplatePARAMETERFILEmodified!
SystemtemplateCONTROLFILEmodified!
SystemtemplateDATAFILEmodified!
SystemtemplateCHANGETRACKINGmodified!

The 'newdg' mode allows the user to override the disk group name,disk, and failgroup specifications as part of a diskgroup creation,but retains the attribute,template and, alias directory structure from the backup

ASMCMD>md_restore-bdgbk-tnewdg-o'DGEXT:DG'
CurrentDiskgroupbeingrestored:DGEXT
CurrentDiskgroupnamereplaceby:DG
DiskgroupDGcreated!
SystemtemplateXTRANSPORTmodified!
SystemtemplateONLINELOGmodified!
SystemtemplateDATAGUARDCONFIGmodified!
SystemtemplateAUTOBACKUPmodified!
SystemtemplateTEMPFILEmodified!
SystemtemplateARCHIVELOGmodified!
SystemtemplateASM_STALEmodified!
SystemtemplateBACKUPSETmodified!
SystemtemplateDUMPSETmodified!
SystemtemplateFLASHBACKmodified!
SystemtemplatePARAMETERFILEmodified!
SystemtemplateCONTROLFILEmodified!
SystemtemplateDATAFILEmodified!
SystemtemplateCHANGETRACKINGmodified!

SQL>selectgroup_number,name,typefromv$asm_diskgroup

GROUP_NUMBERNAMETYPE
--------------------------------------
1DGEXTERN

From Oracle

-------------------------------------------------------------------------------------------------------

Blog http://blog.csdn.net/tianlesoftware

Email: [email protected]

DBA1 群:62697716(); DBA2 群:62697977() DBA3 群:62697850()

DBA 超级群:63306533(); DBA4 群: 83829929 DBA5群: 142216823

聊天 群:40132017 聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

你可能感兴趣的:(command)