Oracle ADG RAC TO Single

规划信息

保护模式:maximize availability

传输进程:LGWR SYNC AFFIRM

环境规划信息 Primary Node RAC Standby Node Single
主机名 11rac1,11rac2 oracle11-1
Hosts文件 11rac1
11rac2
11rac1-vip
11rac2-vip
11rac1-priv
11rac2-priv
rac-scan
oracle11-1
DB_NAME racdb racdb
INTANCE_NAME racdb1,racdb2 racdb
DB_UNIQUE_NAME racdb_primary racdb_standby2
操作系统版本 CentOS7.9.2009 CentOS7.9.2009
Oracle数据库版本 11.2.0.4 11.2.0.4
归档位置 快速恢复区 快速恢复区域
快速恢复区域 +fra /u01/app/oracle/flash_recovery_area/
StandbyRedoLog $ORACLE_BASE/oradata/orcl/standbyredolog
Service_name racdb_primary racdb_standby2
数据库软件 安装GI+数据库软件+创建监听+安装数据库 安装GI+数据库软件+创建监听(无需建库)

操作系统配置

系统hosts文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 原RAC
[root@11rac1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# Public
10.10.10.171 11rac1
10.10.10.172 11rac2
# Private
172.16.1.171 11rac1-priv
172.16.1.172 11rac2-priv
# Virtual
10.10.10.173 11rac1-vip
10.10.10.174 11rac2-vip
# SCAN
10.10.10.175 rac-scan
10.10.10.176 rac-scan
10.10.10.177 rac-scan
[root@11rac1 ~]#


# 目标备库2
[root@oracle11-1 ~]# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.10.10.3 oracle11-1

安装数据库

  1. 主库RAC已经存在

  2. 备库安装数据库软件和创建监听即可,这里备库使用docker容器,然后使用以下方式删除现有数据库:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    [oracle@oracle11-1 ~]$ dbca -silent -deleteDatabase -sourceDB orcl -sysDBAUserName sys -sysDBAPassword oracle
    Connecting to database
    4% complete
    9% complete
    14% complete
    19% complete
    23% complete
    28% complete
    47% complete
    Updating network configuration files
    48% complete
    52% complete
    Deleting instance and datafiles
    76% complete
    100% complete
    Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl.log" for further details.
    [oracle@oracle11-1 ~]$

确认主库信息

参见主RAC信息收集

配置主库参数

配置RAC主库基础上进行如下修改:

修改主库以下dg参数:

1
2
3
4
5
6
7
8
9
10
11
-- dg参数
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(racdb_primary,racdb_standby1,racdb_standby2)' SCOPE=BOTH SID='*';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_3='SERVICE=racdb_standby2 LGWR SYNC REOPEN=15 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=racdb_standby2' SCOPE=BOTH SID='*';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_3=enable SCOPE=BOTH SID='*';
-- 以上参数无需重启

-- Add below item when DB turn to standby role
-- 因主库使用ASM,此备库为单机,因此如果需要主RAC和此备库进行互切,则配置转换参数,否则主库无需配置,此参数需要重启生效
-- alter system set db_file_name_convert='+DATA/primary','+DATA/standby' scope=spfile;
-- alter system set log_file_name_convert='+DATA/primary','+DATA/primary' scope=spfile;
ALTER SYSTEM SET FAL_SERVER='racdb_standby1,racdb_standby2' SCOPE=BOTH SID='*';

修改主库TNSNAME:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 主库所有节点
[oracle@11rac1 ~]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)

racdb_primary =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.175)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_primary)
)
)

racdb_standby1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.185)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_standby1)
)
)

racdb_standby2 = # 本次备库单节点新增
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_standby2)
)
)

tar =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.173)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_primary)
)
)

aux =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.183)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_standby1)
)
)

racdb_primary_DGMGRL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.175)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_primary)
)
)

orcl_standby1_DGMGRL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.185)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_standby1)
)
)
[oracle@11rac1 ~]$

创建备库必要目录

1
2
3
4
5
# racdb替换为自己备库的实例名称
mkdir -p /u01/app/oracle/admin/racdb/adump
mkdir -p /u01/app/oracle/oradata/racdb
mkdir -p /u01/app/oracle/flash_recovery_area
mkdir -p /u01/app/oracle/flash_recovery_area/racdb

