<?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>OS与Oracle &#187; dbms_auto_task_admin</title>
	<atom:link href="http://www.os2ora.com/tag/dbms_auto_task_admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.os2ora.com</link>
	<description>专注于现实世界Oracle数据库的高性能，高可扩展性与新一代数据库Exadata架构</description>
	<lastBuildDate>Mon, 19 Sep 2011 09:10:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>自动化维护任务 &#8211; Automated Maintenance Task</title>
		<link>http://www.os2ora.com/automated-maintenance-task/</link>
		<comments>http://www.os2ora.com/automated-maintenance-task/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 10:08:07 +0000</pubDate>
		<dc:creator>Kaya</dc:creator>
				<category><![CDATA[Oracle管理与维护]]></category>
		<category><![CDATA[automated maintenance tasks]]></category>
		<category><![CDATA[automatic]]></category>
		<category><![CDATA[autostats_target]]></category>
		<category><![CDATA[dbms_auto_task_admin]]></category>
		<category><![CDATA[force]]></category>
		<category><![CDATA[resource plan]]></category>
		<category><![CDATA[resource_manager_plan]]></category>

		<guid isPermaLink="false">http://www.os2ora.com/automated-maintenance-task/</guid>
		<description><![CDATA[这是11g引入的一套新的自动化机制。Oracle的官方文档大而全，不过想理清楚里面的来龙去脉可不是一件容易的事情。 

不过下面几点知识要点是应该记住的。 
1. Oracle有三个已定义好的automated maintenance tasks.
2. 这些automated maintenace tasks在maintenance windows里得到执行。
3. 利用dbms_auto_task_admin进行配置。
4. 如何避免resource plan在进入maintenance windows时的切换......]]></description>
			<content:encoded><![CDATA[<p>Kaya 发表于 <a href="http://www.os2ora.com">os2ora.com</a></p>
<p>这是11g引入的一套新的自动化机制。Oracle的官方文档大而全，不过想理清楚里面的来龙去脉可不是一件容易的事情。</p>
<p>不过下面几点知识要点是应该记住的。<br />
1. Oracle有三个已定义好的automated maintenance tasks.</p>
<ol>
<li><strong>Automatic Optimizer Statistics Collection</strong>—用于收集各种数据库对象的统计信息。这里又有三种模式：
<ul>
<li>&#8216;ALL&#8217; &#8211; Statistics are collected for all objects in the system</li>
<li>&#8216;ORACLE&#8217; &#8211; Statistics are collected for all Oracle owned objects</li>
<li>&#8216;AUTO&#8217; &#8211; Oracle decides for which objects to collect statistics<br />
 </li>
<li>可以通过以下API进行设置

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">      DBMS_STATS<span style="color: #66cc66;">.</span>SET_GLOBAL_PREFS <span style="color: #66cc66;">&#40;</span>
        pname VARCHAR2<span style="color: #66cc66;">,</span>
        pval VARCHAR2<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>  pname为&#8221;AUTOSTATS_TARGET&#8221;，pval为以上三个值之一。</li>
</ul>
</li>
<li><strong>Automatic Segment Advisor</strong>—Identifies segments that have space available for reclamation, and makes recommendations on how to defragment those segments. You can also run the Segment Advisor manually to obtain more up-to-the-minute recommendations or to obtain recommendations on segments that the Automatic Segment Advisor did not examine for possible space reclamation.</li>
<li><strong>Automatic SQL Tuning Advisor</strong>—Examines the performance of high-load SQL statements, and makes recommendations on how to tune those statements. You can configure this advisor to automatically implement SQL profile recommendations.</li>
</ol>
<p>2. 这些automated maintenace tasks在maintenance windows里得到执行。同样，Oracle已经定义好的7个windows，对应每周的每一天。周一到周五是从22:00到次日的02:00，周六和周日是从06:00到次日的02:00。</p>
<p>3. 如果不想这些automated maintenance tasks在一些windows里不被执行，或者完全不希望执行这些tasks。可以通过下面的API。</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">DBMS_AUTO_TASK_ADMIN<span style="color: #66cc66;">.</span>DISABLE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>4. 对于maintenance windows，系统会切换到相应的resource plan。如果你不想你原来的resource plan 被切换掉的话，记得在你设置resource plan时，在resource plan的名字前面加上force:。如下面所示：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> SYSTEM <span style="color: #993333; font-weight: bold;">SET</span> RESOURCE_MANAGER_PLAN <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'FORCE:mydb_plan'</span>;</pre></div></div>

<p>自动化是个好东西，不过这建立上你正确理解了它们的基础上，要不有时就会出现莫名其妙的结果了。</p>
<p>举个简单的例子：如果你在某个时候truncate了一个表，之后重新加载了海量的数据，如果在你truncate后,加载数据之前，收集统计信息的任务启动了，那么它会把这个表的统计信息更新为空表的数据。于是，你的很多涉及到这个表的SQL语句就会莫名其妙的慢下来甚至于执行不完了，原因就在于统计信息的错误变化(海量-&gt;空)，导致CBO对很多语句从原来的索引访问者变成了致命的全表扫描了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.os2ora.com/automated-maintenance-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

