{"id":611,"date":"2023-10-02T22:41:32","date_gmt":"2023-10-02T14:41:32","guid":{"rendered":"https:\/\/www.db2go.net\/?p=611"},"modified":"2023-10-03T08:18:22","modified_gmt":"2023-10-03T00:18:22","slug":"%e5%a1%ab%e4%b8%8a%e4%b8%80%e7%af%87adg%e7%9a%84%e4%b8%80%e4%ba%9b%e5%9d%91","status":"publish","type":"post","link":"https:\/\/www.db2go.net\/?p=611","title":{"rendered":"\u914d\u7f6eADG\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565"},"content":{"rendered":"<h2>\u914d\u7f6eLOG_ARCHIVE_DEST_n\u53c2\u6570<\/h2>\n<p>\u5728 ADG \u73af\u5883\u4e2d\uff0cLOG_ARCHIVE_DEST_n \u53c2\u6570\uff08\u5176\u4e2d n \u662f 1 \u5230 31 \u4e4b\u95f4\u7684\u6570\u5b57\uff09\u7528\u4e8e\u5b9a\u4e49\u91cd\u505a\u65e5\u5fd7\u7684\u5f52\u6863\u76ee\u7684\u5730\u3002\u8fd9\u4e9b\u76ee\u7684\u5730\u53ef\u4ee5\u662f\u672c\u5730\u6216\u8fdc\u7a0b\u7684\uff0c\u8fdc\u7a0b\u76ee\u7684\u5730\u901a\u5e38\u6307\u5411\u5907\u5e93\u3002<\/p>\n<ol>\n<li>\u5b9a\u4e49\u672c\u5730\u5f52\u6863\u76ee\u7684\u5730\uff1a<br \/>\n\u4e3a\u4e86\u5728\u4e3b\u5e93\u4e0a\u4fdd\u7559\u5f52\u6863\u65e5\u5fd7\u7684\u672c\u5730\u526f\u672c\uff0c\u53ef\u4ee5\u8bbe\u7f6e\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=\/path_to_archives';\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u5b9a\u4e49\u8fdc\u7a0b\u5f52\u6863\u76ee\u7684\u5730\uff1a<br \/>\n\u4e3a\u4e86\u5c06\u5f52\u6863\u65e5\u5fd7\u53d1\u9001\u5230\u5907\u5e93\uff0c\u53ef\u4ee5\u8bbe\u7f6e\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby_db_name ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby_unique_name';\n<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th>\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>SERVICE<\/td>\n<td>\u6307\u5411\u5907\u5e93\u7684 TNS \u670d\u52a1\u540d\u3002\u4f8b\u5982\uff1aSERVICE=&#8217;standby_db&#8217;<\/td>\n<\/tr>\n<tr>\n<td>ASYNC<\/td>\n<td>\u8868\u793a\u4f7f\u7528\u5f02\u6b65\u6a21\u5f0f\u53d1\u9001\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>VALID_FOR<\/td>\n<td>\u5b9a\u4e49\u5f52\u6863\u65e5\u5fd7\u76ee\u7684\u5730\u7684\u6709\u6548\u6027\u3002\u4f8b\u5982\uff1aVALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE)<\/td>\n<\/tr>\n<tr>\n<td>DB_UNIQUE_NAME<\/td>\n<td>\u5907\u5e93\u7684\u552f\u4e00\u540d\u79f0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"3\">\n<li>\u8bbe\u7f6e\u5f52\u6863\u65e5\u5fd7\u7684\u4f20\u8f93\u5c5e\u6027\uff1a<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>AFFIRM<\/td>\n<td>\u5b9a\u4e49\u5907\u5e93\u9700\u8981\u786e\u8ba4\u5df2\u7ecf\u6536\u5230\u5e76\u5199\u5165\u91cd\u505a\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>NOAFFIRM<\/td>\n<td>\u4e0d\u7b49\u5f85\u5907\u5e93\u786e\u8ba4<\/td>\n<\/tr>\n<tr>\n<td>LGWR SYNC<\/td>\n<td>\u4f7f\u7528\u540c\u6b65\u6a21\u5f0f\u5c06\u91cd\u505a\u65e5\u5fd7\u4ece\u4e3b\u5e93\u4f20\u8f93\u5230\u5907\u5e93<\/td>\n<\/tr>\n<tr>\n<td>LGWR ASYNC<\/td>\n<td>\u4f7f\u7528\u5f02\u6b65\u6a21\u5f0f\u5c06\u91cd\u505a\u65e5\u5fd7\u4ece\u4e3b\u5e93\u4f20\u8f93\u5230\u5907\u5e93<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"4\">\n<li>\u5176\u4ed6\u5e38\u89c1\u8bbe\u7f6e\uff1a<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>REOPEN<\/td>\n<td>\u5982\u679c\u5f52\u6863\u5931\u8d25\uff0c\u5b9a\u4e49\u91cd\u65b0\u5c1d\u8bd5\u7684\u65f6\u95f4\u95f4\u9694<\/td>\n<\/tr>\n<tr>\n<td>DELAY<\/td>\n<td>\u6307\u5b9a\u5728\u5907\u5e93\u4e0a\u5e94\u7528\u5f52\u6863\u65e5\u5fd7\u4e4b\u524d\u7684\u5ef6\u8fdf\u65f6\u95f4\uff08\u4ee5\u5206\u949f\u4e3a\u5355\u4f4d\uff09\u3002\u4f8b\u5982\uff1aDELAY=60<\/td>\n<\/tr>\n<tr>\n<td>ALTERNATE<\/td>\n<td>\u5b9a\u4e49\u5907\u7528\u5f52\u6863\u76ee\u7684\u5730\uff0c\u5f53\u4e3b\u8981\u76ee\u7684\u5730\u4e0d\u53ef\u7528\u65f6\u4f7f\u7528\u3002\u4f8b\u5982\uff1aALTERNATE=LOG_ARCHIVE_DEST_2<\/td>\n<\/tr>\n<tr>\n<td>MAX_FAILURE<\/td>\n<td>\u6307\u5b9a\u5728\u653e\u5f03\u5f52\u6863\u65e5\u5fd7\u76ee\u7684\u5730\u4e4b\u524d\u5141\u8bb8\u7684\u8fde\u7eed\u5931\u8d25\u6b21\u6570<\/td>\n<\/tr>\n<tr>\n<td>NET_TIMEOUT<\/td>\n<td>\u6307\u5b9a\u7f51\u7edc\u64cd\u4f5c\u7684\u8d85\u65f6\u65f6\u95f4\uff08\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby_db_name SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby_unique_name';\n<\/code><\/pre>\n<ol start=\"5\">\n<li>\u8bbe\u7f6e\u5f52\u6863\u65e5\u5fd7\u7684\u4fdd\u7559\u7b56\u7565\uff1a<br \/>\n\u4f7f\u7528 LOG_ARCHIVE_DEST_STATE_n \u53c2\u6570\u6765\u542f\u7528\u6216\u7981\u7528\u7279\u5b9a\u7684\u5f52\u6863\u76ee\u7684\u5730\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;\n<\/code><\/pre>\n<ol start=\"6\">\n<li>\u6e05\u9664\u6216\u91cd\u7f6e\u5f52\u6863\u76ee\u7684\u5730\uff1a<br \/>\n\u5982\u679c\u9700\u8981\u6e05\u9664\u6216\u91cd\u7f6e\u7279\u5b9a\u7684\u5f52\u6863\u76ee\u7684\u5730\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='';\n<\/code><\/pre>\n<h2>\u914d\u7f6e\u4e3b\u5e93\u548c\u5907\u5e93\u7684\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565<\/h2>\n<ol>\n<li>\u4e3b\u5e93\u7684\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565<\/li>\n<\/ol>\n<p>\u5728\u4e3b\u5e93\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528 LOG_ARCHIVE_DEST_n \u53c2\u6570\u7684 DELETE \u5c5e\u6027\u6765\u914d\u7f6e\u5f52\u6863\u65e5\u5fd7\u7684\u5220\u9664\u7b56\u7565\u3002<br \/>\n\u5220\u9664\u5df2\u4f20\u8f93\u7684\u5f52\u6863\u65e5\u5fd7\uff1a<\/p>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby_db_name VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby_unique_name DELETE ALL ARCHIVELOG ALL SHIPPED TO standby_unique_name';\n<\/code><\/pre>\n<p>\u8fd9\u5c06\u786e\u4fdd\u6240\u6709\u5df2\u7ecf\u6210\u529f\u4f20\u8f93\u5230\u6307\u5b9a\u5907\u5e93\u7684\u5f52\u6863\u65e5\u5fd7\u5728\u4e3b\u5e93\u4e0a\u88ab\u5220\u9664\u3002<\/p>\n<ol start=\"2\">\n<li>LOG_ARCHIVE_DELETION_POLICY<\/li>\n<\/ol>\n<p>\u9664\u4e86\u7b2c\u4e00\u79cd\u65b9\u6cd5\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eLOG_ARCHIVE_DELETION_POLICY\u53c2\u6570\uff0c\u6765\u63a7\u5236\u5f52\u6863\u65e5\u5fd7\u7684\u81ea\u52a8\u5220\u9664\u7b56\u7565\u3002\u4ee5\u4e0b\u662f\u8be5\u53c2\u6570\u7684\u4e00\u4e9b\u5e38\u7528\u8bbe\u7f6e\u53ca\u5176\u542b\u4e49\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>APPLIED<\/td>\n<td>\u5f53\u8bbe\u7f6e\u4e3a APPLIED \u65f6\uff0cOracle \u4f1a\u81ea\u52a8\u5220\u9664\u5df2\u7ecf\u88ab\u5907\u5e93\u5e94\u7528\u7684\u5f52\u6863\u65e5\u5fd7\u3002\u8fd9\u662f\u5728 Data Guard \u73af\u5883\u4e2d\u5e38\u7528\u7684\u8bbe\u7f6e\uff0c\u786e\u4fdd\u53ea\u6709\u5df2\u7ecf\u5b89\u5168\u5e94\u7528\u5230\u5907\u5e93\u7684\u5f52\u6863\u65e5\u5fd7\u624d\u4f1a\u88ab\u5220\u9664<\/td>\n<\/tr>\n<tr>\n<td>NONE<\/td>\n<td>\u5f53\u8bbe\u7f6e\u4e3a NONE \u65f6\uff0cOracle \u4e0d\u4f1a\u81ea\u52a8\u5220\u9664\u4efb\u4f55\u5f52\u6863\u65e5\u5fd7\u3002\u8fd9\u610f\u5473\u7740\u9700\u8981\u624b\u52a8\u7ba1\u7406\u548c\u5220\u9664\u5f52\u6863\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>SPACE<\/td>\n<td>\u5f53\u8bbe\u7f6e\u4e3a SPACE \u65f6\uff0cOracle \u4f1a\u5728\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u65f6\u81ea\u52a8\u5220\u9664\u5f52\u6863\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>SHIPPING<\/td>\n<td>\u5f53\u8bbe\u7f6e\u4e3a SHIPPING \u65f6\uff0cOracle \u4f1a\u5220\u9664\u5df2\u7ecf\u6210\u529f\u4f20\u8f93\u5230\u6240\u6709\u6307\u5b9a\u7684\u5907\u5e93\u7684\u5f52\u6863\u65e5\u5fd7\u3002\u8fd9\u4e2a\u548c\u7b2c\u4e00\u4e2a\u4e0d\u540c\u7684\u662f\uff0c\u7b2c\u4e00\u4e2a\u5305\u62ec\u4e86\u4f20\u8f93\u548c\u5e94\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bbe\u7f6e\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-SQL line-numbers\">ALTER SYSTEM SET LOG_ARCHIVE_DELETION_POLICY = APPLIED;\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u5907\u5e93\u7684\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565<\/li>\n<\/ol>\n<p>\u5728\u5907\u5e93\u4e0a\uff0c\u5f52\u6863\u65e5\u5fd7\u7684\u5220\u9664\u901a\u5e38\u662f\u57fa\u4e8e\u5b83\u4eec\u662f\u5426\u5df2\u7ecf\u88ab\u5e94\u7528\u3002\u4f7f\u7528 RMAN \u7684\u914d\u7f6e\u6765\u81ea\u52a8\u5220\u9664\u5df2\u7ecf\u88ab\u5e94\u7528\u7684\u5f52\u6863\u65e5\u5fd7\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">rman&gt; CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;\n<\/code><\/pre>\n<ol start=\"4\">\n<li>\u9a8c\u8bc1\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565\u662f\u5426\u751f\u6548<\/li>\n<\/ol>\n<p>\u5728\u5907\u7528\u5e93\u4e0a\u6267\u884c\u4e0b\u9762\u7684SQL\uff0c\u53ef\u4ee5\u5728\u5907\u5e93\u4e0a\u67e5\u770b\u5f52\u6863\u65e5\u5fd7\u6587\u4ef6\u7684\u72b6\u6001\u3002\u8fd9\u662f\u4e00\u4e2a\u7528\u6765\u9a8c\u8bc1\u5f52\u6863\u65e5\u5fd7\u7684\u5220\u9664\u7b56\u7565\u662f\u5426\u5df2\u7ecf\u751f\u6548\u7684\u65b9\u6cd5\u3002<\/p>\n<pre><code class=\"language-SQL line-numbers\">SELECT APPLIED, ARCHIVED, DELETED FROM V$ARCHIVED_LOG;\n<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th>\u5217\u540d<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>APPLIED<\/td>\n<td>\u8fd9\u4e00\u5217\u8868\u793a\u5f52\u6863\u65e5\u5fd7\u662f\u5426\u5df2\u7ecf\u5728\u5907\u5e93\u4e0a\u88ab\u5e94\u7528\u3002\u5982\u679c\u503c\u4e3a YES\uff0c\u5219\u8868\u793a\u8be5\u5f52\u6863\u65e5\u5fd7\u5df2\u7ecf\u88ab\u5e94\u7528<\/td>\n<\/tr>\n<tr>\n<td>ARCHIVED<\/td>\n<td>\u8fd9\u4e00\u5217\u8868\u793a\u5f52\u6863\u65e5\u5fd7\u662f\u5426\u5df2\u7ecf\u88ab\u5f52\u6863\u3002\u5728\u5907\u5e93\u4e0a\uff0c\u8fd9\u901a\u5e38\u5e94\u8be5\u662f NO\uff0c\u56e0\u4e3a\u5907\u5e93\u901a\u5e38\u4e0d\u4f1a\u81ea\u5df1\u751f\u6210\u5f52\u6863\u65e5\u5fd7\u3002\u5b83\u53ea\u662f\u4ece\u4e3b\u5e93\u63a5\u6536\u5e76\u5e94\u7528\u5f52\u6863\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>DELETED<\/td>\n<td>\u8fd9\u4e00\u5217\u8868\u793a\u5f52\u6863\u65e5\u5fd7\u662f\u5426\u5df2\u7ecf\u88ab\u5220\u9664\u3002\u5982\u679c\u503c\u4e3a YES\uff0c\u5219\u8868\u793a\u8be5\u5f52\u6863\u65e5\u5fd7\u5df2\u7ecf\u88ab\u5220\u9664<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"5\">\n<li>\u6ce8\u610f\u4e8b\u9879<\/li>\n<\/ol>\n<ul>\n<li>\u5728\u914d\u7f6e\u5f52\u6863\u65e5\u5fd7\u7684\u5220\u9664\u7b56\u7565\u4e4b\u524d\uff0c\u786e\u4fdd\u6709\u6700\u8fd1\u7684\u5907\u4efd\uff0c\u4ee5\u9632\u4e07\u4e00\u3002<\/li>\n<li>\u5728\u4e3b\u5e93\u4e0a\uff0c\u786e\u4fdd\u4e0d\u8981\u8fc7\u65e9\u5730\u5220\u9664\u5f52\u6863\u65e5\u5fd7\uff0c\u56e0\u4e3a\u5907\u5e93\u53ef\u80fd\u4ecd\u7136\u9700\u8981\u5b83\u4eec\u3002<\/li>\n<li>\u5728\u5907\u5e93\u4e0a\uff0c\u786e\u4fdd\u5f52\u6863\u65e5\u5fd7\u5df2\u7ecf\u88ab\u5e94\u7528\u5e76\u4e14\u4e0d\u518d\u9700\u8981\u4e4b\u540e\u518d\u5220\u9664\u5b83\u4eec\u3002<\/li>\n<li>\u5b9a\u671f\u68c0\u67e5\u5f52\u6863\u65e5\u5fd7\u7684\u76ee\u7684\u5730\uff0c\u786e\u4fdd\u5b83\u4eec\u6ca1\u6709\u586b\u6ee1\u78c1\u76d8\u7a7a\u95f4\u3002<\/li>\n<li>\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5e94\u7528\u8fd9\u4e9b\u8bbe\u7f6e\u4e4b\u524d\uff0c\u5efa\u8bae\u5148\u5728\u6d4b\u8bd5\u73af\u5883\u4e2d\u9a8c\u8bc1\u5b83\u4eec\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u7f6eLOG_ARCHIVE_DEST_n\u53c2\u6570 \u5728 ADG \u73af\u5883\u4e2d\uff0cLOG_ARCHIVE_DEST_n \u53c2\u6570\uff08&hellip;<\/p>\n <a href=\"https:\/\/www.db2go.net\/?p=611\" title=\"\u914d\u7f6eADG\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565\" class=\"entry-more-link\"><span>Read More<\/span> <span class=\"screen-reader-text\">\u914d\u7f6eADG\u5f52\u6863\u65e5\u5fd7\u5220\u9664\u7b56\u7565<\/span><\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[4],"tags":[],"class_list":["entry","author-suredandan","post-611","post","type-post","status-publish","format-standard","category-oracle"],"views":2005,"_links":{"self":[{"href":"https:\/\/www.db2go.net\/index.php?rest_route=\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.db2go.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.db2go.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.db2go.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.db2go.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=611"}],"version-history":[{"count":7,"href":"https:\/\/www.db2go.net\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions"}],"predecessor-version":[{"id":620,"href":"https:\/\/www.db2go.net\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions\/620"}],"wp:attachment":[{"href":"https:\/\/www.db2go.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.db2go.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.db2go.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}