准备备库初始化参数文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 这里直接使用之前主库转储的pfile,然后修改为如下:
[oracle@oracle11-1 ~]$ cat /tmp/init_radb_stby2.ora
racdb.__db_cache_size=1124073472
racdb.__java_pool_size=16777216
racdb.__large_pool_size=33554432
racdb.__pga_aggregate_target=536870912
racdb.__sga_target=1610612736
racdb.__shared_io_pool_size=0
racdb.__shared_pool_size=419430400
racdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/racdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/racdb/control01.ctl','/u01/app/oracle/flash_recovery_area/racdb/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata/racdb'
*.db_domain=''
*.db_name='racdb'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4621074432
*.db_unique_name='racdb_standby2'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racdbXDB)'
*.fal_client='racdb_standby2'
*.fal_server='racdb_primary'
*.log_archive_config='DG_CONFIG=(racdb_primary,racdb_standby2)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=racdb_standby2'
*.log_archive_dest_2='SERVICE=racdb_primary LGWR SYNC REOPEN=15 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=racdb_primary'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=4
*.open_cursors=300
*.pga_aggregate_target=536870912
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=1610612736
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert='+DATA/racdb/datafile','/u01/app/oracle/oradata/racdb','+DATA/racdb/tempfile','/u01/app/oracle/oradata/racdb'
*.log_file_name_convert='+DATA/racdb/onlinelog','/u01/app/oracle/oradata/racdb'
[oracle@oracle11-1 ~]$

备库密码文件

下面将主库节点1的密码文件复制到此备库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[oracle@11rac1 ~]$ scp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwracdb1 oracle@10.10.10.3:/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
The authenticity of host '10.10.10.3 (10.10.10.3)' can't be established.
RSA key fingerprint is SHA256:KCuMsxiuP493oXTYB6R3VNl2BXBEl9Hf9EYtmsAjOEE.
RSA key fingerprint is MD5:53:55:03:39:b1:56:8b:69:ea:c6:3d:91:94:c3:dd:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.10.3' (RSA) to the list of known hosts.
oracle@10.10.10.3's password:

orapwracdb1 100% 1536 111.8KB/s 00:00
[oracle@11rac1 ~]$

# 备库修改密码文件名字
[oracle@oracle11-1 ~]$ cd $ORACLE_HOME/dbs
[oracle@oracle11-1 dbs]$ ls
hc_LHR11G.dat hc_orcl.dat init.ora orapwracdb1
[oracle@oracle11-1 dbs]$ mv orapwracdb1 orapwracdb
[oracle@oracle11-1 dbs]$

备库监听器配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[oracle@oracle11-1 dbs]$ cat /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora 
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle11-1)(PORT = 1521))
)
)

SID_LIST_listener =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = racdb_standby2)
(SID_NAME = racdb)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
)
)

ADR_BASE_LISTENER = /u01/app/oracle

[oracle@oracle11-1 dbs]$

# 重启监听器
[oracle@oracle11-1 dbs]$ lsnrctl reload

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 31-MAR-2025 02:11:07

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@oracle11-1 dbs]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 31-MAR-2025 02:11:11

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 30-MAR-2025 11:17:06
Uptime 0 days 14 hr. 54 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle11-1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle11-1)(PORT=1521)))
Services Summary...
Service "racdb_standby2" has 1 instance(s).
Instance "racdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracle11-1 dbs]$

备库TNSNAME

注意:这里同样通过主库节点1的VIP进行复制数据库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[oracle@oracle11-1 dbs]$ cat /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora
racdb_standby2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_standby2)
)
)

tar =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.173)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_primary)
)
)

racdb_primary =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.175)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb_primary)
)
)
[oracle@oracle11-1 dbs]$

备库启动到nomount

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[oracle@oracle11-1 ~]$ echo $ORACLE_SID
racdb
[oracle@oracle11-1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 31 02:55:20 2025

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SYS@racdb> startup nomount pfile='/tmp/init_racdb_stby2.ora';
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size 2253664 bytes
Variable Size 469765280 bytes
Database Buffers 1124073472 bytes
Redo Buffers 7319552 bytes
SYS@racdb>

连通性测试

1
2
3
4
5
tnsping tar
tnsping racdb_standby2

[oracle@racdg1 ~]$ sqlplus sys/SysPassword1@tar as sysdba
[oracle@racdg1 ~]$ sqlplus sys/SysPassword1@racdb_standby2 as sysdba

开始复制数据库

说明:如果遇到复制错误,则查看备库alert日志会很有帮助。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[oracle@oracle11-1 ~]$ echo $ORACLE_SID
racdb
[oracle@oracle11-1 ~]$ rman target sys/SysPassword1@tar auxiliary sys/SysPassword1@racdb_standby2

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 31 03:22:04 2025

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

connected to target database: RACDB (DBID=1167777349)
connected to auxiliary database: RACDB (not mounted)

RMAN> @dup.sql

RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate auxiliary channel c3 type disk;
5> allocate auxiliary channel c4 type disk;
6> duplicate target database for standby from active database;
7> release channel c1;
8> release channel c2;
9> release channel c3;
10> release channel c4;
11> }
using target database control file instead of recovery cat

