[Translated from mos] asmcmd command is used to copy the asm file between the local and remote asm instances. asmcmdasm
Use the asmcmd command to copy the asm file between the local and remote asm instances.
Reference Original:
How to Copy asm files between remote ASM instances using ASMCMD command (docid 785580.1)
Applicable:
Oracle Database-Enterprise Edition-Version 11.1.0.6 to 11.2.0.2 [Release 11.1 to 11.2]
Information in this document applies to any platform.
* ** Checked for relevance on 14-Jan-2011 ***
* ** Checked for relevance on 09-Jul-2014 ***
Objectives:
The purpose of this document is to use the asmcmd command to copy the asm file between a local instance and a remote instance.
Solution:
11g has new features-you can copy the asm file between the local and remote instances.
It can also be used to copy files from the asm disk group to the OS
Cp-ifr <source file name> <user_name >@< host_name>. <Port Number>. <SID >:< targer path>/<target file name>
User_name @ host_name. <Port Number>. <SID>
The user_name, host_name, and SID are required. The default port number is 1521.
---> Note: The sid here is the sid of the asm instance, not the sid of the database instance.
Example:
Asmcmd> cp-ifr + DATA/RAC/PARAMETERFILE/spfile.257.678975489 sys@stgrac1.1521. + ASM2: + FRA/RAC/ARCHIVELOG/spfile
Some explanations of ASMCMD remote copy:
To run asmcmd remote copy, you need to establish a connection through the listener.
Asmcmd remote connection may fail due to some errors.
ASMCMD-08202: internal error: [asmcmd1__error_msg_05] [8201]
[2, 8201] means unable to connect remote ASM Instance.
The possible causes of this error are as follows:
* Not able to reach remote host. The remote host cannot be connected.
* Remote host listener is down. Remote listener is down
* Remote ASM Instance is not registered with listener and running non-default port. The Remote asm Instance is not registered in the listener and the listener runs on a non-default port.
* Sysasm remote connection does not work. sysasm remote connection does not work
* Incorrect password given for sys user. sys Incorrect password
* Remote ASM Instance password file missing. The password file of the Remote asm Instance is lost.
We need to enable additional tracing to obtain the exact information about asmcmd connection failure.
++ Set the DBI_TRACE environment variable for asmcmd perl tracing
Export DBI_TRACE = 1
++ Now use asmcmd to connect and reproduce the problem:
Example 1:
---> Start with the example
Asmcmd> cp + data/spfileorcl. ora.289.686235413 sys@stgrac1.1521. + ASM1: + test
-> DBI-> connect (dbi: Oracle: host = stgrac1; port = 1521; sid = + ASM1, sys, ***, HASH (0x8b2b044 ))
Connect using '(DESCRIPTION = (ADDRESS = (HOST = stgrac1) (PROTOCOL = tcp) (PORT = 1521) (CONNECT_DATA = (SID = + ASM1 )))'
ERROR: '000000' ORA-1031: insufficient privileges
(Dbd error: OCISessionBegin )'
<-DESTROY = undef at DBI. pm line 591
DBI connect ('host = stgrac1; port = 1521; sid = + ASM1 ', 'sys',...) failed: ORA-01031: insufficient privileges (dbd error: OCISessionBegin)
KK FROM HERE
ASMCMD-08202: internal error: [asmcmd1__error_msg_05] [8201]
---> The example ends.
We can see that asmcmd failed to copy the file due to a ORA-01031 error.
If the-a option is not used, asmcmd uses the sysasm permission by default.
In the remote asm instance, sysasm permissions are not granted to sys user.
Grant sysasm permissions to sys users. When you authorize the system, the password file will be updated.
SQL> grant sysasm to sys;
Grant succeeded.
SQL> select * from v $ pwfile_users;
USERNAME SYSDB SYSOP SYSAS
---------------------------------------------
SYS TRUE
Now, the remote asm copy function works properly.
For more details, refer to the following article:
Note.730067.1-Troubleshooting Co., ORA-1031. Insufficient Privilege
Note.578796.1-ORA-01031 While Connecting as SYSASM
Example 2:
ASMCMD> cp-ifr thread_2_seq_5.264.678983423 sys@bderac2-vip.1521. + ASM2: + FRA/RAC/ARCHIVELOG/
Enter password :***
ASMCMD-08016: copy source-> '+ FRA/RAC/ARCHIVELOG/2009_02_16/thread_2_seq_5.264.678983423' and target-> '+ FRA/RAC/ARCHIVELOG/failed' failed
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-06512: at "SYS. X $ DBMS_DISKGROUP", line 258
ORA-06512: at line 3 (dbd error: OCIStmtExecute)
ASMCMD>
The cp command fails because:
The target asm file name is not specified, or the file name should not include file number/incarnation.
---> Note: I have some questions about the translation of this sentence,
Original article: The cp command failed because the target ASM file name was not specified or File name shocould not contain the file number/incarnation
If no file name is specified, you cannot copy an omf file.
Cp-ifr thread_2_seq_5.264.678983423 sys@bderac2-vip.1521. + ASM2: + FRA/RAC/ARCHIVELOG/thread_2_seq_5
The file number/incarnation will be automatically created during The copy process.
Role of the ASM command in linux
Oracle 10R2 releases the asmcmd tool to manage files stored in asm.
1. To use the asmcmd command, you must first start the asm instance. Otherwise, the following error occurs: rac2-> asmcmd-p
A ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory (dbd error: OCISessionBegin) 2. when using asmcmd, you must specify ORACLE_HOME and ORACLE_SID. Note that ORACLE_SID is the sid of asm. Otherwise, the following error occurs: rac2-> asmcmd-p.
A ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory (dbd error: OCISessionBegin) 3. The asmcmd command has the following functions:
With p, asmcmd will display the current path: rac2-> asmcmd-p
ASMCMD [+]> ls
DG1/
RECOVERDEST/
ASMCMD [+]> cd DG1
ASMCMD [+ DG1]> ls
DEVDB/
ASMCMD [+ DG1]> cd DEVDB
ASMCMD [+ DG1/DEVDB]> without p, the current path is not displayed: rac2-> asmcmd
ASMCMD> ls
DG1/
RECOVERDEST/
ASMCMD> cd DG1
ASMCMD> ls
DEVDB/
ASMCMD> cd DEVDB
ASMCMD> 4. For other related parameters, use help to view ASMCMD [+]> help
Asmcmd [-p] [command]
The environment variables ORACLE_HOME and ORACLE_SID determine
Instance to which the program connects, and ASMCMD establishes
Bequeath connection to it, in the same manner as a SQLPLUS/
SYSDBA. The user must be a member of the SYSDBA group.
Specifying the-p option allows the current directory to be displayed
In the command prompt, like so:
ASMCMD [+ DATAFILE/ORCL/CONTROLFILE]>
[Command] specifies one of the following commands, along with its
Parameters.
Type "h... the remaining full text>
How can I run the asm Program directly using the cmd command without the masm software ??
.Asmis the source code and is a pure file. You need to use masm.exeto compile the file into an intermediate file, and then use link.exe to link the intermediate file to the target file (*. exe) for running.