Oracle

重複執行過程中出現錯誤“RMAN-04006:來自輔助數據庫的錯誤”

  • November 1, 2020

我正在嘗試使用重複命令創建備用數據庫。

Primary : tntdb19
Standby : mntdb19

重複命令開始但在一段時間後失敗

[oracle@monta191 admin]$ rman target sys/manager@tntdb19  auxiliary sys/manager@mntdb19

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Nov 1 13:24:19 2020
Version 19.7.0.0.0

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

connected to target database: TNTDB19 (DBID=2747252158)
connected to auxiliary database: TNTDB19 (not mounted)

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

Starting Duplicate Db at 01-NOV-20
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=25 device type=DISK
...
contents of Memory Script:
{
  sql clone "create spfile from memory" ;
  shutdown clone immediate;
  startup clone nomount;
  restore clone from service  'tntdb19' standby controlfile;
}
executing Memory Script

sql statement: create spfile from memory

Oracle instance shut down

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/01/2020 13:27:12
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-04006: error from auxiliary database: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

正如您在開始時看到的那樣,rman 毫無問題地連接到主數據庫和新備用數據庫

connected to target database: TNTDB19 (DBID=2747252158)
connected to auxiliary database: TNTDB19 (not mounted)

但問題是我認為當

  shutdown clone immediate;

作為複製過程的一部分,因為聽者在這一刻失去了

Service "mntdb19" has 1 instance(s).
 Instance "mntdb19", status UNKNOWN, has 1 handler(s) for this service...
Service "mntdb19.vboxlab.es" has 1 instance(s).
 Instance "mntdb191", status BLOCKED, has 1 handler(s) for this service...

這是備用機器中的 listener.ora。

[grid@monta191 admin]$ cat listener.oa
cat: listener.oa: No such file or directory
[grid@monta191 admin]$ cat listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))        # line added by Agent
LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3))))        # line added by Agent
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2))))        # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))        # line added by Agent
ASMNET1LSNR_ASM=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=ASMNET1LSNR_ASM))))      # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_ASMNET1LSNR_ASM=ON       # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_ASMNET1LSNR_ASM=SUBNET     # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON        # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN1=OFF     # line added by Agent - Disabled by Agent because REMOTE_REGISTRATION_ADDRESS is set
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON        # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN2=OFF     # line added by Agent - Disabled by Agent because REMOTE_REGISTRATION_ADDRESS is set
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON        # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN3=OFF     # line added by Agent - Disabled by Agent because REMOTE_REGISTRATION_ADDRESS is set
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON      # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=SUBNET        # line added by Agent

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
     (GLOBAL_DBNAME = mntdb19)
     (ORACLE_HOME = /u01/app/grid/product/19c/grid_1)
     (SID_NAME = mntdb19)
   )
 )

我認為 SID_LIST_LISTENER 條目如果針對此問題,但它不起作用。

和 tnsnames.ora

[oracle@monta191 admin]$ cat tnsnames.ora 
TNTDB19 =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = tanto19-cluster-scan)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = tntdb19.vboxlab.es)
   )
 )

MNTDB19 =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = monta19-cluster-scan)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = mntdb19.vboxlab.es)(UR=A)
   )
 )

Balazs 發布後所做的更改

嗨 Balazs,我已經更改了 listener.ora 中的 GLOBAL_DBNAME 和 ORACLE_HOME 條目

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
     (GLOBAL_DBNAME = mntdb19.vboxlab.es)
     (ORACLE_HOME = /u02/app/oracle/product/19c/db_1)
     (SID_NAME = mntdb19)
   )
 )

我為使用者網格 (/u01/app/grid/product/19c/grid_1) 和 oracle 使用者 (/u02/app/oracle/product/19c/db_1) 提供了不同的首頁。在我原來的文章中,我使用了網格首頁,但現在我更改了數據庫首頁。

服務名稱是

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
service_names                string  mntdb19.vboxlab.es

有了這 2 個更改,關閉備用數據庫時重複的結果仍然是相同的

Oracle instance shut down

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/01/2020 18:55:30
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-04006: error from auxiliary database: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

我誤會了什麼?

問候

您的 tnsnames.ora 條目:

MNTDB19 =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = monta19-cluster-scan)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = mntdb19.vboxlab.es)(UR=A)
   )
 )

您的聽眾狀態:

Service "mntdb19" has 1 instance(s).
 Instance "mntdb19", status UNKNOWN, has 1 handler(s) for this service...
Service "mntdb19.vboxlab.es" has 1 instance(s).
 Instance "mntdb191", status BLOCKED, has 1 handler(s) for this service...

作為複製過程的一部分,RMAN 將關閉輔助數據庫實例,然後重新啟動它。為了啟動它,它必須能夠通過偵聽器登錄到已停止的數據庫實例。這就是您需要靜態偵聽器註冊的原因。

您的輔助實例處於 NOMOUNT 狀態。RMAN 使用 service name 登錄到輔助實例mntdb19.vboxlab.es。在 BLOCKED 狀態下通過動態註冊連接到 NOMOUNT 實例通常是不可能的,但可以UR=A克服tnsnames.ora這個限制。(如果沒有這種解決方法,您甚至無法遠端登錄 NOMOUNT 輔助實例。)接下來 RMAN 會關閉您的輔助實例,然後再次嘗試使用服務名稱mntdb19.vboxlab.es再次連接。在這一點上,我想這就是你的聽眾所擁有的:

Service "mntdb19" has 1 instance(s).
 Instance "mntdb19", status UNKNOWN, has 1 handler(s) for this service...

您有服務名稱的靜態條目mntdb19,僅此而已。不存在 的條目mntdb19.vboxlab.es。但是您在 RMAN 使用的 tnsnames.ora 中提供了該服務。

在 tnsnames.ora 中用作服務名稱,或者mntdb19修復 listener.ora 中的靜態註冊以使用正確的服務名稱:

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
     (GLOBAL_DBNAME = mntdb19.vboxlab.es)  # <-- added proper service name here
     (ORACLE_HOME = /u01/app/grid/product/19c/grid_1)
     (SID_NAME = mntdb19)
   )
 )

此外,我認為您的數據庫不是從 Grid Infrastructure ORACLE_HOME (/u01/app/grid/product/19c/grid_1) 執行的。上面的ORACLE_HOME應該是數據庫ORACLE_HOME。

引用自:https://dba.stackexchange.com/questions/279016