dataguard碰到的错误 identifier DBMS_RCVCAT.GETDBID must be declared 、 Heartbeat failed to connect to

RDBMS 11.2.0.4

使用r-man 创建dg的过程,是没有问题的。

[oracle@dbtrain admin]$ rman target sys/oracle@testogg auxiliary sys/oracle@testogg_stdby nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jun 19 09:35:04 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TESTOGG (DBID=3759844478)
using target database control file instead of recovery catalog
connected to auxiliary database: TESTOGG (not mounted)

RMAN> duplicate target database for standby from active database dorecover nofilenamecheck;

Starting Duplicate Db at 19-JUN-20
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=9 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   passwordfile auxiliary format  '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtestogg_stdby'   ;
}
executing Memory Script

Starting backup at 19-JUN-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=151 device type=DISK
Finished backup at 19-JUN-20

contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/u01/app/oracle/oradata/testogg_stdby/control01.ctl';
   restore clone primary controlfile to  '/u01/app/oracle/fast_recovery_area/testogg_stdby/control02.ctl' from 
 '/u01/app/oracle/oradata/testogg_stdby/control01.ctl';
}
executing Memory Script

Starting backup at 19-JUN-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_testogg.f tag=TAG20200619T075502 RECID=4 STAMP=1043481303
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 19-JUN-20

Starting restore at 19-JUN-20
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 19-JUN-20

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to 
 "/u01/app/oracle/oradata/testogg_stdby/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to 
 "/u01/app/oracle/oradata/testogg_stdby/system01.dbf";
   set newname for datafile  2 to 
 "/u01/app/oracle/oradata/testogg_stdby/sysaux01.dbf";
   set newname for datafile  3 to 
 "/u01/app/oracle/oradata/testogg_stdby/undotbs01.dbf";
   set newname for datafile  4 to 
 "/u01/app/oracle/oradata/testogg_stdby/users01.dbf";
   set newname for datafile  5 to 
 "/u01/app/oracle/oradata/testogg_stdby/example01.dbf";
   set newname for datafile  6 to 
 "/u01/app/oracle/oradata/testogg_stdby/ggs_tbs01.dbf";
   set newname for datafile  7 to 
 "/u01/app/oracle/oradata/testogg_stdby/bb_tbs01.dbf";
   set newname for datafile  8 to 
 "/u01/app/oracle/oradata/testogg_stdby/test_tbs01.dbf";
   set newname for datafile  9 to 
 "/u01/app/oracle/oradata/testogg_stdby/xtts01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/system01.dbf"   datafile 
 2 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/sysaux01.dbf"   datafile 
 3 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/undotbs01.dbf"   datafile 
 4 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/users01.dbf"   datafile 
 5 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/example01.dbf"   datafile 
 6 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/ggs_tbs01.dbf"   datafile 
 7 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/bb_tbs01.dbf"   datafile 
 8 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/test_tbs01.dbf"   datafile 
 9 auxiliary format 
 "/u01/app/oracle/oradata/testogg_stdby/xtts01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/testogg_stdby/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 19-JUN-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/testogg/undotbs01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/undotbs01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/testogg/system01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/system01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/testogg/sysaux01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/sysaux01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/testogg/example01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/example01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/app/oracle/oradata/testogg/ggs_tbs01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/ggs_tbs01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00009 name=/u01/app/oracle/oradata/testogg/xtts01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/xtts01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00008 name=/u01/app/oracle/oradata/testogg/test_tbs01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/test_tbs01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/testogg/users01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/users01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=/u01/app/oracle/oradata/testogg/bb_tbs01.dbf
output file name=/u01/app/oracle/oradata/testogg_stdby/bb_tbs01.dbf tag=TAG20200619T075510
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 19-JUN-20

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/archive_log/1_91_1037791425.dbf" auxiliary format 
 "/archive_log/1_91_1037791425.dbf"   ;
   catalog clone archivelog  "/archive_log/1_91_1037791425.dbf";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 19-JUN-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=91 RECID=83 STAMP=1043481374
output file name=/archive_log/1_91_1037791425.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 19-JUN-20

cataloged archived log
archived log file name=/archive_log/1_91_1037791425.dbf RECID=1 STAMP=1043487408

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=8 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=9 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/ggs_tbs01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=10 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/bb_tbs01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=11 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/test_tbs01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=12 STAMP=1043487409 file name=/u01/app/oracle/oradata/testogg_stdby/xtts01.dbf

