We can use cp command of asmcmd in order to copy from one machine ASM to another machine ASM instance.
The syntax is,
cp -ifr <source file name> <user_name>@<host_name>.<port Number>.<sid>:<target 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.
For example to copy a file
named +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 from local ASM instance to
remote ASM instance named test
port 1525,
ASM instance name +ASM2
copy to location +data/spfilebakcup.bak
the command will be,
ASMCMD> cp +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 sys@test.1525.+ASM2:+data/spfilebakcup.bak Enter password: ****** ASMCMD>It will prompt you a password, provide grid sys user password. It is sysasm password, not OS password.
Lets see in remote machine to ensure that file is copied there.
Now let's see what happens if we miss anything in the command. Simply it will not copy and some bogus message it will be shown.
1) Wrong password.
ASMCMD> cp +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 sys@test.1525.+ASM2:+data/spfilebakcup.bak Enter password: ******** ORA-01017: invalid username/password; logon denied (DBD ERROR: OCISessionBegin) ASMCMD-08202: internal error: [asmcmdvol_error_msg_05] [8201]2) Listener not up.
ASMCMD> cp +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 sys@drs-db-01.1525.+ASM2:+data/spfilebakcup.bak Enter password: ******** ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach) ASMCMD-08202: internal error: [asmcmdvol_error_msg_05] [8201]3) Another variation.
ASMCMD> cp +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 sys@drs-db-01.1523.+ASM1:+data/g.baks Enter password: ***** ORA-12505: TNS:listener does not currently know of SID given in connect descript or (DBD ERROR: OCIServerAttach) ASMCMD-08202: internal error: [asmcmdvol_error_msg_05] [8201]4) If destination file already exist.
ASMCMD> cp +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 sys@test.1525.+ASM2:+data/spfilebakcup.bak Enter password: ****** ASMCMD-08014: can not open file->'' ASMCMD-08016: copy source->'+DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991' and target->'' failed ORA-15056: additional error message ORA-06512: at "SYS.X$DBMS_DISKGROUP", line 397 ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)5) Note that, IP address instead of hostname will not work.
ASMCMD> cp +DATA/BDDIPDC/PARAMETERFILE/spfile.639.737023991 sys@192.168.155.1.1525.+ASM2:+data/spfilebakcup.bak Enter password: ****** ORA-12532: TNS:invalid argument (DBD ERROR: OCIServerAttach) ASMCMD-08202: internal error: [asmcmdvol_error_msg_05] [8201]6) Don't use port 1521.
If you use 1521 port you might see your command is hanged. CISCO and juniper hardware can treat 1521 port specially and it block traffic. So use other port.
Ensure that listener started in remote machine, for example in my remote machine:
[oracle@DRS-DB-02 ~]$ lsnrctl status LISTENER_NEW LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-APR-2012 14:36:19 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_DIP))) STATUS of the LISTENER ------------------------ Alias LISTENER_NEW Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 29-MAR-2012 12:50:30 Uptime 4 days 1 hr. 45 min. 49 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/DRS-DB-02/listener_new/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_DIP))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.155.1)(PORT=1525))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM2", status UNKNOWN, has 1 handler(s) for this service... The command completed successfullyEnsure that in local asm we can resolve the name of remote hostname.
Here goes /etc/hosts entry,
[grid@DC-DB-02 ~]$ cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.155.1 testI will write another post how to troubleshoot remote copy using ASMCMD.
No comments:
Post a Comment