﻿{"id":1491,"date":"2019-05-08T10:51:53","date_gmt":"2019-05-08T02:51:53","guid":{"rendered":"http:\/\/www.llku.com\/?p=1491"},"modified":"2019-05-08T15:00:20","modified_gmt":"2019-05-08T07:00:20","slug":"oracle-db-scn%e6%83%85%e5%86%b5%e6%9f%a5%e8%af%a2","status":"publish","type":"post","link":"https:\/\/www.llku.com\/?p=1491","title":{"rendered":"Oracle DB scn\u60c5\u51b5\u67e5\u8be2"},"content":{"rendered":"<p>\n\t&#8211;1\u3001\u67e5\u8be2\u5f53\u524dscn\u60c5\u51b5\n<\/p>\n<p>\n\tselect version,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp;date_time,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp;dbms_flashback.get_system_change_number current_scn,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp;indicator<br \/>\n\t&nbsp; from (select version,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to_char(SYSDATE, &#39;YYYY\/MM\/DD HH24:MI:SS&#39;) DATE_TIME,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((((((to_number(to_char(sysdate, &#39;YYYY&#39;)) &#8211; 1988) * 12 * 31 * 24 * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((to_number(to_char(sysdate, &#39;MM&#39;)) &#8211; 1) * 31 * 24 * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(((to_number(to_char(sysdate, &#39;DD&#39;)) &#8211; 1)) * 24 * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(to_number(to_char(sysdate, &#39;HH24&#39;)) * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(to_number(to_char(sysdate, &#39;MI&#39;)) * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(to_number(to_char(sysdate, &#39;SS&#39;)))) * (16 * 1024)) &#8211;<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SYS.dbms_flashback.get_system_change_number) \/<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(16 * 1024 * 60 * 60 * 24)) indicator<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from v$instance);\n<\/p>\n<p>\n\t&#8211;2\u3001\u67e5\u8be2\u8ddd\u79bb\u4e0a\u9650\u5929\u6570\u7684\u5386\u53f2\u53d8\u5316\u60c5\u51b5\n<\/p>\n<p>\n\tSELECT tim,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp;gscn,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp;round(rate),<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp;round((chk16kscn &#8211; gscn) \/ 24 \/ 3600 \/ 16 \/ 1024, 1) &quot;HEADROOM&quot;<br \/>\n\t&nbsp; FROM (SELECT tim,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gscn,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rate,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((((to_number(to_char(tim, &#39;YYYY&#39;)) &#8211; 1988) * 12 * 31 * 24 * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((to_number(to_char(tim, &#39;MM&#39;)) &#8211; 1) * 31 * 24 * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(((to_number(to_char(tim, &#39;DD&#39;)) &#8211; 1)) * 24 * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(to_number(to_char(tim, &#39;HH24&#39;)) * 60 * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(to_number(to_char(tim, &#39;MI&#39;)) * 60) +<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(to_number(to_char(tim, &#39;SS&#39;)))) * (16 * 1024)) chk16kscn<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM (SELECT first_time tim,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;first_change# gscn,<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((next_change# &#8211; first_change#) \/<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((next_time &#8211; first_time) * 24 * 60 * 60)) rate<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM v$archived_log<br \/>\n\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WHERE (next_time &gt; first_time)))<br \/>\n\t&nbsp;ORDER BY 1, 2;\n<\/p>\n<p>\n\t<a href=\"http:\/\/www.llku.com\/?attachment_id=1495\" rel=\"attachment wp-att-1495\"><img loading=\"lazy\" alt=\"\" class=\"alignnone size-medium wp-image-1495\" height=\"219\" src=\"http:\/\/www.llku.com\/wp-content\/uploads\/2019\/05\/\u5386\u53f2scn-300x219.png\" width=\"300\" srcset=\"https:\/\/www.llku.com\/wp-content\/uploads\/2019\/05\/\u5386\u53f2scn-300x219.png 300w, https:\/\/www.llku.com\/wp-content\/uploads\/2019\/05\/\u5386\u53f2scn.png 706w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\n<\/p>\n<p>\n\t\u53ef\u53c2\u8003\u4ee5\u4e0b\u94fe\u63a5\uff1a\n<\/p>\n<p>\n\thttps:\/\/www.cnblogs.com\/likingzi\/p\/6420927.html\n<\/p>\n<p>\n\t\u5176\u4ed6\uff1a\u6b64\u811a\u672c\u6765\u505apatch&nbsp;13498243<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8211;1\u3001\u67e5\u8be2\u5f53\u524dscn\u60c5\u51b5 select version, &nbsp; &nbsp; &nbsp; &hellip; <a href=\"https:\/\/www.llku.com\/?p=1491\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Oracle DB scn\u60c5\u51b5\u67e5\u8be2<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[239],"_links":{"self":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts\/1491"}],"collection":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1491"}],"version-history":[{"count":5,"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts\/1491\/revisions"}],"predecessor-version":[{"id":1497,"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts\/1491\/revisions\/1497"}],"wp:attachment":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}