ORACLE DG 搭建、切换及日常维护手册

ORACLE DG 数据库信息

数据库版本 19.18

/etc/hosts

1
2
3
4
181.18.1.190  liups  
131.31.1.133 tcloud
10.0.12.11 liups # 190
10.0.24.4 tcloud #133
角色 IP (外部IP/内网IP) db_unique_name ORACLE_SID ORACLE_HOME tns_name
主库 181.18.1.190/10.0.12.11 ora19cl ora19cl /data/app/oracle/product/19.3.0/db primarytns
DG 131.31.1.133/10.0.24.4 ora19cdg ora19cdg /data/app/oracle/product/19.3.0.0/dbhome_1 standbytns

配置归档模式

主库进行如下操作进行 force logging和归档配置

配置 force logging 模式

1
ALTER DATABASE FORCE LOGGING; 

配置归档模式

1
2
3
4
5
SQL>shutdown immediate 
SQL>startup mount
SQL>alter database archivelog;
SQL>alter database open;
SQL>ALTER DATABASE FORCE LOGGING;

检查归档模式

1
2
3
4
5
select LOG_MODE, FORCE_LOGGING from v$database;

LOG_MODE FORCE_LOGGING
------------ ---------------------------------------
ARCHIVELOG YES

配置静态监听及tns

DG 上配置静态配置 /data/app/oracle/product/19.3.0.0/dbhome_1/network/admin/listener.ora

1
vi /data/app/oracle/product/19.3.0.0/dbhome_1/network/admin/listener.ora

新增

1
2
3
4
5
6
7
8
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ora19cl)
(ORACLE_HOME = /data/app/oracle/product/19.3.0.0/dbhome_1)
(SID_NAME = ora19cl)
)
)

重启监听

1
2
lsnrctl stop 
lsnrctl start

重启之前的监听为:

1
2
3
4
5
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tcloud)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

重启之后变为:

1
2
3
4
5
6
7
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tcloud)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ora19cl" has 1 instance(s).
Instance "ora19cl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

配置 tns

主从都修改 tnsnames.ora,配置如下:

tnsnames.ora for primary

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
primarytns=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.12.11)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora19cl)
)
)
standbytns=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 131.31.1.133)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora19cl)
)
)

tnsnames.ora for standby

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
primarytns=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 181.18.1.190)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora19cl)
)
)
standbytns=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.24.4)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora19cl)
)
)

测试 tns

1
2
tnsping primarytns
tnsping standbytns
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
[oracle@tcloud admin]$ tnsping primarytns

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 31-DEC-2023 09:32:17

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/data/app/oracle/product/19.3.0.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 181.18.1.190)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora19cl)))
OK (80 msec)
[oracle@tcloud admin]$ tnsping standbytns

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 31-DEC-2023 09:32:17

Copyright (c) 1997, 2019, Oracle. All rights reserved.

Used parameter files:
/data/app/oracle/product/19.3.0.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.24.4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora19cl)))
OK (0 msec)

主从都进行 tnsping 测试,需要两边都可以 tnsping 通。

新增 standby log file

主库上进行 standby log file 操作

1
2
3
4
alter database add standby logfile thread 1 group 20 ('/data/oradata/ORA19CL/sty_redo01.log') size 125829120;
alter database add standby logfile thread 1 group 21 ('/data/oradata/ORA19CL/sty_redo02.log') size 125829120;
alter database add standby logfile thread 1 group 22 ('/data/oradata/ORA19CL/sty_redo03.log') size 125829120;
alter database add standby logfile thread 1 group 23 ('/data/oradata/ORA19CL/sty_redo04.log') size 125829120;

主库修改数据库参数

1
2
3
4
5
6
alter system set log_archive_config='dg_config=(ora19cl,ora19cdg)'; 
alter system set log_archive_dest_1='location=/data/archivelog/ valid_for=(all_logfiles,all_roles) db_unique_name=ora19cl';
alter system set log_archive_dest_2='SERVICE=standbytns lgwr async valid_for=(ONLINE_LOGFILES,primary_role) db_unique_name=ora19cdg';
alter system set standby_file_management='AUTO';
alter system set fal_server=standbytns;
alter system set log_archive_dest_state_2=enable;

复制密码文件到备库

1
2
cd $ORACLE_HOME/dbs 
scp orapwora19cl 131.31.1.133:/data/app/oracle/product/19.3.0.0/dbhome_1/dbs/

