New asmcmd Commands in Oracle 11g
Oracle introduced three new features into the ASMCMD utility to improve node recovery after a crash, to help repair bad blocks on a disk, copy files and to simplify the listing of the ASM disks in a diskgroup.
ASMCMD cp Command
The ASMCMD cp option lets you copy files between ASM disk groups and the OS file systems and between two ASM servers.
The following file copy is now available:
1. ASM Diskgroup to OS filesystem
2. OS filesystem to ASM Diskgroup
3. ASM Diskgroup to another diskgroup
ASM Diskgroup to OS Filesystem
ASMCMD> cp +psdisk1/ORCLSID/datafile/users.212.43245666 /opt/app/oracle/oradata/ORCLSID/users01.dbf
OS Filesystem to ASM Diskgroup
ASMCMD> cp /opt/app/oracle/oradata/ORCLSID/users01.dbf +psdisk1/ORCLSID/datafile/users01.dbf
ASM Diskgroup to Another Diskgroup
ASMCMD> create diskgroup psdisk2 external redundancy disk ‘/dev/oracleasm/ct3dl4′,’/dev/oracleasm/ct3dl5′;
ASMCMD> cd psdisk2
ASMCMD> mkdir prod
ASMCMD> cd prod
AMSMCD> mkdir datafile
AMSMCD> cd datafile
ASMCMD> pwd
SQL> create tablespace psdefault size 10M;
SQL> select name from v$datafile;
cp +psdisk1/ORCLSID/datafile/psdefault.212.34343434 +psdisk2/PROD/datafile/psdefault
ASMCMD> cp +psdisk/ORCLSID/datafile/psdefault.212.34343434 +psdisk2/prod/datafile/psdefault
The alias for psdefault is created in the folder +PSDISK2/PROD/datafile and the actual file is created in the +PSDISK2/PROD/datafile with a fully qualified ASM filename.
ASMCMD> cd +psdisk1/ORCLSID/DATAFILE
ASMCMD> ls -ltr
ASMCMD> cd +psdisk2/PROD/DATAFILE
ASMCMD> ls -ltr
ASMCMD md Backup and md Restore Commands
ASMCMD has been extended to include the ASM disk group metadata backup and restore functionality. This now provides us with the ability to recreate a pre-existing ASM disk group with the same disk paths, disk names, failure groups, attributes, templates, and alias directory structures.
In 10g if an ASM disk group was lost, the only possible way to restore the lost files was to use RMAN but you would have to manually recreate the ASM disk groups and all of the required user directories and templates.
In 11g you can take a backup of the ASM diskgroup metadata using the md_backup command which creates a backupfile containing the metadata for one or more of your diskgroups. The default is all mounted disk groups are included in the backup file which is saved in your current working directory. If the name of the backup file is not supplied then ASM names the file ASMBR_BACKUP_INTERMEDIATE_FILE.
ASMCMD> md_backup -b dgbackup -g psdisk1
Disk group to be backed up: PSDISK1
In restore mode, the previously generated file is read to reconstruct the diskgroup along with its metadata. You have the possibility to control the behaviour in restore mode by specifying a full, nodg, or newdg restore.
The full mode restores the diskgroup exactly as it was at the time of the last backup.
ASMCMD> md_restore -b dgbackup -t full -g psdisk1
Current Diskgroup being restored: PSDISK1
ASMCMD-09353: CREATE DISKGROUP failed
ORA-15018: diskgroup cannot be created
ORA-15030: diskgroup name “PSDISK1″ is in use by another diskgroup(DBD ERROR: OCIStmtExecute)
I didn’t wipe out or blow away my existing diskgroup but the above illustrates the ASM won’t restore and write over a valid diskgroup.
SQL> drop diskgroup psdisk1;
Diskgroup dropped.
ASMCMD> md_restore -b dgbackup -t full -g psdisk1
Current Diskgroup being restored: PSDISK1
….
SQL> select group_number, name, type from v$asm_diskgroup;
The nodg mode restores the attributes, templates and directory structure specified in the backup file to an existing disk group.
ASMCMD> md_restore -b dbbackup -t nodg -g psdisk1
Current Diskgroup being restored: PSDISK1
….
_
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.