<span style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;"><b style="background-color:inherit;"><span style="background-color:inherit;font-size:medium;">一. 官网说明</span></b></span><br style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;" />
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<p style="background-color:inherit;">
<span style="background-color:inherit;"><b style="background-color:inherit;"><span style="background-color:inherit;"><span style="background-color:inherit;">Logical Storage Structures</span></span><span style="background-color:inherit;"> </span></b></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;"><span style="background-color:inherit;">其中有关ASSM 的内容如下:</span></span>
</p>
</div>
<div style="white-space:normal;widows:auto;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:13px;line-height:1.8;background-color:#F5F5F5;">
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;font-size:12pt;line-height:1.8;"><span style="line-height:1.8;background-color:inherit;"></span></span>
</p>
<h4 style="font-size:16px;background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:medium;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Logical Space Management</span></span></span>
</h4>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Oracle Database must use<span style="background-color:inherit;"> </span><strong style="background-color:inherit;">logical space management</strong><span style="background-color:inherit;"> </span>to track and allocate the extents in a tablespace. When a database object requires an extent, the database must have a method of finding and providing it. Similarly, when an object no longer requires an extent, the database must have a method of making the free extent available.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">Oracle Databa</span><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">se manages space within a tablespace based on the type that you create. You can create either of the following types of tablespaces:</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Symbol;font-size:10pt;line-height:1.8;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Locally managed tablespaces (default)</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">The database uses bitmaps in the tablespaces themselves to manage extents. Thus, locally managed tablespaces have a part of the tablespace set aside for a bitmap. Within a tablespace, the database can manage segments with<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><strong style="background-color:inherit;">automatic segment space management (ASSM)</strong></span><span style="background-color:inherit;"> </span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">or<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><strong style="background-color:inherit;">manual segment space management (MSSM)</strong></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Symbol;font-size:10pt;line-height:1.8;background-color:inherit;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Dictionary-managed tablespaces</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">The database uses the<span style="background-color:inherit;"> </span></span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/glossary.htm#CHDJJJGD" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#003399;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">data dictionary</span></span></a><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>to manage extents (see<span style="background-color:inherit;"> </span></span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/datadict.htm#i1012" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#0000FF;font-family:宋体;font-size:small;line-height:1.8;">"Overview of the Data Dictionary"</span></a><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">).</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/logical.htm#BABDJBGD" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#0000FF;font-family:宋体;font-size:small;line-height:1.8;">Figure 12-3</span></a><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;"> </span>shows the alternatives for logical space management in a tablespace.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><strong style="background-color:inherit;"><em style="background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Figure 12-3 Logical Space Management<br />
<img src="/attachment/201510/13/30208428_1444744363SAZY.gif" width="451" height="181" alt="" /></span></span></em></strong></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><img src="file://D:/%E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0/%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95/zr2095@163.com/057aa1fe78c244fe87181267ee85c38f/04934118i922.gif" data-media-type="image" data-attr-org-src-id="33B54179DE834BEEA5EEE4A0C3ED479C" data-attr-org-img-file="file:///D:/%E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0/%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95/zr2095@163.com/057aa1fe78c244fe87181267ee85c38f/04934118i922.gif" style="background-color:inherit;cursor:default;display:inline-block;margin-top:8px;max-width:800px;" /><br style="background-color:inherit;" />
<a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/img_text/cncpt268.htm" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;color:#0000FF;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Description of "Figure 12-3 Logical Space Management"</span></span></span></a></span>
</p>
<h5 style="background-color:inherit;font-size:14px;">
<span style="background-color:inherit;font-family:Tahoma, sans-serif;font-size:14pt;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Locally Managed Tablespaces</span></span>
</h5>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">A locally managed tablespace<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">maintains a bitmap in the data file header to track free and used space in the data file body</span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">. Each bit corresponds to a group of blocks. When space is allocated or freed, Oracle Database changes the bitmap values to reflect the new status of the blocks.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">The following graphic is a conceptual representation of bitmap-managed storage. A<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">1</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>in the header refers to used space, whereas a<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">0</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;"> </span>refers to free space.<br />
<img src="/attachment/201510/13/30208428_1444744504B8TM.gif" width="633" height="332" alt="" /></span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><img src="file://D:/%E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0/%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95/zr2095@163.com/8ee0499171524680ad495f8edfa56674/049341258bpp.gif" data-media-type="image" data-attr-org-src-id="D0BFE5097E49426DB272DC1F2FE07435" data-attr-org-img-file="file:///D:/%E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0/%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95/zr2095@163.com/8ee0499171524680ad495f8edfa56674/049341258bpp.gif" style="background-color:inherit;cursor:default;display:inline-block;margin-top:8px;max-width:800px;" /></span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">A locally managed tablespace has the following advantages:</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Symbol;font-size:10pt;line-height:1.8;background-color:inherit;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Avoids using the data dictionary to manage extents</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Recursive operations can occur in dictionary-managed tablespaces if consuming or releasing space in an extent results in another operation that consumes or releases space in a data dictionary table or undo segment.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Symbol;font-size:10pt;line-height:1.8;background-color:inherit;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Tracks adjacent free space automatically</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">In this way, the database eliminates the need to coalesce free extents.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Symbol;font-size:10pt;line-height:1.8;background-color:inherit;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Determines the size of locally managed extents automatically</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Alternatively, all extents can have the same size in a locally managed tablespace and override object storage options.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><strong style="background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Note:</span></span></strong></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Oracle strongly recommends the use of locally managed tablespaces with Automatic Segment Space Management.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><strong style="background-color:inherit;">Segment space management</strong></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;"> </span>is an attribute inherited from the tablespace that contains the segment. Within a locally managed tablespace, the database can manage segments automatically or manually. For example, segments in tablespace<span style="background-color:inherit;"> </span></span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">users</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>can be managed automatically while segments in tablespace<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">tools</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;"> </span>are managed manually.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="color:#000000;font-size:15pt;line-height:1.8;"><span style="font-family:宋体;line-height:1.8;color:#000000;"><strong>Automatic Segment Space Management</strong></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">The ASSM method uses bitmaps to manage space. Bitmaps provide the following advantages:</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Symbol;font-size:10pt;line-height:1.8;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Simplified administration</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">ASSM avoids the need to manually determine correct settings for many storage parameters.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">Only one crucial SQL parameter controls space allocation:<span style="background-color:inherit;"> </span></span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">PCTFREE</span></code><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">.<span style="background-color:inherit;"> </span></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">This parameter specifies the percentage of space to be reserved in a block for future updates (see<span style="background-color:inherit;"> </span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/logical.htm#BABBAJHC" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#0000FF;line-height:1.8;">"Percentage of Free Space in Data Blocks"</span></a>).</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">ASSM<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;line-height:1.8;">管理,只需要一个参数:</span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">PCTFREE</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Symbol;font-size:10pt;line-height:1.8;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Increased concurrency</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">Multiple<span style="background-color:inherit;"> </span></span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/glossary.htm#CHDJEBHA" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#003399;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">transactions</span></span></a><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;"> </span>can search separate lists of free data blocks, thereby reducing contention and waits. For many standard workloads, application performance with ASSM is better than the performance of a well-tuned application that uses MSSM.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Symbol;font-size:10pt;line-height:1.8;background-color:inherit;">·<span style="font-family:'Times New Roman';font-size:7pt;background-color:inherit;"> <span style="background-color:inherit;"> </span></span></span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;">Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">ASSM is more efficient and is the default for permanent, locally managed tablespaces.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><strong style="background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Note:</span></span></strong></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">This chapter assumes the use of ASSM in all of its discussions of logical storage space.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"> </span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:15pt;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><b style="background-color:inherit;">Manual Segment Space Management</b></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">The legacy MSSM method<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">uses a linked list called a<span style="background-color:inherit;"> </span><strong style="background-color:inherit;">free list</strong><span style="background-color:inherit;"> </span>to manage free space in the segment</span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">. For a database object that has free space, a free list keeps track of blocks under the<span style="background-color:inherit;"> </span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/glossary.htm#CHDIJHII" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#003399;line-height:1.8;">high water mark</span></a><span style="background-color:inherit;"> </span>(HWM), which is the dividing line between segment space that is used and not yet used. As blocks are used, the database puts blocks on or removes blocks from the free list as needed.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">In addition to<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">PCTFREE</span></code><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">, MSSM requires you to control space allocation with SQL parameters such as<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">PCTUSED</span></code><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">,<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">FREELISTS</span></code><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">, and<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">FREELIST GROUPS</span></code><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">.</span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTUSED</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>sets the percentage of free space that must exist in a currently used block for the database to put it on the free list. For example, if you set</span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTUSED</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>to<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">40</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>in a<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">CREATE TABLE</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;"> </span>statement, then you cannot insert rows into a block in the segment until less than 40% of the block space is used.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">As an illustration, suppose you insert a row into a table. The database checks a free list of the table for the first available block. If the row cannot fit in the block, and if the used space in the block is greater than or equal to<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTUSED</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">, then the database takes the block off the list and searches for another block. If you delete rows from the block, then the database checks whether used space in the block is now less than<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTUSED</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">. If so, then the database places the block at the beginning of the free list.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">An object may have multiple free lists. In this way, multiple sessions performing DML on a table can use different lists, which can reduce contention. Each database session uses only one free list for the duration of its session.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">As shown in<span style="background-color:inherit;"> </span></span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/logical.htm#BABJABGH" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#0000FF;font-family:宋体;font-size:small;line-height:1.8;">Figure 12-4</span></a><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">, you can also create an object with one or more<span style="background-color:inherit;"> </span><strong style="background-color:inherit;">free list groups</strong>, which are collections of free lists. Each group has a<span style="background-color:inherit;"> </span><strong style="background-color:inherit;">master free list</strong><span style="background-color:inherit;"> </span>that manages the individual<span style="background-color:inherit;"> </span><strong style="background-color:inherit;">process free lists</strong><span style="background-color:inherit;"> </span>in the group. Space overhead for free lists, especially for free list groups, can be significant.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><strong style="background-color:inherit;"><em style="background-color:inherit;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Figure 12-4 Free List Groups<br />
<img src="/attachment/201510/13/30208428_1444744426N32P.gif" width="323" height="275" alt="" /><br />
</span></span></em></strong></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><img src="file://D:/%E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0/%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95/zr2095@163.com/5534672ca11440319f1ff7c414e940dd/04934130k9ex.gif" data-media-type="image" data-attr-org-src-id="C05DADD0BEBD4277841C477F77662550" data-attr-org-img-file="file:///D:/%E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0/%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95/zr2095@163.com/5534672ca11440319f1ff7c414e940dd/04934130k9ex.gif" style="background-color:inherit;cursor:default;display:inline-block;margin-top:8px;max-width:800px;" /><br style="background-color:inherit;" />
<a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/img_text/cncpt320.htm" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;color:#0000FF;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">Description of "Figure 12-4 Free List Groups"</span></span></span></a></span>
</p>
<p style="background-color:inherit;">
<span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">Managing segment space manually can be complex. You must adjust<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTFREE</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>and<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTUSED</span></code><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>to reduce row migration (see<span style="background-color:inherit;"> </span></span><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/logical.htm#BABEEAAE" style="background-color:inherit;cursor:pointer;color:navy;"><span style="background-color:inherit;color:#0000FF;font-family:宋体;font-size:small;line-height:1.8;">"Chained and Migrated Rows"</span></a><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;">) and avoid wasting space. For example, if every used block in a segment is half full, and if<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="font-size:13pt;line-height:1.8;background-color:inherit;">PCTUSED</span></code><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;"> </span>is 40, then the database does not permit inserts into any of these blocks. Because of the difficulty of fine-tuning space allocation parameters, Oracle strongly recommends ASSM.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">In ASSM,<span style="background-color:inherit;"> </span></span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">PCTFREE</span></code><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;font-size:small;line-height:1.8;"><span style="background-color:inherit;"> </span>determines whether a new row can be inserted into a block, but it does not use free lists and ignores<span style="background-color:inherit;"> </span></span></span><code style="font-family:Monaco, Consolas, Courier, 'Lucida Console', monospace;background-color:inherit;"><span style="background-color:inherit;color:red;font-size:13pt;line-height:1.8;">PCTUSED</span></code><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;">.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">-- ASSM<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;line-height:1.8;">会忽略</span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">PCTUSED<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;line-height:1.8;">参数</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:16pt;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><b style="background-color:inherit;">Dictionary-Managed Tablespaces</b></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">A dictionary-managed tablespace uses the data dictionary to manage its extents.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;">Oracle Database updates tables in the data dictionary whenever an extent is allocated or freed for reuse.</span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;"> </span>For example, when a table needs an extent, the database queries the data dictionary tables, and searches for free extents. If the database finds space, then it modifies one data dictionary table and inserts a row into another. In this way, the database manages space by modifying and moving data.</span></span></span>
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-size:small;line-height:1.8;"><span style="background-color:inherit;font-family:宋体;line-height:1.8;"><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;">The SQL that the database executes in the background to obtain space for database objects is<span style="background-color:inherit;"> </span><strong style="background-color:inherit;">recursive SQL</strong>.</span><span style="background-color:inherit;color:red;font-family:Tahoma, sans-serif;line-height:1.8;"><span style="background-color:inherit;"> </span>Frequent use of recursive SQL can have a negative impact on performance because updates to the data dictionary must be serialized.</span><span style="font-family:Tahoma, sans-serif;line-height:1.8;background-color:inherit;"><span style="background-color:inherit;"> </span>Locally managed tablespaces, which are the default, avoid this performance problem.</span></span></span>
</p>
<p style="background-color:inherit;">
<br />
</p>
<p style="background-color:inherit;">
<span style="background-color:inherit;font-family:宋体;line-height:1.8;"><b style="background-color:inherit;"><span style="font-size:14pt;line-height:1.8;background-color:inherit;"></span></b></span>
</p>
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<p style="background-color:inherit;">
<span style="background-color:inherit;"><span style="background-color:inherit;"><span style="background-color:inherit;font-size:medium;"><b style="background-color:inherit;"><span style="background-color:inherit;">二</span><span style="background-color:inherit;">. ASSM<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">说明</span></b></span></span></span>
</p>
</div>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><span style="background-color:inherit;"> 在</span><span style="background-color:inherit;">Orale 9i</span><span style="background-color:inherit;">以前,表的剩余空间的管理与分配都是由链接列表</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">来完成的,因为</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">存在串行的问题因此容易引起往往容易引起段头的争用与空间的浪费(其实这一点并不明显),最主要的还是因为需要</span><span style="background-color:inherit;">DBA<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">花费大量的精力去管理这些争用并监控表的空间利用。</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
</span></span><span style="background-color:inherit;line-height:1.5;"> 自动段空间管理(</span><span style="background-color:inherit;line-height:1.5;">ASSM</span><span style="background-color:inherit;line-height:1.5;">),它首次出现在</span><span style="background-color:inherit;line-height:1.5;">Oracle 920</span><span style="background-color:inherit;line-height:1.5;">里。有了</span><span style="background-color:inherit;line-height:1.5;">ASSM</span><span style="background-color:inherit;line-height:1.5;">,链接列表</span><span style="background-color:inherit;line-height:1.5;">freelist</span><span style="background-color:inherit;line-height:1.5;">被</span><span style="background-color:inherit;line-height:1.5;">位图</span><span style="background-color:inherit;line-height:1.5;">所取代,</span><span style="background-color:inherit;line-height:1.5;">它是一个二进制的数组</span><span style="background-color:inherit;line-height:1.5;">,能够迅速有效地管理存储扩展和剩余区块(</span><span style="background-color:inherit;line-height:1.5;">free block</span><span style="background-color:inherit;line-height:1.5;">),因此能够改善分段存储本质,</span><span style="background-color:inherit;line-height:1.5;">ASSM</span><span style="background-color:inherit;line-height:1.5;">表空间上创建的段还有另外一个称呼叫</span><span style="background-color:inherit;line-height:1.5;">Bitmap Managed Segments</span><span style="background-color:inherit;line-height:1.5;">(</span><span style="background-color:inherit;line-height:1.5;">BMB </span><span style="background-color:inherit;line-height:1.5;">段)。</span><span style="background-color:inherit;line-height:1.5;"> </span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><br style="background-color:inherit;" />
</span><span style="background-color:inherit;"><span style="background-color:inherit;">让我们看看位图</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">是如何实现的。从使用区段空间管理自动参数创建</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">开始:</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
create tablespace demo <br style="background-color:inherit;" />
datafile '/ora01/oem/demo01.dbf ' <br style="background-color:inherit;" />
size 5m <br style="background-color:inherit;" />
EXTENT MANAGEMENT LOCAL -- Turn on LMT <br style="background-color:inherit;" />
SEGMENT SPACE MANAGEMENT AUTO -- Turn on ASSM; <br style="background-color:inherit;" />
<br style="background-color:inherit;" />
</span></span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><span style="background-color:inherit;"> 一旦你定义好了</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">,那么表和索引就能够使用各种方法很容易地被移动到新的</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">里,</span><span style="background-color:inherit;">带有</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">的本地管理</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">会略掉任何为</span><span style="background-color:inherit;">PCTUSED</span><span style="background-color:inherit;">、</span><span style="background-color:inherit;">NEXT</span><span style="background-color:inherit;">和</span><span style="background-color:inherit;">FREELISTS</span><span style="background-color:inherit;">所指定的值</span><span style="background-color:inherit;">。</span><span style="background-color:inherit;"> </span></span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><span style="background-color:inherit;"> 当表格或者索引被分配到这个</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">以后,用于独立对象的</span><span style="background-color:inherit;">PCTUSED</span><span style="background-color:inherit;">的值会被忽略,而</span><span style="background-color:inherit;">Oracle9i</span><span style="background-color:inherit;">会使用位图数组来自动地管理</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">里表格和索引的</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">。对于在</span><span style="background-color:inherit;">LMT</span><span style="background-color:inherit;">的</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">内部创建的表格和索引而言,这个</span><span style="background-color:inherit;">NEXT</span><span style="background-color:inherit;">扩展子句是过时的</span><span style="background-color:inherit;">,因为由本地管理的</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">会管理它们。但是,</span><span style="background-color:inherit;">INITIAL</span><span style="background-color:inherit;">参数仍然是需要的</span><span style="background-color:inherit;">,因为</span><span style="background-color:inherit;">Oracle</span><span style="background-color:inherit;">不可能提前知道初始表格加载的大小</span><span style="background-color:inherit;">。对于</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">而言,</span><span style="background-color:inherit;">INITIAL</span><span style="background-color:inherit;">最小的值是三个块</span><span style="background-color:inherit;">。</span><span style="background-color:inherit;"> </span></span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><br style="background-color:inherit;" />
</span><span style="background-color:inherit;"><span style="background-color:inherit;"> 新的管理机制用位图来跟踪或管理每个分配到对象的块,每个块有多少剩余空间根据位图的状态来确定,如</span><span style="background-color:inherit;">>75%,50%-75%,25%-50%</span><span style="background-color:inherit;">和</span><span style="background-color:inherit;"><25%</span><span style="background-color:inherit;">,也就是说</span><span style="background-color:inherit;">位图其实采用了四个状态位来代替以前的</span><span style="background-color:inherit;">pctused</span><span style="background-color:inherit;">,什么时候该利用该数据块则由设定的</span><span style="background-color:inherit;">pctfree</span><span style="background-color:inherit;">来确定。</span><span style="background-color:inherit;"> </span></span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><br style="background-color:inherit;" />
</span><span style="background-color:inherit;"><span style="background-color:inherit;"> 使用</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">的一个</span><span style="background-color:inherit;"><span style="background-color:inherit;">巨大优势</span></span><span style="background-color:inherit;">是,</span><span style="background-color:inherit;">位图</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">肯定能够减轻缓冲区忙等待</span><span style="background-color:inherit;">(</span><span style="background-color:inherit;">buffer busy wait</span><span style="background-color:inherit;">)的负担,这个问题在</span><span style="background-color:inherit;">Oracle9i</span><span style="background-color:inherit;">以前的版本里曾是一个严重的问题</span> <span style="background-color:inherit;">。</span> </span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><br style="background-color:inherit;" />
</span><span style="background-color:inherit;"><span style="background-color:inherit;"> 在没有多个</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">的时候</span><span style="background-color:inherit;">,每个</span><span style="background-color:inherit;">Oracle</span><span style="background-color:inherit;">表格和索引在表格的头部都曾有一个数据块,用来管理对象所使用的剩余区块,并为任何</span><span style="background-color:inherit;">SQL</span><span style="background-color:inherit;">插入声明所创建的新数据行提供数据块。当数据缓冲内的数据块由于被另一个</span><span style="background-color:inherit;">DML</span><span style="background-color:inherit;">事务处理锁定而无法使用的时候,缓冲区忙等待就会发生。当你需要将多个任务插入到同一个表格里的时候,这些任务就被强制等待,而同时</span><span style="background-color:inherit;">Oracle</span><span style="background-color:inherit;">会在同时分派剩余的区块,一次一个。</span><span style="background-color:inherit;"> </span></span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><br style="background-color:inherit;" />
</span><span style="background-color:inherit;"><span style="background-color:inherit;"> 有了</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">之后,</span><span style="background-color:inherit;">Oracle</span><span style="background-color:inherit;">宣称<span style="background-color:inherit;">显著</span>地提高了</span><span style="background-color:inherit;">DML</span><span style="background-color:inherit;">并发操作的性能</span><span style="background-color:inherit;">,</span><span style="background-color:inherit;">因为</span><span style="background-color:inherit;">(同一个)位图的不同部分可以被同时使用,这样就消除了寻找剩余空间的串行化。根据</span><span style="background-color:inherit;">Oracle</span><span style="background-color:inherit;">的测试结果,使用位图</span><span style="background-color:inherit;">freelist</span><span style="background-color:inherit;">会消除所有分段头部(对资源)的争夺,还能获得超快的并发插入操作</span> </span>
</p>
<p style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<span style="background-color:inherit;"><br style="background-color:inherit;" />
</span><span style="background-color:inherit;"><span style="background-color:inherit;"> 尽管</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">显示出了令人激动的特性并能够简化</span><span style="background-color:inherit;">Oracle DBA</span><span style="background-color:inherit;">的工作,但是</span><span style="background-color:inherit;">Oracle9i</span><span style="background-color:inherit;">的位图分段管理还是有一些局限性</span><span style="background-color:inherit;">的:</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
1.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">一旦</span><span style="background-color:inherit;">DBA</span><span style="background-color:inherit;">被分配之后,它就无法控制</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">内部的独立表格和索引的存储行为。</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
2.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">大型对象不能够使用</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">,而且必须为包含有</span><span style="background-color:inherit;">LOB</span><span style="background-color:inherit;">数据类型的表格创建分离的</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">。</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
3.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">你不能够使用</span><span style="background-color:inherit;">ASSM</span><span style="background-color:inherit;">创建临时的</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">。这是由排序时临时分段的短暂特性所决定的。</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
4.<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">只有本地管理的</span><span style="background-color:inherit;">tablespace</span><span style="background-color:inherit;">才能够使用位图分段管理。</span></span><span style="background-color:inherit;"><span style="background-color:inherit;"> <br style="background-color:inherit;" />
5·<span style="background-color:inherit;"> </span></span><span style="background-color:inherit;">使用超高容量的</span><span style="background-color:inherit;">DML</span><span style="background-color:inherit;">(例如</span><span style="background-color:inherit;">INSERT</span><span style="background-color:inherit;">、</span><span style="background-color:inherit;">UPDATE</span><span style="background-color:inherit;">和</span><span style="background-color:inherit;">DELETE</span><span style="background-color:inherit;">等)的时候可能会出现性能上的问题。</span></span>
</p>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<br style="background-color:inherit;" />
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<b style="background-color:inherit;"><span style="background-color:inherit;font-size:medium;">三、表空间的更改</span></b>
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<br style="background-color:inherit;" />
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
有时候我们创建了我们想要的表空间,但是计划是赶不上变化的,比如你的数据数据越来越多,原来的表空间容纳不下了,怎么办?或者你想把你的表空间变为只读,或者你想让你的有空间自己扩展大小,变手工为自动,等等,这些我们都可以利用ORACLE 的ALTER TABLESPACE 来完成。
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
最先看本地管理表空间(locally managed tablespace)
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<br style="background-color:inherit;" />
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
关于表空间,不能更改的内容:
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
1. 不能把永久表空间变为临时表空间;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
2. 不能改变表空间的segment管理方式。
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
可以更改的内容:
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
1. 增加数据文件,DATAFILE
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
2. 改变表空间的可用性,online与offline
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
a) ALTER TABLESPACE lmtemp TEMPFILE OFFLINE;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
b) ALTER TABLESPACE lmtemp TEMPFILE ONLINE;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
3. 改变表空间的属性,read/write only
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
4. 更改数据文件的名字,启动或禁止数据文件的自动扩展功能。
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
大表空间(bigfile tablespace)
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
1. resize:<span style="background-color:inherit;line-height:1.5;">ALTER TABLESPACE XXX RESIZE 80G</span>
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
2. autoextend:<span style="background-color:inherit;line-height:1.5;"> ALTER TABLESPACE XXX QUTOEXEND ON NEXT 20G</span>
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
<br style="background-color:inherit;" />
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
本地临时表空间
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
1.增加临时文件
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER TABLESPACE lmtemp
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ADD TEMPFILE '/u02/oracle/data/lmtemp02.dbf' SIZE 18M REUSE;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
2.改变可用性,不可以让一个临时表空间离线,但可以让临时文件离线
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' OFFLINE;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' ONLINE;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
3.改变临时文件的大小
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' RESIZE 18M;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
4.干掉临时数据文件
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' DROP <span style="background-color:inherit;line-height:1.5;"> INCLUDING DATAFILES;</span>
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
5.压缩临时表空间
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
先说说操作
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER TABLESPACE lmtemp1 SHRINK SPACE KEEP 20M;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER TABLESPACE lmtemp2 SHRINK TEMPFILE <span style="background-color:inherit;line-height:1.5;"> '/u02/oracle/data/lmtemp02.dbf';</span>
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
KEEP 保持指定大小,如果没有KEEP语句,则尽可能的减小。还是指定一个好。
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
为什么要执行这个操作?因为数据库在执行大的排序操作时,会占用很大的临时表空间,它会让临时表空间增大的,然而它也不很完全负责任,当它执行完命令后,他不会把增加的那部分空间归还给操作系统,它只把它标记为FREE可以重用。这样就会造成磁盘空间乱费,很可能以后那部分FREE空间一直FREE。
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
上面有针对性的说了一些各种类型表空间的更改方法,下面说一些共性的东西吧:
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
1.改名字用RENAME TO
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
ALTER TABLESPACE user RENAME TO newuser;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
2.删除表空间
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
DROP TABLESPACE users INCLUDING CONTENTS;
</div>
<div style="font-family:微软雅黑;font-size:14px;line-height:21px;white-space:normal;widows:auto;background-color:#FFFFFF;">
DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES;
</div>