备库启动数据库实例

备库创建审计日志目录

1
mkdir -p /data/app/oracle/admin/ora19cl/adump

备库启动数据库实例到 nomount 状态

1
2
3
4
5
6
7
8
9
10
11
12
cd $ORACLE_HOME/dbs;touch initora19cl.ora ;echo "db_name=ora19cl">initora19cl.ora
export ORACLE_SID=ora19cl
sqlplus / as sysdba
startup nomount
SQL> startup nomount
ORACLE instance started.

Total System Global Area 306183456 bytes
Fixed Size 8895776 bytes
Variable Size 239075328 bytes
Database Buffers 50331648 bytes
Redo Buffers 7880704 bytes
1
2
sqlplus sys/password123@primarytns as sysdba 
sqlplus sys/password123@standbytns as sysdba

rman duplicate 搭建DG从库

cat r.sh

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
rman<<_EOF
connect target sys/password123@primarytns
connect auxiliary sys/password123@standbytns
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
duplicate target database
for standby
from active database nofilenamecheck
dorecover
spfile
parameter_value_convert 'ora19cl','ora19cdg'
set db_name='ora19cl'
set db_unique_name='ora19cdg'
set fal_server='primarytns'
set sga_target='2G'
set sga_max_size='2G'
set remote_listener=''
set local_listener=''
set standby_file_management='AUTO'
set audit_file_dest= '/data/app/oracle/admin/ora19cl/adump'
set log_archive_config='dg_config=(ora19cl,ora19cdg)'
set log_archive_dest_1='location=/data/archivelog/ valid_for=(all_logfiles,all_roles) db_unique_name=ora19cdg'
set log_archive_dest_2='SERVICE=primarytns lgwr async VALID_FOr=(ONLINE_LOGFILES,primary_role) DB_UNIQUE_NAME=ora19cl'
set log_archive_dest_state_2='enable'
;
sql channel c1 "alter system archive log current";
sql channel s1 "alter database open";
sql channel s1 "alter database recover managed standby database using current logfile disconnect";
}
_EOF

1
2
3
4
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/path/to/standby/controlfile.ctl';
alter database recover managed standby database cancel;

alter database recover managed standby database using current logfile disconnect
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
nohup sh r.sh &

[oracle@tcloud ~]$ sh r.sh

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Dec 31 10:12:27 2023
Version 19.18.0.0.0

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

RMAN>
connected to target database: ORA19CL (DBID=742043361)

RMAN>
PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.03.00.00 in AUXILIARY database is not current
PL/SQL package SYS.DBMS_RCVMAN version 19.03.00.00 in AUXILIARY database is not current
connected to auxiliary database: ORA19CL (not mounted)

RMAN> 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>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=781 device type=DISK

allocated channel: c2
channel c2: SID=1167 device type=DISK

allocated channel: s1
channel s1: SID=10 device type=DISK

allocated channel: s2
channel s2: SID=151 device type=DISK

Starting Duplicate Db at 2023-12-31 10:12:44
current log archived

contents of Memory Script:
{
backup as copy reuse
passwordfile auxiliary format '/data/app/oracle/product/19.3.0.0/dbhome_1/dbs/orapwora19cl' ;
restore clone from service 'primarytns' spfile to
'/data/app/oracle/product/19.3.0.0/dbhome_1/dbs/spfileora19cl.ora';
sql clone "alter system set spfile= ''/data/app/oracle/product/19.3.0.0/dbhome_1/dbs/spfileora19cl.ora''";
}
executing Memory Script

Starting backup at 2023-12-31 10:12:46
Finished backup at 2023-12-31 10:12:49

Starting restore at 2023-12-31 10:12:49

channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: restoring SPFILE
output file name=/data/app/oracle/product/19.3.0.0/dbhome_1/dbs/spfileora19cl.ora
channel s1: restore complete, elapsed time: 00:00:02
Finished restore at 2023-12-31 10:12:55

sql statement: alter system set spfile= ''/data/app/oracle/product/19.3.0.0/dbhome_1/dbs/spfileora19cl.ora''

