Oracle Server - Enterprise Edition - Version: 11.1.0.6 to 11.2.0.2 - Release: 11.1 to 11.2
11g new feature,you can use asmcmd to copy files between remote instances, Enables you to copy files between ASM disk groups on local instances and remote instances. You can also use this command to copy files from ASM disk groups to the operating system.
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.
Example :-
asmcmd>cp -ifr +DATA/RAC/PARAMETERFILE/spfile.257.678975489 [email protected].+ASM2:+FRA/RAC/ARCHIVELOG/spfile
Troubleshooting-ASMCMD remote copy
asmcmd remote copy works through listener connection.
ASMCMD remote connection can fail with below genericerror.
ASMCMD-08202: internal error: [asmcmdshare_error_msg_05] [8201]
[8201] means unable to connect remote ASM Instance.
It could be due to following reason.
* not able to reach remote host.
* Remote host listener is down.
* Remote ASM Instance is not registered with listener and running non-default port.
* sysasm remote connection does not work.
* Incorrect password given for sys user.
* Remote ASM Instance password file missing.
We need to enable additional tracing for asmcmd connection to get a exact failure message.
++ set DBI_TRACE environment variable for asmcmd perl tracing.
export DBI_TRACE=1
++ Now connect using asmcmd and re-produce the issue.
Example 1:-
asmcmd>cp +data/spfileorcl.ora.289.686235413 [email protected].+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: '1031' 'ORA-01031: 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 A
ASMCMD-08202: internal error: [asmcmdshare_error_msg_05] [8201]
Here we can see that asmcmd copy failed due to ORA-01031.
ASMCMD uses SYSASM by default if -a option is not used.
Here the problemis sysasm privelegewas not given to sys user on remote ASM Instance. Given the SYSASM privilege to SYS ( or the user trying to connect ). When you grant a system privilege, the password file is updated.
SQL> grant sysasm to sys;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS TRUE TRUE TRUE
Now the remote asmcmd copy works fine
Example 2:-
ASMCMD> cp -ifr thread_2_seq_5.264.678983423 [email protected].+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/thread_2_seq_5.264.678983423' 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>
Solution:-
The cp command failed because the target ASM file name was not specified orFilename should not contain the file number/incarnation.We can not copy OMF form files without specifying file name
cp -ifr thread_2_seq_5.264.678983423 [email protected].+ASM2:+FRA/RAC/ARCHIVELOG/thread_2_seq_5
The file number/incarnation will be created automatically during the copy.
From Oracle
-------------------------------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
Email: [email protected]
DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群: 83829929 DBA5群: 142216823
聊天 群:40132017 聊天2群:69087192
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请