遭遇如下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/31/2025 03:24:20
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

RMAN> **end-of-file**

# 解决办法
连接中指定 nocatalog

再次执行成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
[oracle@oracle11-1 ~]$ cat dup.sql 
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate auxiliary channel c3 type disk;
allocate auxiliary channel c4 type disk;
duplicate target database for standby from active database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
[oracle@oracle11-1 ~]$ rman target sys/SysPassword1@tar auxiliary sys/SysPassword1@racdb_standby2 nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 31 04:39:41 2025

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

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

RMAN> @dup.sql

RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate auxiliary channel c3 type disk;
5> allocate auxiliary channel c4 type disk;
6> duplicate target database for standby from active database;
7> release channel c1;
8> release channel c2;
9> release channel c3;
10> release channel c4;
11> }
allocated channel: c1
channel c1: SID=155 instance=racdb1 device type=DISK

allocated channel: c2
channel c2: SID=16 instance=racdb1 device type=DISK

allocated channel: c3
channel c3: SID=98 device type=DISK

allocated channel: c4
channel c4: SID=114 device type=DISK

Starting Duplicate Db at 2025-03-31 04:39:53

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

Starting backup at 2025-03-31 04:39:53
Finished backup at 2025-03-31 04:39:54

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

Starting backup at 2025-03-31 04:39:55
channel c1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/oradata/racdb/control01.ctl tag=TAG20250331T123949
channel c1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2025-03-31 04:39:57

Starting restore at 2025-03-31 04:39:57

channel c4: skipped, AUTOBACKUP already found
channel c3: copied control file copy
Finished restore at 2025-03-31 04:40:06

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/racdb/temp.263.1170160605";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/racdb/system.256.1170160477";
set newname for datafile 2 to
"/u01/app/oracle/oradata/racdb/sysaux.257.1170160479";
set newname for datafile 3 to
"/u01/app/oracle/oradata/racdb/undotbs1.258.1170160479";
set newname for datafile 4 to
"/u01/app/oracle/oradata/racdb/users.259.1170160479";
set newname for datafile 5 to
"/u01/app/oracle/oradata/racdb/undotbs2.264.1170160703";
backup as copy reuse
datafile 1 auxiliary format
"/u01/app/oracle/oradata/racdb/system.256.1170160477" datafile
2 auxiliary format
"/u01/app/oracle/oradata/racdb/sysaux.257.1170160479" datafile
3 auxiliary format
"/u01/app/oracle/oradata/racdb/undotbs1.258.1170160479" datafile
4 auxiliary format
"/u01/app/oracle/oradata/racdb/users.259.1170160479" datafile
5 auxiliary format
"/u01/app/oracle/oradata/racdb/undotbs2.264.1170160703" ;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/racdb/temp.263.1170160605 in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 2025-03-31 04:40:17
channel c1: starting datafile copy
input datafile file number=00002 name=+DATA/racdb/datafile/sysaux.257.1170160479
channel c2: starting datafile copy
input datafile file number=00001 name=+DATA/racdb/datafile/system.256.1170160477
output file name=/u01/app/oracle/oradata/racdb/sysaux.257.1170160479 tag=TAG20250331T124011
channel c1: datafile copy complete, elapsed time: 00:00:16
channel c1: starting datafile copy
input datafile file number=00005 name=+DATA/racdb/datafile/undotbs2.264.1170160703
output file name=/u01/app/oracle/oradata/racdb/system.256.1170160477 tag=TAG20250331T124011
channel c2: datafile copy complete, elapsed time: 00:00:15
channel c2: starting datafile copy
input datafile file number=00003 name=+DATA/racdb/datafile/undotbs1.258.1170160479
output file name=/u01/app/oracle/oradata/racdb/undotbs2.264.1170160703 tag=TAG20250331T124011
channel c1: datafile copy complete, elapsed time: 00:00:08
channel c1: starting datafile copy
input datafile file number=00004 name=+DATA/racdb/datafile/users.259.1170160479
output file name=/u01/app/oracle/oradata/racdb/users.259.1170160479 tag=TAG20250331T124011
channel c1: datafile copy complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/racdb/undotbs1.258.1170160479 tag=TAG20250331T124011
channel c2: datafile copy complete, elapsed time: 00:00:12
Finished backup at 2025-03-31 04:40:46

