Released as an ASM feature in Oracle Database 10g Release 2, asmcmd is a command-line utility to access and manage files associated with the ASM diskgroups.The asmcmd utility has a myriad of enhancements in Oracle Database 11g.asmcmd provides backward compatibility with Oracle Database 10g ASM instances.
You can use the Oracle Database 11g asmcmd utility to manage your Oracle Database 10g ASM environments.Oracle will support copying of the asmcmd executable from the Oracle Database 11g software binary directory to an Oracle Database 10g Release 2 software binary directory.The asmcmd utility will allow various 11.1 functionality to be leveraged against a 10.x Oracle release.
There are numerous improvements and additional options to the existing commands to asmcmd.The key commands set that will be discussed are as follows:
The ls command now incorporates the-c and the-g options.The-c option displaysinformation from the V$ASM_DISKGROUP view or from the GV$ASM_DISKGROUP view if the-g flag is also provided.The-g option displays information from the GV$ASM_DISKGROUP_STAT or GV$ASM_DISKGROUP view if the -c flag is also provided.The-g flag queries the GV$ASM_DISKGROUP view and reports the instance ID(INST_ID)in the output.Here’s a sample output from the -gc option:
The lsdg command lists all disk groups and their attributes from V$ASM_DISKGROUP.The syntax for the lsdg command is as follows:
In Oracle Database 11g,two new options are provided—the -g and -c flags to the lsdgcommand. The -g flag queries the GV$ASM_ DISKGROUP view and reports the instance ID(INST_ID) in the output.If used with the -c flag, the GV$ASM_ DISKGROUP_ STAT view will be queried.
The lsct command lists all clients and their attributes from V$ASM_CLIENT:
In Oracle Database 11g, the -g option is provided. This option queries the GV$ASM_CLIENT view and includes INST_ID in the report.
The lsdsk command is new to Oracle Database 11g. This command lists ASM-visible disks. Valid options for lsdsk are as follows:
The pattern keyword restricts the output to only disks that match the pattern.Wildcard characters and slashes (/ or )can be part of the pattern. In connected mode,asmcmd uses the V$ and GV$ tables to retrieve disk information.
In nonconnected mode,asmcmd scans disk headers to retrieve disk information using an ASM disk string to restrict the discovery set. The connected mode is always attempted first.Table lists flags for lsdsk that are worth mentioning.
Let’s look at some examples of the lsdsk command with the new parameters.The –k option reports the total size and amount of free space information in megabytes at the disk level.It also provides failgroup, disk label,and redundancy information, as shown here:ASMCMD> lsdsk -k -d DATA
Another parameter worth mentioning is the -s option.The -s option provides information about disk performance metrics including read and write times.This option also reports errors encounteredat each disk level.You can use the -s option to gather performance characteristics of each disk.You can review the following read and write times and confirm IO distribution across all the disks in the diskgroup.ASMCMD [+] > lsdsk -s -d DATA
The-t option provides information about when the disks were created and mounted.It also provides the remaining duration for the disk repair time.You can leverage the -d option to specify just the DATA diskgroup in conjunction with the -t option to show creation and mount times, as displayed here:ASMCMD> lsdsk -t -d DATA
Anybody who has been supporting ASM on a day-to-day basis will admit that the copy command(cp)is the most anticipated ASM enhancement. Now, DBAs can copy ASM-supported files using the standard cp command from the asmcmd utility.The asmcmd cp command can be used to copy files in these situations:
In addition,the asmcmd cp command can be used to copy all ASM-supported files such as Data Pump dump files,spfiles,block change tracking files, controlfiles, Data Guard Broker configuration files,and so on. The cp command has the following options:cp [-ifr] <[@connect_identifier:]src> <[@connect_identifier:]tgt>
The three flags,-ifr,are similar to the flags from the Unix cp, rcp, and scp commands (interactive,force,and recursive copy).The interactive option prompts prior to a file overwrite. The force option will remove an existing file and perform a copy.
We’ll now show some examples of using the copy command to copy files in and out of ASM. Let’s start by copying a Data Pump dump file from the OS into the ASM DATA diskgroup:ASMCMD [+] > cp /home/oracle/encrypted.dmp +data
Only ASM-supported files are allowed to be copied into ASM.If you attempt to copy in a non-ASM file such as a text file,an error message will be generated.
Now let’s copy an Oracle datafile from one ASM instance to another ASM instance.In Oracle Database 11g,an active database is no longer required to transfer files between one ASM instance diskgroup to another.We will copy one of the docs_d1 datafiles from the ASM instance on rac103 to another ASM instance on rac1. A database named DBA11g1 is running on the remote database server.In this example, we will rename the datafile from +DATA/DBA11g/ DATAFILE/DOCS_D1.289.631914611 to xxx on the process:ASMCMD [+DATA/DBA11g/DATAFILE] > cp
The syntax for the remote ASM diskgroup copy is as follows:
The username can be any username in the ASM instance that has the sysasm privilege. Notice the dot(.) notation between the hostname and the ASM instance.The port assignment is optional if the LISTENER is not listening on port 1521.The last delimiter is a colon(:)followed by the fully qualified directory or file name. Note that the target ASM instance must be registered with the LISTENER for the remote copy between ASM diskgroups to work.
You can verify on the remote ASM instance that the copied file exists:ASMCMD> pwd
You will also notice that the xxx file is created as an alias, and the actual file resides in the +DATA/ASMTESTING/DATAFILE directory. Because we specified the fully qualified file name, OMF will create an alias.
Another important point to note is that the -f option does not work with aliases.In the following example, we attempt to overwrite an existing alias, which results in an ORA-15005 error:ASMCMD [+DATA/DBA11g/DATAFILE] > cp –f
Continuing with the cp examples, this is how to perform a datafile copy from one directory to another directory on the local ASM instance:ASMCMD>cp +data/DBA11g1/DATAFILE/ALERT_D1.267.631889077
The syntax to copy files between one local diskgroup to another local diskgroup is straight forward.You can copy files between one diskgroup to another diskgroup or even to the same diskgroup.You can also leverage the copy command to copy files from ASM to a local file system.
As the last example, we’ll copy the docs_d4 datafile to the /oradata/DBATOOLS/ directory on the file system:ASMCMD> cp +DATA/DBA11G1/DATAFILE/DOCS_D4.276.631890065
Oracle 11g Related Interview Questions
|Oracle 10g Interview Questions||Oracle 9i Interview Questions|
|Oracle 8i Interview Questions||Informatica Interview Questions|
|PL/SQL Interview Questions||Oracle 11g Interview Questions|
|SQL Interview Questions||Oracle apps Interview Questions|
|Sybase Interview Questions||Oracle Apps ERP Interview Questions|
|Oracle 7.3 Interview Questions||Oracle Access Manager Interview Questions|
|Oracle Application Framework Interview Questions||Oracle Apps DBA Interview Questions|
Oracle 11g Related Practice Tests
|Oracle 10g Practice Tests||Oracle 9i Practice Tests|
|Oracle 8i Practice Tests||Informatica Practice Tests|
|PL/SQL Practice Tests||Oracle 11g Practice Tests|
|SQL Practice Tests||Oracle apps Practice Tests|
|Sybase Practice Tests||Oracle Apps ERP Practice Tests|
|Oracle 7.3 Practice Tests|
Oracle 11g Tutorial
Installing, Upgrading, And Managing Change
Database Diagnosability And Failure Repair
Backup And Recovery
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.