<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; rman dataguard</title>
	<atom:link href="https://www.xifenfei.com/tag/rman-dataguard/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Sat, 07 Nov 2026 15:45:44 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>使用rman from service 搭建dataguard</title>
		<link>https://www.xifenfei.com/2021/03/rman-from-service-dataguard.html</link>
		<comments>https://www.xifenfei.com/2021/03/rman-from-service-dataguard.html#comments</comments>
		<pubDate>Sat, 13 Mar 2021 13:20:54 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[Data Guard]]></category>
		<category><![CDATA[rman备份/恢复]]></category>
		<category><![CDATA[rman dataguard]]></category>
		<category><![CDATA[rman from service]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=9112</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2021/03/rman-from-service-dataguard.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2021/03/rman-from-service-dataguard.html" target="_blank">使用rman from service 搭建dataguard</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>从oracle 12c开始提供了rman通过from service方式搭建dg,使用12c长期支持版19c(并打上最新的patch)<br />
<strong>配置dataguard相关参数(主备库有稍微不同)</strong></p>
<pre class="brush: bash; title: ; notranslate">
alter system set db_unique_name='XIFENFEI' scope=spfile;
alter system set service_names='XIFENFEI';
alter system set log_archive_config='dg_config=(XIFENFEI,XIFENFEIDG)';
alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST 
  valid_for=(all_logfiles,all_roles) db_unique_name=XIFENFEI';
alter system set log_archive_dest_2='service=XIFENFEIDG lgwr async 
 valid_for=(online_logfiles,primary_role) db_unique_name=XIFENFEIDG';
alter system set standby_file_management=auto;
alter system set db_file_name_convert='/u01/app/oracle/oradata/XIFENFEI/',
 '/u01/app/oracle/oradata/XIFENFEI/' scope=spfile;
alter system set log_file_name_convert='/u01/app/oracle/oradata/XIFENFEI/',
 '/u01/app/oracle/oradata/XIFENFEI/' scope=spfile;
alter system set fal_server=XIFENFEIDG;
</pre>
<p><strong>配置tnsnames.ora</strong></p>
<pre class="brush: bash; title: ; notranslate">
XIFENFEI =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.238)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = XIFENFEI)
    )
  )

XIFENFEIDG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.124)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = XIFENFEI)
    )
  )
