<?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; 数据库启动</title>
	<atom:link href="https://www.xifenfei.com/tag/%e6%95%b0%e6%8d%ae%e5%ba%93%e5%90%af%e5%8a%a8/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>Tue, 17 Nov 2026 13:36:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>设置pdb随cdb一起启动</title>
		<link>https://www.xifenfei.com/2014/11/%e8%ae%be%e7%bd%aepdb%e9%9a%8fcdb%e4%b8%80%e8%b5%b7%e5%90%af%e5%8a%a8.html</link>
		<comments>https://www.xifenfei.com/2014/11/%e8%ae%be%e7%bd%aepdb%e9%9a%8fcdb%e4%b8%80%e8%b5%b7%e5%90%af%e5%8a%a8.html#comments</comments>
		<pubDate>Thu, 27 Nov 2014 16:08:14 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[ORACLE 12C]]></category>
		<category><![CDATA[pdb]]></category>
		<category><![CDATA[数据库启动]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=5660</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2014/11/%e8%ae%be%e7%bd%aepdb%e9%9a%8fcdb%e4%b8%80%e8%b5%b7%e5%90%af%e5%8a%a8.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/2014/11/%e8%ae%be%e7%bd%aepdb%e9%9a%8fcdb%e4%b8%80%e8%b5%b7%e5%90%af%e5%8a%a8.html" target="_blank">设置pdb随cdb一起启动</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>在Oracle 12.1.0.1版本中,在cdb数据库启动过程中,业务pdb无法自动open,如果要实现该功能,需要人工写触发器来实现cdb open后,pdb 给open起来.在12.1.0.2及其以后版本,可以通过设置ALTER PLUGGABLE DATABASE PDB SAVE STATE来实现在cdb open之后业务pdb能够自动open.<br />
<strong>数据库启动后pdb未自动open</strong></p>
<pre class="brush: sql; title: ; notranslate">
XFF_CDB$ROOT@SYS&gt; startup
ORACLE 例程已经启动。

Total System Global Area  805306368 bytes
Fixed Size                  3050800 bytes
Variable Size             394265296 bytes
Database Buffers          297795584 bytes
Redo Buffers                5337088 bytes
In-Memory Area            104857600 bytes
数据库装载完毕。
数据库已经打开。
XFF_CDB$ROOT@SYS&gt; select * from v$version;

BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production              0
PL/SQL Release 12.1.0.2.0 - Production                                                    0
CORE    12.1.0.2.0      Production                                                        0
TNS for 64-bit Windows: Version 12.1.0.2.0 - Production                                   0
NLSRTL Version 12.1.0.2.0 - Production                                                    0

XFF_CDB$ROOT@SYS&gt; show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
</pre>
<p><strong>查询dba_pdb_saved_states无记录</strong></p>
<pre class="brush: sql; title: ; notranslate">
XFF_CDB$ROOT@SYS&gt;  select con_name, state from dba_pdb_saved_states;

未选定行
</pre>
<p><strong>在数据库mount状态下save state</strong></p>
<pre class="brush: sql; title: ; notranslate">
XFF_CDB$ROOT@SYS&gt;  ALTER PLUGGABLE DATABASE PDB save state;

插接式数据库已变更。

XFF_CDB$ROOT@SYS&gt;  select con_name, state from dba_pdb_saved_states;

未选定行
</pre>
<p>pdb为mount状态下,执行save state无记录,证明save state不成功<br />
<br />
<strong>在数据库open状态下save state&#8212;-设置pdb随cdb启动</strong></p>
<pre class="brush: sql; title: ; notranslate">
XFF_CDB$ROOT@SYS&gt; ALTER PLUGGABLE DATABASE PDB open;

插接式数据库已变更。

XFF_CDB$ROOT@SYS&gt;  ALTER PLUGGABLE DATABASE PDB save state;

插接式数据库已变更。

XFF_CDB$ROOT@SYS&gt; col con_name for a20
XFF_CDB$ROOT@SYS&gt;  select con_name, state from dba_pdb_saved_states;

CON_NAME             STATE
-------------------- --------------
PDB                  OPEN
</pre>
<p>pdb为open状态下,执save state成功.<br />
需要注意save state需要在pdb open情况下执行才能够生效.<br />
<br />
<strong>重启数据库测试pdb随cdb启动</strong></p>
<pre class="brush: sql; title: ; notranslate">
XFF_CDB$ROOT@SYS&gt; shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
XFF_CDB$ROOT@SYS&gt; startup
ORACLE 例程已经启动。

Total System Global Area  805306368 bytes
Fixed Size                  3050800 bytes
Variable Size             364905168 bytes
Database Buffers          327155712 bytes
Redo Buffers                5337088 bytes
In-Memory Area            104857600 bytes
数据库装载完毕。
数据库已经打开。
XFF_CDB$ROOT@SYS&gt; show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE NO
</pre>
<p><strong>禁用pdb随cdb启动&#8212;DISCARD STATE</strong></p>
<pre class="brush: sql; title: ; notranslate">
XFF_CDB$ROOT@SYS&gt;  ALTER PLUGGABLE DATABASE PDB DISCARD  state;

插接式数据库已变更。

XFF_CDB$ROOT@SYS&gt;  select con_name, state from dba_pdb_saved_states;

未选定行

XFF_CDB$ROOT@SYS&gt; shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
XFF_CDB$ROOT@SYS&gt; startup
ORACLE 例程已经启动。

Total System Global Area  805306368 bytes
Fixed Size                  3050800 bytes
Variable Size             364905168 bytes
Database Buffers          327155712 bytes
Redo Buffers                5337088 bytes
In-Memory Area            104857600 bytes
数据库装载完毕。
数据库已经打开。
XFF_CDB$ROOT@SYS&gt; show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            MOUNTED
XFF_CDB$ROOT@SYS&gt;
</pre>
<p><strong>12.1.0.1中设置pdb随cdb启动</strong></p>
<pre class="brush: sql; title: ; notranslate">
CREATE TRIGGER open_all_pdbs
   AFTER STARTUP
   ON DATABASE
BEGIN
   EXECUTE IMMEDIATE 'alter pluggable database all open';
END open_all_pdbs;
/
</pre>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2014/03/oracle-12c-redo%e5%bc%82%e5%b8%b8%e6%81%a2%e5%a4%8d%e6%b5%8b%e8%af%95-%e9%83%a8%e5%88%86pdb%e6%9c%aa%e6%ad%a3%e5%b8%b8open.html" rel="bookmark" class="crp_title">ORACLE 12C redo异常恢复测试&#8212;部分pdb未正常open</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2014/03/oracle-12c-%e6%8e%a7%e5%88%b6%e6%96%87%e4%bb%b6%e5%bc%82%e5%b8%b8%e6%81%a2%e5%a4%8d.html" rel="bookmark" class="crp_title">ORACLE 12C 控制文件异常恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2014/03/oracle-12c-redo%e5%bc%82%e5%b8%b8%e6%81%a2%e5%a4%8d%e6%b5%8b%e8%af%95-%e6%89%93%e4%b8%8apatch%e6%81%a2%e5%a4%8d%e5%ae%8c%e5%85%a8.html" rel="bookmark" class="crp_title">ORACLE 12C redo异常恢复测试—打上patch恢复完全</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2020/11/19c-pdb-undo-lost-recovery.html" rel="bookmark" class="crp_title">模拟19c数据库pdb undo异常恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2023/10/no-tns-login-pdb.html" rel="bookmark" class="crp_title">非tns方式登录pdb方法</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/06/oracle-12c-cdb%e4%b8%adpdb%e5%8f%82%e6%95%b0%e7%ae%a1%e7%90%86%e6%9c%ba%e5%88%b6.html" rel="bookmark" class="crp_title">ORACLE 12C CDB中PDB参数管理机制</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2020/11/19c-redo-lost-recovery.html" rel="bookmark" class="crp_title">模拟19c数据库redo异常恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/05/oracle-12c-pdb-%e7%ae%a1%e7%90%86%e4%bb%8b%e7%bb%8d1.html" rel="bookmark" class="crp_title">ORACLE 12C PDB 维护基础介绍</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/06/ora-38760-%e6%ad%a4%e6%95%b0%e6%8d%ae%e5%ba%93%e5%ae%9e%e4%be%8b%e6%97%a0%e6%b3%95%e5%90%af%e7%94%a8%e9%97%aa%e5%9b%9e%e6%95%b0%e6%8d%ae%e5%ba%93.html" rel="bookmark" class="crp_title">ORA-38760: 此数据库实例无法启用闪回数据库</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/10/ora-65101-container-database-set-up-incorrectly.html" rel="bookmark" class="crp_title">ORA-65101 container database set up incorrectly</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2019/06/ora-01092-ora-00704-ora-00600-16703.html" rel="bookmark" class="crp_title">ORA-00600: internal error code, arguments: [16703], [1403], [32]</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/08/4629.html" rel="bookmark" class="crp_title">pdb正常运行丢失数据文件相关恢复</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2014/11/%e8%ae%be%e7%bd%aepdb%e9%9a%8fcdb%e4%b8%80%e8%b5%b7%e5%90%af%e5%8a%a8.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
