LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.235)(PORT = 1521)(IP = FIRST))) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = ora235) (GLOBAL_DBNAME = db_primary) (ORACLE_HOME =/u01/app/oracle) ) )
Standby库配置listener.ora
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.221)(PORT = 1521)(IP = FIRST))) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = ora235) (GLOBAL_DBNAME = db_standby) (ORACLE_HOME =/u01/app/oracle) ) )
Primary库和Standby库设置tnsname.ora
tns_primary= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.235)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = db_primary) ) (HS = OK) ) tns_standby= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.221)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = db_standby) ) (HS = OK) )
重启监听lsnrctl restart
六. 克隆Oracle在Standby库执行:DUPLICATE TARGET DATABASE TO ORA235 FROM ACTIVE DATABASE SPFILE NOFILENAMECHECK;
[oracle@oracle221 ~]$ rlwrap rman target sys/li0924@tns_primary auxiliary sys/li0924@tns_standby
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Aug 16 23:21:27 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA235 (DBID=2047494122)
connected to auxiliary database: ORA235 (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO ORA235 FROM ACTIVE DATABASE SPFILE NOFILENAMECHECK;
Starting Duplicate Db at 16-AUG-18
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/dbs/spfileora235.ora' auxiliary format
'/u01/app/oracle/dbs/spfileora235.ora' ;
sql clone "alter system set spfile= ''/u01/app/oracle/dbs/spfileora235.ora''";
}
executing Memory Script
Starting backup at 16-AUG-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device type=DISK
Finished backup at 16-AUG-18
sql statement: alter system set spfile= ''/u01/app/oracle/dbs/spfileora235.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORA235'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ORA235'' comment=
''duplicate'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''ORA235'' comment= ''duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ORA235'' comment= ''duplicate'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 780824576 bytes
Fixed Size 2257312 bytes
Variable Size 511708768 bytes
Database Buffers 264241152 bytes
Redo Buffers 2617344 bytes