</pre>
<p><strong>拷贝主库密码文件到备库</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@primary ~]$ scp $ORACLE_HOME/dbs/orapwXIFENFEI 192.168.0.124:$ORACLE_HOME/dbs/
The authenticity of host '192.168.0.124 (192.168.0.124)' can't be established.
ECDSA key fingerprint is SHA256:NI2952z4Bqc3M/B+AK7EJRiJNauROIyluvu1l4NSTX0.
ECDSA key fingerprint is MD5:1d:64:dd:ef:1c:ad:ed:cf:70:22:2d:4d:7c:90:5e:5e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.124' (ECDSA) to the list of known hosts.
oracle@192.168.0.124's password: 
orapwXIFENFEI                                                                   100% 2048     6.6MB/s   00:00    
[oracle@primary ~]$ 
</pre>
<p><strong>备库启动到nomount状态</strong></p>
<pre class="brush: sql; title: ; notranslate">
[oracle@standby ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 13 20:32:34 2021
Version 19.10.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Connected to an idle instance.

SQL&gt; create spfile from pfile='/tmp/pfile';

File created.

SQL&gt; startup nomount pfile='/tmp/pfile'
ORACLE instance started.

Total System Global Area 4294963264 bytes
Fixed Size                  8904768 bytes
Variable Size             805306368 bytes
Database Buffers         3472883712 bytes
Redo Buffers                7868416 bytes
SQL&gt; exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
</pre>
<p><strong>rman from service方式创建standby ctl和还原数据文件</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@standby ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sat Mar 13 20:34:37 2021
Version 19.10.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: XIFENFEI (not mounted)

RMAN&gt; restore standby controlfile from service XIFENFEI;

Starting restore at 13-MAR-21
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service XIFENFEI
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/XIFENFEI/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/XIFENFEI/control02.ctl
Finished restore at 13-MAR-21

RMAN&gt; alter database mount;

released channel: ORA_DISK_1
Statement processed

RMAN&gt; restore database from service XIFENFEI;

Starting restore at 13-MAR-21
Starting implicit crosscheck backup at 13-MAR-21
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=12 device type=DISK
Finished implicit crosscheck backup at 13-MAR-21

Starting implicit crosscheck copy at 13-MAR-21
using channel ORA_DISK_1
Finished implicit crosscheck copy at 13-MAR-21

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service XIFENFEI
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/XIFENFEI/system01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service XIFENFEI
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/XIFENFEI/sysaux01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service XIFENFEI
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/XIFENFEI/undotbs01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service XIFENFEI
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/XIFENFEI/users01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 13-MAR-21
</pre>
<p><strong>备库启动mrp进程</strong></p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.
</pre>
<pre class="brush: bash; title: ; notranslate">
2021-03-13T20:54:08.075418+08:00
Attempt to start background Managed Standby Recovery process (XIFENFEI)
Starting background process MRP0
2021-03-13T20:54:08.086269+08:00
MRP0 started with pid=56, OS id=8182 
2021-03-13T20:54:08.087276+08:00
Background Managed Standby Recovery process started (XIFENFEI)
2021-03-13T20:54:13.104757+08:00
 Started logmerger process
2021-03-13T20:54:13.112058+08:00

IM on ADG: Start of Empty Journal 

IM on ADG: End of Empty Journal 
PR00 (PID:8188): Managed Standby Recovery starting Real Time Apply
2021-03-13T20:54:13.205668+08:00
Parallel Media Recovery started with 4 slaves
2021-03-13T20:54:13.216576+08:00
Stopping change tracking
PR00 (PID:8188): Media Recovery Waiting for T-1.S-25 (in transit)
2021-03-13T20:54:13.269138+08:00
Recovery of Online Redo Log: Thread 1 Group 12 Seq 25 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/XIFENFEI/s_redo12.log
</pre>
<p>至此dataguard基本上搭建完成</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/06/rman%e9%80%9a%e8%bf%87nfs%e5%a4%87%e4%bb%bd.html" rel="bookmark" class="crp_title">rman通过nfs备份</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/11/rman%e4%bb%8e%e5%a4%9a%e4%bb%bd%e5%a4%87%e4%bb%bd%e4%b8%ad%e8%bf%98%e5%8e%9f%e6%93%8d%e4%bd%9c.html" rel="bookmark" class="crp_title">rman从多份备份中还原操作</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/01/%e7%bb%99%e4%bd%a0%e7%9a%84rman%e5%a4%87%e4%bb%bd%e9%9b%86%e5%8a%a0%e4%b8%8a%e5%af%86%e7%a0%81%e9%94%81.html" rel="bookmark" class="crp_title">给你的rman备份集加上密码锁</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/rman-%e5%a4%87%e4%bb%bd%e5%87%ba%e7%8e%b0ora-00245rman-08132.html" rel="bookmark" class="crp_title">rman 备份出现ORA-00245/RMAN-08132</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/%e6%99%ae%e9%80%9a%e5%ba%93%e8%bf%81%e7%a7%bb%e8%87%b3asm%e5%ad%98%e5%82%a8.html" rel="bookmark" class="crp_title">普通库迁移至ASM存储</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/04/%e5%88%a9%e7%94%a8scn%e5%a2%9e%e9%87%8f%e5%a4%87%e4%bb%bd%e5%ae%9e%e7%8e%b0%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a2%9e%e9%87%8f%e6%81%a2%e5%a4%8d.html" rel="bookmark" class="crp_title">利用scn增量备份实现数据库增量恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/asm%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%96%87%e4%bb%b6%e4%bb%8ediskgroup-to-new-diskgroup.html" rel="bookmark" class="crp_title">asm数据文件迁移(asm&#8211;>asm)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/ora-01578%e5%9d%8f%e5%9d%97%e8%a7%a3%e5%86%b32.html" rel="bookmark" class="crp_title">ORA-01578坏块解决(2)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/03/%e9%9d%9e%e5%bd%92%e6%a1%a3%e5%bc%82%e5%b8%b8%e6%95%b0%e6%8d%ae%e5%ba%93rman%e5%a4%87%e4%bb%bd.html" rel="bookmark" class="crp_title">非归档异常数据库rman备份</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/06/ora-00230-operation-disallowed-snapshot-control-file-enqueue-unavailable.html" rel="bookmark" class="crp_title">ORA-00230: operation disallowed: snapshot control file enqueue unavailable</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/asm%e8%bf%81%e7%a7%bb%e8%87%b3%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f.html" rel="bookmark" class="crp_title">ASM迁移至文件系统</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/09/_no_recovery_through_resetlogs%e5%87%bd%e6%95%b0%e5%8a%9f%e8%83%bd%e6%8e%a2%e8%ae%a8.html" rel="bookmark" class="crp_title">_no_recovery_through_resetlogs参数功能探讨</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2021/03/rman-from-service-dataguard.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