sql statement: alter system archive log current

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=1197175250 file name=/u01/app/oracle/oradata/racdb/system.256.1170160477
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=1197175250 file name=/u01/app/oracle/oradata/racdb/sysaux.257.1170160479
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=1197175250 file name=/u01/app/oracle/oradata/racdb/undotbs1.258.1170160479
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=1197175250 file name=/u01/app/oracle/oradata/racdb/users.259.1170160479
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=1197175250 file name=/u01/app/oracle/oradata/racdb/undotbs2.264.1170160703
Finished Duplicate Db at 2025-03-31 04:41:04

released channel: c1

released channel: c2

released channel: c3

released channel: c4

RMAN> **end-of-file**

RMAN>

备库SRL

dup完成后,备库自动创建SRL:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SYS@racdb> select group#,member from v$logfile order by group#;

GROUP# MEMBER
---------- -------------------------------------------------------------------------------------
1 /u01/app/oracle/oradata/racdb/group_1.261.1170160587
1 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_1_myn76ly1_.log
2 /u01/app/oracle/oradata/racdb/group_2.262.1170160587
2 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_2_myn76my7_.log
2 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_2_myn76ms0_.log
3 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_3_myn76qmc_.log
3 /u01/app/oracle/oradata/racdb/group_3.265.1170161993
3 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_3_myn76qv8_.log
4 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_4_myn76rtq_.log
4 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_4_myn76rom_.log
4 /u01/app/oracle/oradata/racdb/group_4.266.1170161995
5 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_5_myn76smd_.log
5 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_5_myn76sro_.log
5 /u01/app/oracle/oradata/racdb/group_5.268.1196954537
6 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_6_myn76vkx_.log
6 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_6_myn76vdz_.log
6 /u01/app/oracle/oradata/racdb/group_6.269.1196954539
7 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_7_myn76wjd_.log
7 /u01/app/oracle/oradata/racdb/group_7.270.1196954541
7 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_7_myn76wpc_.log
8 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_8_myn76xj3_.log
8 /u01/app/oracle/oradata/racdb/group_8.271.1196954553
8 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_8_myn76xp2_.log
9 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_9_myn76yp6_.log
9 /u01/app/oracle/oradata/racdb/group_9.272.1196954553
9 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_9_myn76yv6_.log
10 /u01/app/oracle/flash_recovery_area/RACDB_STANDBY2/onlinelog/o1_mf_10_myn77093_.log
10 /u01/app/oracle/oradata/racdb/group_10.273.1196954553
10 /u01/app/oracle/oradata/racdb/RACDB_STANDBY2/onlinelog/o1_mf_10_myn7703x_.log

30 rows selected.

SYS@racdb>

创建备库spfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SYS@racdb_standby2> create spfile from pfile='/tmp/init_racdb_stby2.ora';

File created.

SYS@racdb_standby2> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SYS@racdb_standby2> startup mount;
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size 2253664 bytes
Variable Size 469765280 bytes
Database Buffers 1124073472 bytes
Redo Buffers 7319552 bytes
Database mounted.
SYS@racdb_standby2>

启动DG同步进程

ADG模式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
SYS@racdb_standby2> alter database open read only;

Database altered.

SYS@racdb_standby2> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SYS@racdb_standby2> select process,client_process,sequence#,status from v$managed_standby;

PROCESS CLIENT_PROCESS SEQUENCE# STATUS
------------------ ---------------- ---------- ------------------------
ARCH ARCH 296 CLOSING
ARCH ARCH 0 CONNECTED
ARCH ARCH 475 CLOSING
ARCH ARCH 0 CONNECTED
RFS ARCH 0 IDLE
RFS ARCH 0 IDLE
RFS LGWR 476 IDLE
RFS LGWR 297 IDLE
RFS UNKNOWN 0 IDLE
RFS UNKNOWN 0 IDLE
RFS UNKNOWN 0 IDLE
RFS UNKNOWN 0 IDLE
MRP0 N/A 297 APPLYING_LOG