在搭建DG的过程中,之前都是使用备份集恢复数据库的。此次是使用在线恢复,使用duplicate恢复全库,发现报错如下
[oracle@stephenDG admin]$ rman target sys/oracle@stephen auxiliary sys/oracle@stephenDG
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Apr 8 19:36:21 2020
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: STEPHEN (DBID=2427627752)
connected to auxiliary database (not started)
RMAN> duplicate target database for standby nofilenamecheck from active database;
Starting Duplicate Db at 2020-04-08 19:36:50
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/08/2020 19:36:50
RMAN-06403: could not obtain a fully authorized session
RMAN-04006: error from auxiliary database: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
此时按照步骤备库是已经启动于 nomount的。
重点在于上面的connected to auxiliary database (not started) 说明数据库没有连接成功。
此错误的原因,是由于备库,没有配置好。我的备库配置有以下错误:
此处的SID_NAME 配置错误,我主备库的sid_name均为stephen,改正后lsnrctl stop&lsnrctl start
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = stephenDG)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.4/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = stephenDG)
(ORACLE_HOME =/u01/app/oracle/product/11.2.4/db_1)
(SID_NAME = stephenDG)
)
)
再使用rman登录上去以后,就不会出现not start,而是notmount,此时就可以使用在线恢复命令了
[oracle@stephenDG dbs]$ rman target sys/oracle@stephen auxiliary sys/oracle@stephenDG
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Apr 8 20:26:44 2020
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: STEPHEN (DBID=2427627752)
connected to auxiliary database: STEPHEN (not mounted)