重庆思庄Oracle、Redhat认证学习论坛
标题:
rac+单机dg,如何从主库ASM磁盘组拷贝归档日志到备库
[打印本页]
作者:
郑全
时间:
2018-1-4 22:00
标题:
rac+单机dg,如何从主库ASM磁盘组拷贝归档日志到备库
本帖最后由 郑全 于 2020-2-27 14:55 编辑
一个两节点的11g rac,加一个单机的dg备库,rac数据文件存储类型为asm,备库数据文件存储类型为文件系统,
现在由于各种原因,备库和主库不同步了,同时,备库的归档日志文件被定时任务删除了,主库响应的归档日志文件还在,
在这种情况下,如何把主库存在的归档日志拷贝到备库去 ?
作者:
郑全
时间:
2020-2-27 14:39
使用ASMCMD可以直接拷贝文件
asmcmd cp +data/orcl/PARAMETERFILE/spfile.267.1032447817 sys/oracle_4U@192.168.133.120.+ASM:/home/grid
...
copying +data/orcl/PARAMETERFILE/spfile.267.1032447817 -> 192.168.133.120:/home/grid/spfile.267.1032447817
作者:
郑全
时间:
2020-2-27 14:42
如果备库也是ASM,可以直接拷贝到备库的ASM磁盘组里面:
cp +data/orcl/PARAMETERFILE/spfile.267.1032447817 sys/oracle_4U@192.168.133.120.+ASM:+FRA/orcl/ARCHIVELOG/spfile
语法是:
cp --port 1521 +DATA/SID/spfileSID.test sys@<hostname>.+ASM1:+DATA/SID
这个1521端口可以忽略。
作者:
郑全
时间:
2020-2-27 14:47
本帖最后由 郑全 于 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
作者:
郑全
时间:
2020-2-27 14:54
具体参见:
How to Copy asm files between remote ASM instances using ASMCMD command (Doc ID 785580.1)
ASM Remote File Copy Fails with Error ASMCMD-8201 (Doc ID 1913948.1)
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/)
Powered by Discuz! X3.2