contents of Memory Script:
{
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=ora19cdgXDB)'' comment=
'''' scope=spfile";
sql clone "alter system set db_name =
''ora19cl'' comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''ora19cdg'' comment=
'''' scope=spfile";
sql clone "alter system set fal_server =
''primarytns'' comment=
'''' scope=spfile";
sql clone "alter system set sga_target =
2G comment=
'''' scope=spfile";
sql clone "alter system set sga_max_size =
2G comment=
'''' scope=spfile";
sql clone "alter system set remote_listener =
'''' comment=
'''' scope=spfile";
sql clone "alter system set local_listener =
'''' comment=
'''' scope=spfile";
sql clone "alter system set standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
sql clone "alter system set audit_file_dest =
''/data/app/oracle/admin/ora19cl/adump'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_config =
''dg_config=(ora19cl,ora19cdg)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''location=/data/archivelog/ valid_for=(all_logfiles,all_roles) db_unique_name=ora19cdg'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_2 =
''SERVICE=primarytns lgwr async VALID_FOr=(ONLINE_LOGFILES,primary_role) DB_UNIQUE_NAME=ora19cl'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_state_2 =
''enable'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=ora19cdgXDB)'' comment= '''' scope=spfile

sql statement: alter system set db_name = ''ora19cl'' comment= '''' scope=spfile

sql statement: alter system set db_unique_name = ''ora19cdg'' comment= '''' scope=spfile

sql statement: alter system set fal_server = ''primarytns'' comment= '''' scope=spfile

sql statement: alter system set sga_target = 2G comment= '''' scope=spfile

sql statement: alter system set sga_max_size = 2G comment= '''' scope=spfile

sql statement: alter system set remote_listener = '''' comment= '''' scope=spfile

sql statement: alter system set local_listener = '''' comment= '''' scope=spfile

sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set audit_file_dest = ''/data/app/oracle/admin/ora19cl/adump'' comment= '''' scope=spfile

sql statement: alter system set log_archive_config = ''dg_config=(ora19cl,ora19cdg)'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_1 = ''location=/data/archivelog/ valid_for=(all_logfiles,all_roles) db_unique_name=ora19cdg'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_2 = ''SERVICE=primarytns lgwr async VALID_FOr=(ONLINE_LOGFILES,primary_role) DB_UNIQUE_NAME=ora19cl'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_state_2 = ''enable'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 2147481656 bytes

Fixed Size 8898616 bytes
Variable Size 486539264 bytes
Database Buffers 1644167168 bytes
Redo Buffers 7876608 bytes
allocated channel: s1
channel s1: SID=390 device type=DISK
allocated channel: s2
channel s2: SID=1144 device type=DISK
duplicating Online logs to Oracle Managed File (OMF) location
duplicating Datafiles to Oracle Managed File (OMF) location

contents of Memory Script:
{
restore clone from service 'primarytns' standby controlfile;
}
executing Memory Script

Starting restore at 2023-12-31 10:13:38

channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: restoring control file
channel s1: restore complete, elapsed time: 00:00:16
output file name=/data/oradata/ORA19CL/control01.ctl
output file name=/data/oradata/ORA19CL/control02.ctl
Finished restore at 2023-12-31 10:13:58

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 clone tempfile 1 to new;
switch clone tempfile all;
set newname for clone datafile 1 to new;
set newname for clone datafile 2 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 4 to new;
set newname for clone datafile 5 to new;
set newname for clone datafile 7 to new;
set newname for clone datafile 8 to new;
set newname for clone datafile 9 to new;
set newname for clone datafile 10 to new;
restore
from nonsparse from service
'primarytns' clone database
;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /data/oradata/ORA19CDG/datafile/o1_mf_temp_%u_.tmp 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 restore at 2023-12-31 10:14:07

channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00001 to /data/oradata/ORA19CDG/datafile/o1_mf_system_%u_.dbf
channel s2: starting datafile backup set restore
channel s2: using network backup set from service primarytns
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00002 to /data/oradata/ORA19CDG/datafile/o1_mf_userb_in_%u_.dbf
channel s2: restore complete, elapsed time: 00:00:55
channel s2: starting datafile backup set restore
channel s2: using network backup set from service primarytns
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00003 to /data/oradata/ORA19CDG/datafile/o1_mf_sysaux_%u_.dbf
channel s1: restore complete, elapsed time: 00:22:42
channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00004 to /data/oradata/ORA19CDG/datafile/o1_mf_undotbs1_%u_.dbf
channel s1: restore complete, elapsed time: 00:00:26
channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00005 to /data/oradata/ORA19CDG/datafile/o1_mf_userb_da_%u_.dbf
channel s1: restore complete, elapsed time: 00:02:46
channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00007 to /data/oradata/ORA19CDG/datafile/o1_mf_users_%u_.dbf
channel s2: restore complete, elapsed time: 00:40:24
channel s2: starting datafile backup set restore
channel s2: using network backup set from service primarytns
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00008 to /data/oradata/ORA19CDG/datafile/o1_mf_archive_%u_.dbf
channel s1: restore complete, elapsed time: 00:16:22
channel s1: starting datafile backup set restore
channel s1: using network backup set from service primarytns
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00009 to /data/oradata/ORA19CDG/datafile/o1_mf_archive_%u_.dbf
channel s2: restore complete, elapsed time: 00:00:57
channel s2: starting datafile backup set restore
channel s2: using network backup set from service primarytns
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00010 to /data/oradata/ORA19CDG/datafile/o1_mf_mestbs_%u_.dbf
channel s1: restore complete, elapsed time: 00:00:02
channel s2: restore complete, elapsed time: 00:00:56
Finished restore at 2023-12-31 10:57:23