contents of Memory Script:
{
   set until scn  1591878;
   recover
   standby
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 19-JUN-20
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 91 is already on disk as file /archive_log/1_91_1037791425.dbf
archived log file name=/archive_log/1_91_1037791425.dbf thread=1 sequence=91
media recovery complete, elapsed time: 00:00:00
Finished recover at 19-JUN-20
Finished Duplicate Db at 19-JUN-20

RMAN> exit'


Recovery Manager complete.

问题1 ,在使用r-man创建dg的时候,报错 PLS-00201: identifier 'DBMS_RCVCAT.GETDBID' must be declared

Finished backup at 19-JUN-20

Starting restore at 19-JUN-20
using channel ORA_AUX_DISK_1


DBGSQL:     TARGET> begin :fhdbi := dbms_rcvcat.getDbid; end;
DBGSQL:        sqlcode = 6550
DBGSQL:         B :fhdbi = 32767
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/19/2020 09:27:51
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-06550: line 1, column 17:
PLS-00201: identifier 'DBMS_RCVCAT.GETDBID' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

解决方法: r-man命令后面加上nocatalog

问题2 ,dg创建完毕后,主备库不同步。

-- 主库alert ,出现连接到备库heartbeat错误,错误号16057

ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 52428800;
ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 52428800;
Fri Jun 19 07:47:43 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:48:43 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:49:43 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:50:43 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:51:43 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:52:44 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:53:44 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:54:44 2020
PING[ARC2]: Heartbeat failed to connect to standby 'testogg_stdby'. Error is 16057.
Fri Jun 19 07:55:03 2020
Clearing standby activation ID 3759832446 (0xe01a7d7e)
The primary database controlfile was created using the
'MAXLOGFILES 16' clause.
There is space for up to 13 standby redo logfiles
Use the following SQL commands on the standby database to create
standby redo logfiles that match the primary database:

Archived Log entry 84 added for thread 1 sequence 92 ID 0xe01a7d7e dest 1:
Fri Jun 19 08:03:04 2020
FAL[server, ARC3]: Error 16057 creating remote archivelog file 'testogg_stdby'
FAL[server, ARC3]: FAL archive failed, see trace file.
ARCH: FAL archive failed. Archiver continuing
ORACLE Instance testogg - Archival Error. Archiver continuing.

-- 备库alert ,提示DB_UNIQUE_NAME tesgogg错误。

Fri Jun 19 09:39:42 2020
alter database recover managed standby database using current logfile disconnect from session
Attempt to start background Managed Standby Recovery process (testogg_stdby)
Fri Jun 19 09:39:42 2020
MRP0 started with pid=27, OS id=2178
MRP0: Background Managed Standby Recovery process started (testogg_stdby)
 started logmerger process
Fri Jun 19 09:39:47 2020
Managed Standby Recovery starting Real Time Apply
Parallel Media Recovery started with 2 slaves
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 92
Completed: alter database recover managed standby database using current logfile disconnect from session
Fri Jun 19 09:58:42 2020
USER: DB_UNIQUE_NAME tesgogg is not in the Data Guard configuration

-- 主库上查看错误 ,提示ORA-16057 错误。

SYS@testogg>select dest_id,error from v$archive_dest;

   DEST_ID ERROR
---------- -----------------------------------------------------------------
	 1
	 2 ORA-16057: server not in Data Guard configuration
	 3
	 4
	 5
	 6
	 7

--查看 16057错误

[oracle@oggtest ~]$ oerr ora 16057
16057, 00000, "server not in Data Guard configuration"
// *Cause:  The primary database or fetch archive log (FAL) server was not
//          found in the Data Guard configuration of the standby database.
// *Action: Add the database unique name of the primary database or FAL server
//          to the DG_CONFIG attribute of the LOG_ARCHIVE_CONFIG database
//          initialization parameter.
[oracle@oggtest ~]$

-- 检查log_archvie_config配置 ,发现配置错误。应该是testogg,不是tesgogg。 低级错误

SYS@testogg>show parameter log_archive_config

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_config		     string	 DG_CONFIG=(testogg,testogg_std
						 by)
SYS@testogg>




SYS@testogg_stdby>show parameter log_archive_config

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_config		     string	 DG_CONFIG=(testogg_stdby,tesgo
						 gg)
SYS@testogg_stdby>

-- 修改

SYS@testogg_stdby>alter system set log_archive_config='DG_CONFIG=(testogg_stdby,testogg)';

System altered.

SYS@testogg_stdby>show parameter log_archive_config

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_config		     string	 DG_CONFIG=(testogg_stdby,testo
						 gg)
SYS@testogg_stdby>

-- 备库日志,日志同步过来了

SYS@testogg_stdby>archive log list
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       /archive_log/
Oldest online log sequence     93
Next log sequence to archive   0
Current log sequence	       94
SYS@testogg_stdby>

-- 主库alert log

Thread 1 advanced to log sequence 94 (LGWR switch)
  Current log# 1 seq# 94 mem# 0: /u01/app/oracle/oradata/testogg/redo01.log
Fri Jun 19 08:18:47 2020
Archived Log entry 86 added for thread 1 sequence 93 ID 0xe01a7d7e dest 1:
Fri Jun 19 08:18:47 2020
ARC0: Standby redo logfile selected for thread 1 sequence 93 for destination LOG_ARCHIVE_DEST_2
Fri Jun 19 08:18:47 2020
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
LNS: Standby redo logfile selected for thread 1 sequence 94 for destination LOG_ARCHIVE_DEST_2

-- 主库插入,备库立刻同步过来

SYS@testogg>insert into test_dg_t1 values(sysdate);

1 row created.

SYS@testogg>commit;

Commit complete.

SYS@testogg>select * from test_dg_t1;

X
-------------------
2020-06-19 08:02:28
2020-06-19 08:20:55

SYS@testogg>

SYS@testogg_stdby>select * from test_dg_t1;

X
-------------------
2020-06-19 08:02:28

SYS@testogg_stdby>/

X
-------------------
2020-06-19 08:02:28
2020-06-19 08:20:55

SYS@testogg_stdby>

END

附: MOS文档

Primary Remote log shipping failing with ORA-16057 - Server not in Data Guard configuration (Doc ID 1570928.1)

你可能感兴趣的:(Data,Guard)