本帖最后由 郑全 于 2020-2-27 14:52 编辑
如果遇到问题,比如:
ASMCMD> cp +data/orcl/PARAMETERFILE/spfile.267.1032447817 \'sys/oracle_4U@192.168.133.120.1521.+ASM as sysasm\':+FRA/orcl/ARCHIVELOG/spfile
ASMCMD-8201: (Bad argc for RDBMS:ASMCMD-8201)
可以开跟踪,具体是再执行ASMCMD前设置环境变量:
export DBI_TRACE=1
再去执行
[grid@dbserver ~]$ asmcmd cp +data/orcl/PARAMETERFILE/spfile.267.1032447817 sys/oracle_4U@192.168.133.120.1521.+ASM:+FRA/orcl/ARCHIVELOG/spfile
DBI 1.616-ithread default trace level set to 0x0/1 (pid 35035 pi b10010) at DBI.pm line 278 via asmcmdshare.pm line 320
-> DBI->connect(dbi:Oracle:, , ****, HASH(0x178b6a0))
-> DBI->install_driver(Oracle) for linux perl=5.014001 pid=35035 ruid=1001 euid=1001
install_driver: DBD::Oracle version 1.28 loaded from /u01/app/12.1.0/grid/perl/lib/site_perl/5.14.1/x86_64-linux-thread-multi/DBD/Oracle.pm
<- STORE('ShowErrorStatement', 1)= ( 1 ) [1 items] at Oracle.pm line 70
<- install_driver= DBI::dr=HASH(0x216f2c0)
<- default_user(undef, undef, ...)= ( undef undef ) [2 items] at DBI.pm line 653
<- DESTROY(DBI::st=HASH(0x218b788))= ( undef ) [1 items] at Oracle.pm line 285
<- connect('', undef, ...)= ( DBI::db=HASH(0x218b7b8) ) [1 items] at DBI.pm line 665
<- STORE('PrintError', 0)= ( 1 ) [1 items] at DBI.pm line 717
<- STORE('AutoCommit', 1)= ( 1 ) [1 items] at DBI.pm line 717
<- STORE('Username', undef)= ( 1 ) [1 items] at DBI.pm line 720
$h->{'ora_session_mode'}=32768 ignored for invalid driver-specific attribute
<- STORE('ora_session_mode', 32768)= ( '' ) [1 items] at DBI.pm line 720
<- connected('dbi:Oracle:', undef, ...)= ( undef ) [1 items] at DBI.pm line 727
<- connect= DBI::db=HASH(0x218b7b8)
<- STORE('dbi_connect_closure', CODE(0x2190c98))= ( 1 ) [1 items] at DBI.pm line 736
<- prepare('/* ASMCMD */ select instance_name from v$instance')= ( DBI::st=HASH(0x218b698) ) [1 items] at asmcmdshare.pm line 3253
<- execute= ( '0E0' ) [1 items] at asmcmdshare.pm line 3454
<- fetchrow_hashref= ( HASH(0x218b1e8)1keys ) [1 items] row1 at asmcmdshare.pm line 3279
<- finish= ( 1 ) [1 items] at asmcmdshare.pm line 3300
<- DESTROY(DBI::st=HASH(0x218b7a0))= ( undef ) [1 items] at asmcmdbase.pm line 5184
<- prepare('/* ASMCMD */ select version from v$instance')= ( DBI::st=HASH(0x1f9dc38) ) [1 items] at asmcmdshare.pm line 3253
<- execute= ( '0E0' ) [1 items] at asmcmdshare.pm line 3454
<- fetchrow_hashref= ( HASH(0x218b1b8)1keys ) [1 items] row1 at asmcmdshare.pm line 3279
<- finish= ( 1 ) [1 items] at asmcmdshare.pm line 3300
<- DESTROY(DBI::st=HASH(0x216fdb8))= ( undef ) [1 items] at asmcmdcore line 1242
-> DBI->connect(dbi:Oracle:host=192.168.133.120.1521;port=1521;sid=+ASM, sys, ****, HASH(0x216fe00))
connect using '(DESCRIPTION=(ADDRESS=(HOST=192.168.133.120.1521)(PROTOCOL=tcp)(PORT=1521))(CONNECT_DATA=(SID=+ASM)))' !! ERROR: 24327 'ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin)' (err#0)
<- connect('host=192.168.133.120.1521;port=1521;sid=+ASM', 'sys', ...)= ( undef ) [1 items] at DBI.pm line 665
<- $DBI::errstr= 'ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin)'
DBI connect('host=192.168.133.120.1521;port=1521;sid=+ASM','sys',...) failed: ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin)
<- $DBI::errstr= 'ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin)'
ASMCMD-8201: (Bad argc for RDBMS:ASMCMD-8201)
<- DESTROY(DBI::db=HASH(0x218b8a8))= ( undef ) [1 items] at asmcmdcore line 1325
!! ERROR: 24327 CLEARED by call to disconnect_all method
<- disconnect_all= ( ) [0 items] (not implemented) at DBI.pm line 744
! <- DESTROY(DBI::dr=HASH(0x216f890))= ( undef ) [1 items] during global destruction
[grid@dbserver ~]$
可以看到它把1521当成host的一部分了,肯定有问题,找到问题后,端口默认是1521,可以不用,或者加一个--port参数,就可以了
[grid@dbserver ~]$ asmcmd cp --port 1521 +data/orcl/PARAMETERFILE/spfile.267.1032447817 sys/oracle_4U@192.168.133.120.+ASM:+FRA/orcl/ARCHIVELOG/spfile
copying +data/orcl/PARAMETERFILE/spfile.267.1032447817 -> 192.168.133.120:+FRA/orcl/ARCHIVELOG/spfile
|