0
点赞
收藏
分享

微信扫一扫

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

 

(1)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.

(2)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.

 

(3)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 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 
copying file(s)...file, +DGEXTBK/prod/datafile/tbsext, copy committed. 

The tbsext is alias name created in the folder +DGEXTBK/prod/datafile and actual file is created in the ASMTESTING folder

ASMCMD> ls -ltr 
Type Redund Striped Time Sys Name 
N tbsext => +DGEXTBK/ASMTESTING/DATAFILE/TESTING.256.628848885 

Also Refer Note 452158.1 ASMCMD cp command fails with ORA-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,

 

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

 

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)

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 DATAGUARDCONFIG 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 'nodg' mode restore the attributes,templates, and alias directory structure specified in the backup file to 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 DATAGUARDCONFIG 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!

 

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 -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 DATAGUARDCONFIG 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

 

 

 

 

From Oracle


举报

相关推荐

0 条评论