sql statement: alter system archive log current
current log archived

contents of Memory Script:
{
restore clone force from service 'primarytns'
archivelog from scn 7554812;
switch clone datafile all;
}
executing Memory Script

Starting restore at 2023-12-31 10:57:24

channel s1: starting archived log restore to default destination
channel s1: using network backup set from service primarytns
channel s1: restoring archived log
archived log thread=1 sequence=159
channel s2: starting archived log restore to default destination
channel s2: using network backup set from service primarytns
channel s2: restoring archived log
archived log thread=1 sequence=160
channel s1: restore complete, elapsed time: 00:00:04
channel s2: restore complete, elapsed time: 00:00:08
Finished restore at 2023-12-31 10:57:34

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_system_ls1mmnk0_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_userb_in_ls1mnjgt_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_sysaux_ls1moob9_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_undotbs1_ls1nylkv_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_userb_da_ls1o13rt_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=15 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_users_ls1o58h7_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=16 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_archive_ls1p2hn2_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=17 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_archive_ls1p2vhq_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=18 STAMP=1157021855 file name=/data/oradata/ORA19CDG/datafile/o1_mf_mestbs_ls1p2zry_.dbf

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

executing command: SET until clause

Starting recover at 2023-12-31 10:57:37

starting media recovery

archived log for thread 1 with sequence 159 is already on disk as file /data/archivelog/1_159_1151325793.dbf
archived log for thread 1 with sequence 160 is already on disk as file /data/archivelog/1_160_1151325793.dbf
released channel: c1
released channel: c2
released channel: s1
released channel: s2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/31/2023 10:57:44
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-10015: error compiling PL/SQL program
RMAN-10014: PL/SQL error 0 on line 425 column 10: Statement ignored
RMAN-10014: PL/SQL error 306 on line 426 column 14: wrong number or types of arguments in call to 'GETDFINFO'

RMAN>

Recovery Manager complete.

查看DG数据同步详情

查看脚本为 /home/oracle/dginfo.sh,内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env sh
sqlplus / as sysdba <<EOF
set lines 123
set pages 200
col CTIME format a20
col NAME format a20
col VALUE format a20
col DATUM_TIME format a20
select open_mode, DATABASE_ROLE from v\$database;
SELECT TO_NUMBER( SUBSTR ( (SUBSTR (VALUE, 5)), 0, 2) * 3600 + SUBSTR ( (SUBSTR (VALUE, 5)), 4, 2) * 60 + SUBSTR ( (SUBSTR (VALUE, 5)), 7, 2)) dgbehind, TO_CHAR (SYSDATE, 'yyyymmdd hh24:mi:ss'
) CTIME, NAME, VALUE,DATUM_TIME FROM V\$DATAGUARD_STATS WHERE NAME ='apply lag';
select process,block#,blocks ,status ,sequence# from v\$managed_standby;
exit
EOF

DG日常维护手册

以下所有操作如果没有特别说明使用 oracle 用户执行

1、启动监听

1
lsnrctl start 

2、查看监听状态

1
lsnrctl status 

3、关闭监听

1
lsnrctl stop 

4、启动数据库

s
1
2
sqlplus / as sysdba 
startup

5、关闭数据库

1
2
sqlplus / as sysdba 
shutdown immediate

6、启动数据同步进程

1
2
sqlplus / as sysdba 
alter database recover managed standby database using current logfile disconnect;

原文作者: liups.com

原文链接: http://liups.com/posts/63c6ebd2/

许可协议: 知识共享署名-非商业性使用 4.0 国际许可协议