{"id":619,"date":"2024-05-04T09:04:12","date_gmt":"2024-05-04T01:04:12","guid":{"rendered":"http:\/\/www.821121.com\/?p=619"},"modified":"2024-05-17T11:19:37","modified_gmt":"2024-05-17T03:19:37","slug":"append%e4%b8%8enologging%e5%af%b9%e7%9a%84redo%e6%97%a5%e5%bf%97%e5%a4%a7%e5%b0%8f%e7%9a%84%e5%bd%b1%e5%93%8d","status":"publish","type":"post","link":"http:\/\/www.821121.com\/?p=619","title":{"rendered":"append\u4e0enologging\u5bf9\u7684redo\u65e5\u5fd7\u5927\u5c0f\u7684\u5f71\u54cd"},"content":{"rendered":"<h1>\u7ed3\u8bba<\/h1>\n<p>\u76f4\u63a5\u5148\u628a\u7ed3\u8bba\u5199\u5728\u4e0b\u9762\uff1a<\/p>\n<h2>\u4e00\u3001\u63d2\u5165\u6570\u636e\uff1a<\/h2>\n<h3>1\u3001\u975e\u5f52\u6863\u6a21\u5f0f\u4e0b<\/h3>\n<pre><code class=\"language-sql\">create     insert     append append+nologging  nologging\n---------- ---------- ---------- ---------------- ----------\n    110276     759944       2632             1004     752772<\/code><\/pre>\n<p>\u7ed3\u8bba\uff1aappend+nologging \u7684\u65e5\u5fd7\u91cf\u6700\u5c0f\u3002<\/p>\n<h3>2\u3001\u5f52\u6863\u6a21\u5f0f\u4e0b<\/h3>\n<pre><code class=\"language-sql\">    create     insert     append append+nologging  nologging\n---------- ---------- ---------- ---------------- ----------\n    874812     760320     784092           782508     752816<\/code><\/pre>\n<p>\u7ed3\u8bba\uff1a\u5dee\u522b\u4e0d\u5927\uff0cnologging \u6700\u5c0f\u3002\u7528\u4e0d\u7528\u5dee\u4e0d\u591a\u3002<br \/>\n(<strong>\u540e\u6765\u9a8c\u8bc1\uff0c\u5148alter table nologging \u7136\u540e\u518dinsert \/<em>+ append<\/em>\/\uff0c\u80fd\u6709\u6548\u964d\u4f4eREDO\u5927\u5c0f\uff0c\u5fd8\u8bb0\u8bb0\u5f55\u4e86\uff0c\u5927\u5bb6\u53ef\u4ee5\u81ea\u5df1\u505a\u4e2a\u5b9e\u9a8c\u9a8c\u8bc1\u4e00\u4e0b<\/strong>)<\/p>\n<h2>\u4e8c\u3001\u521b\u5efa\u7d22\u5f15\uff08\u975e\u5f52\u6863\uff09<\/h2>\n<pre><code class=\"language-sql\">SQL&gt;  select (930388-656600) nologging ,(625448-349940) logging from dual;\n\n NOLOGGING    LOGGING\n---------- ----------\n    273788     275508<\/code><\/pre>\n<p>nologging \u4f1a\u5feb\u4e00\u70b9\uff0c\u5e76\u4e0d\u591a\u3002\u65e5\u5fd7\u5dee\u4e0d\u591a\u3002<\/p>\n<h2>\u4e09\u3001\u8868\u7a7a\u95f4nologging\uff08\u975e\u5f52\u6863\uff09<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; select (886316-99060),(1699944-912444) from dual;\n\n(886316-99060) (1699944-912444)\n-------------- ----------------\n        787256           787500<\/code><\/pre>\n<p>nologging\u6ca1\u6709\u4f5c\u7528<\/p>\n<h1>\u5b9e\u9a8c\u5185\u5bb9\uff1a<\/h1>\n<pre><code class=\"language-sql\">Release 11.2.0.1.0 Production on Thu Jul 14 18:11:12 2016<\/code><\/pre>\n<h2>1\u3001\u975e\u5f52\u6863\u6a21\u5f0f<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; select a.name,b.value\nfrom v$statname a,v$mystat b\nwhere a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;  2    3  \n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                                 0\n\nSQL&gt; create table testredo as select * from dba_tables;\n\n?????\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            110276<\/code><\/pre>\n<pre><code class=\"language-sql\">insert into testredo select * from dba_tables;\ncommit;\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            870220\n<\/code><\/pre>\n<pre><code class=\"language-sql\">insert \/*+ append*\/ into testredo select * from dba_tables;\ncommit;\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            872852\n<\/code><\/pre>\n<pre><code class=\"language-sql\">insert \/*+ append nologging *\/ into testredo select * from dba_tables;\ncommit;\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            873856\n<\/code><\/pre>\n<pre><code class=\"language-sql\">insert \/*+ nologging *\/ into testredo select * from dba_tables;\ncommit;\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;; \n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                           1626628<\/code><\/pre>\n<pre><code class=\"language-sql\">\nselect (110276-0) &quot;create&quot; ,(870220-110276) &quot;insert&quot;,(872852-870220) &quot;append&quot;, (873856-872852) &quot;append nologging&quot;,(1626628-873856) &quot;nologging&quot; from dual;\n\n    create     insert     append append nologging  nologging\n---------- ---------- ---------- ---------------- ----------\n    110276     759944       2632             1004     752772<\/code><\/pre>\n<p>\u7ed3\u8bba\uff1aappend nologging \u6700\u5c0f\u3002<\/p>\n<h2>2\u3001\u5f52\u6863\u6a21\u5f0f<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;; \n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                                 0\n\nSQL&gt; create table testredo as select * from dba_tables;\n\n?????\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;; \n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            874812<\/code><\/pre>\n<pre><code class=\"language-sql\">SQL&gt; insert into testredo select * from dba_tables;\ncommit;\n???2729??\n\nSQL&gt; \n\n?????\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;; \n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                           1635132<\/code><\/pre>\n<pre><code class=\"language-sql\">SQL&gt; insert \/*+ append*\/ into testredo select * from dba_tables;\n\n???2729??\n\nSQL&gt; commit;\n\n?????\n\nSQL&gt;  select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                           2419224<\/code><\/pre>\n<pre><code class=\"language-sql\">SQL&gt; insert \/*+ append nologging *\/ into testredo select * from dba_tables;\ncommit;\n\n???2729??\n\nSQL&gt; \n?????\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                           3201732<\/code><\/pre>\n<pre><code class=\"language-sql\">SQL&gt; insert \/*+ nologging *\/ into testredo select * from dba_tables;\n\n???2729??\n\nSQL&gt; commit;\n\n?????\n\nSQL&gt; select a.name,b.value\n  2  from v$statname a,v$mystat b\n  3  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;; \n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                           3954548<\/code><\/pre>\n<pre><code class=\"language-sql\">\nselect (874812-0) &quot;create&quot; ,(1635132-874812) &quot;insert&quot;,(2419224-1635132) &quot;append&quot;, (3201732-2419224) &quot;append nologging&quot;,(3954548-3201732) &quot;nologging&quot;,(6241544-5491240) &quot;nologging append&quot;  from dual;\n6241544\n\n    create     insert     append append nologging  nologging\n---------- ---------- ---------- ---------------- ----------\n    874812     760320     784092           782508     752816<\/code><\/pre>\n<pre><code>\u7ed3\u8bba\uff1anologging \u6700\u5c0f\uff0c\u518d\u6b21\u6d4b\u8bd5\u7ed3\u679c\u5dee\u4e0d\u591a\u3002<\/code><\/pre>\n<h2>3\u3001\u7d22\u5f15\u7684nologging\u7684\u4f5c\u7528<\/h2>\n<h3>\u975e\u5f52\u6863\u6a21\u5f0f\u4e0b<\/h3>\n<pre><code class=\"language-sql\">Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production\nWith the Partitioning, OLAP, Data Mining and Real Application Testing options\n\nSQL&gt;  select a.name,b.value from v$statname a,v$mystat b  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                                 0\n\nSQL&gt; set timing on;\nSQL&gt; create table testredo as select * from tt;\n\n?????\n\n????:  00: 00: 05.89\nSQL&gt; select a.name,b.value from v$statname a,v$mystat b  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            349940\n\n????:  00: 00: 00.01\n\nSQL&gt;  create index inx_t1 on testredo (OBJECT_ID);\n\n??????\n\n????:  00: 00: 07.46\nSQL&gt;  select a.name,b.value from v$statname a,v$mystat b  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            625448\n\n????:  00: 00: 00.00\nSQL&gt; drop index inx_t1;\n\n??????\n\n????:  00: 00: 00.07\nSQL&gt;  select a.name,b.value from v$statname a,v$mystat b  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            656600\n\n????:  00: 00: 00.01\nSQL&gt; create index inx_t1 on testredo (OBJECT_ID) nologging;\n\n??????\n\n????:  00: 00: 06.94\nSQL&gt; select a.name,b.value from v$statname a,v$mystat b  where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME                                                                  VALUE\n---------------------------------------------------------------- ----------\nredo size                                                            930388\n\n????:  00: 00: 00.00\n\nSQL&gt;  select (930388-656600) nologging ,(625448-349940) logging from dual;\n\n NOLOGGING    LOGGING\n---------- ----------\n    273788     275508<\/code><\/pre>\n<p>\u521b\u5efa\u7d22\u5f15\u7528nologging \u53ea\u6709\u5f88\u5c0f\u7684\u6539\u5584\uff08\u5b9e\u4f8b\u662f\u7528460\u4e07\u7684\u6570\u636e\u8fdb\u884c\u7684\u5b9e\u9a8c\uff09\u3002<\/p>\n<h2>\u4e09\u3001\u8868\u7a7a\u95f4nologging<\/h2>\n<p>\u8868\u7a7a\u95f4nologging <\/p>\n<pre><code class=\"language-sql\">SQL&gt; alter tablespace users logging;\n\nTablespace altered.\n\nSQL&gt;  create table testredo  tablespace users  as select * from dba_tables where 1&gt;3;\n\nSQL&gt; select a.name,b.value from v$statname a,v$mystat b where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME            VALUE\n---------- ----------\nredo size       99060\n\nSQL&gt; insert into testredo select * from dba_tables;\n\n2740 rows created.\n\nSQL&gt; commit;\n\nCommit complete.\n\nSQL&gt; select a.name,b.value from v$statname a,v$mystat b where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME            VALUE\n---------- ----------\nredo size      886316\n\nSQL&gt; alter tablespace users nologging;\n\nTablespace altered.\n\nSQL&gt; insert into testredo select * from dba_tables;\n\n2740 rows created.\n\nSQL&gt; commit;\n\nCommit complete.\n\nSQL&gt; select a.name,b.value from v$statname a,v$mystat b where a.statistic#=b.statistic# and a.name=&#039;redo size&#039;;\n\nNAME            VALUE\n---------- ----------\nredo size     1699944\n\nSQL&gt; select (886316-99060),(1699944-912444) from dual;\n\n(886316-99060) (1699944-912444)\n-------------- ----------------\n        787256           787500\n\nSQL&gt; select log_mode from v$database;\n\nLOG_MODE\n------------------------------------\nNOARCHIVELOG<\/code><\/pre>\n<p>\u7ed3\u8bba\uff0c\u6ca1\u6709\u4f5c\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed3\u8bba \u76f4\u63a5\u5148\u628a\u7ed3\u8bba\u5199\u5728\u4e0b\u9762\uff1a \u4e00\u3001\u63d2\u5165\u6570\u636e\uff1a 1\u3001<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-oracle-11g"],"_links":{"self":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=619"}],"version-history":[{"count":3,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":622,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions\/622"}],"wp:attachment":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}