{"id":803,"date":"2013-04-06T23:20:50","date_gmt":"2013-04-06T15:20:50","guid":{"rendered":"http:\/\/www.yallonking.com\/?p=803"},"modified":"2013-04-06T23:40:23","modified_gmt":"2013-04-06T15:40:23","slug":"dg%e5%88%87%e6%8d%a2%e5%92%8c%e6%95%85%e9%9a%9c%e8%bd%ac%e7%a7%bb","status":"publish","type":"post","link":"http:\/\/www.yallonking.com\/?p=803","title":{"rendered":"DG\u5207\u6362\uff08\u542b\u53ea\u8bfb\uff09\u548c\u6545\u969c\u8f6c\u79fb"},"content":{"rendered":"<p><strong>\uff08\u4e00\uff09\u4ece\u4e3b\u5e93\u5207\u5230\u7269\u7406\u5907\u5e93<\/strong><br \/>\n\u4e3b\u5e93\u67e5\u770b\u5f53\u524d\u53ef\u5207\u6362\u72b6\u6001<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; SELECT SWITCHOVER_STATUS FROM V$DATABASE;\r\n\r\nSWITCHOVER_STATUS\r\n--------------------\r\nSESSIONS ACTIVE\r\n\r\n<\/pre>\n<p>\u4e3b\u5e93\u67e5\u770b\u5f53\u524d\u6d3b\u52a8\u7684\u7528\u6237\u4f1a\u8bdd<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select program,type from v$session where type=&#039;USER&#039;;\r\n\r\nPROGRAM                                          TYPE\r\n------------------------------------------------ ----------\r\noracle@xlong03 (J000)                            USER\r\nsqlplus@xlong03 (TNS V1-V3)                      USER\r\n<\/pre>\n<p>\u6b64\u5904\u9700\u8981\u505c\u6b62\u6240\u6709\u7684\u5e94\u7528\u53cajob\u53ca\u6d3b\u52a8\u4f1a\u8bdd\uff0c\u4e0b\u8fb9\u4fbf\u662f\u5f3a\u5236\u6740\u4f1a\u8bdd\u4f7f\u5176\u9000\u51fa<br \/>\n--\u6740\u6570\u636e\u5e93\u4f1a\u8bdd<br \/>\nselect 'host kill -9 '||<br \/>\n spid<br \/>\nfrom gv$session s,gv$process p<br \/>\nwhere s.paddr=p.addr and s.program like '%oracle@xlong03 (J000)%';<\/p>\n<p>select 'alter system kill session '||''''||sid||','||serial#||''';'<br \/>\nfrom v$session<br \/>\nwhere program like '%oracle@xlong03 (J000)%';<\/p>\n<p>\u4e3b\u5e93\u67e5\u770b\u5f53\u524d\u6d3b\u52a8\u7684\u7528\u6237\u4f1a\u8bdd<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select program,type from v$session where type=&#039;USER&#039;;\r\n\r\nPROGRAM                                          TYPE\r\n------------------------------------------------ ----------\r\nsqlplus@xlong03 (TNS V1-V3)                      USER\r\n<\/pre>\n<p>\u4e3b\u5e93\u67e5\u770b\u5f53\u524d\u53ef\u5207\u6362\u72b6\u6001<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; SELECT SWITCHOVER_STATUS FROM V$DATABASE;\r\n\r\nSWITCHOVER_STATUS\r\n--------------------\r\nNOT ALLOWED\r\n<\/pre>\n<p>\u4e3b\u5e93\u67e5\u770bdg\u5f53\u524d\u7684\u62a5\u9519\u4fe1\u606f<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nset lines 132\r\ncol message for a80\r\ncol timestamp for a20\r\nSELECT ERROR_CODE, SEVERITY, MESSAGE, \r\n       TO_cHAR(TIMESTAMP, &#039;DD-MON-RR HH24:MI:SS&#039;) TIMESTAMP\r\nFROM V$DATAGUARD_STATUS\r\nWHERE CALLOUT=&#039;YES&#039;\r\nAND TIMESTAMP &gt; SYSDATE-1;\r\n\r\n\r\nERROR_CODE SEVERITY      MESSAGE                                                                          TIMESTAMP\r\n---------- ------------- -------------------------------------------------------------------------------- --------------------\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 12:36:20\r\n     12541 Error         LGWR: Error 12541 creating archivelog file &#039;NODE2&#039;                               30-MAR-13 12:36:20\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 12:36:24\r\n     12541 Error         FAL[server, ARC0]: Error 12541 creating remote archivelog file &#039;NODE2&#039;           30-MAR-13 12:36:24\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 12:42:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 12:42:18\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 12:47:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 12:47:18\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 12:52:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 12:52:18\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 12:57:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 12:57:18\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 13:02:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 13:02:18\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 13:07:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 13:07:18\r\n     12541 Error         Error 12541 received logging on to the standby                                   30-MAR-13 13:12:18\r\n     12541 Error         PING[ARC0]: Heartbeat failed to connect to standby &#039;NODE2&#039;. Error is 12541.      30-MAR-13 13:12:18\r\n<\/pre>\n<p>\u7531\u4e8e\u76d1\u542c\u6ca1\u6709\u5f00\uff0c\u5f00\u542f\u4e3b\u5907\u5e93\u7684\u76d1\u542c<\/p>\n<p>\u5728\u4e3b\u5e93\u64cd\u4f5c\u5207\u6362\u8fc7\u7a0b<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; SELECT SWITCHOVER_STATUS FROM V$DATABASE;\r\n\r\nSWITCHOVER_STATUS\r\n--------------------\r\nTO STANDBY\r\n\r\nSQL&gt; alter database commit to switchover to physical standby with session shutdown;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; shutdown immediate\r\nORA-01507: database not mounted\r\n\r\n\r\nORACLE instance shut down.\r\nSQL&gt; startup mount\r\nORACLE instance started.\r\n\r\nTotal System Global Area  285212672 bytes\r\nFixed Size                  1218992 bytes\r\nVariable Size             113247824 bytes\r\nDatabase Buffers          167772160 bytes\r\nRedo Buffers                2973696 bytes\r\nDatabase mounted.\r\n\r\n<\/pre>\n<p>\u5728\u5907\u5e93\u64cd\u4f5c\u5207\u6362\u8fc7\u7a0b<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; SELECT SWITCHOVER_STATUS FROM V$DATABASE; \r\n\r\nSWITCHOVER_STATUS\r\n--------------------\r\nTO PRIMARY\r\n\r\nSQL&gt; ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; ALTER DATABASE OPEN;\r\n\r\nDatabase altered.\r\n<\/pre>\n<p>\u6ce8\u610f\uff1a<br \/>\n\u5982\u679c\u5907\u5e93\u6ca1\u6709\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00\uff0c\u76f4\u63a5\u6267\u884c\u4ee5\u4e0b\u8bed\u53e5\u6253\u5f00\u5230\u65b0\u7684\u4e3b\u5e93\u3002<br \/>\nSQL> ALTER DATABASE OPEN;<br \/>\n\u5982\u679c\u5907\u5e93\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00\uff0c\u5148\u5173\u95ed\u6570\u636e\uff0c\u7136\u540e\u518d\u91cd\u65b0\u542f\u52a8\u3002<br \/>\nSQL> SHUTDOWN IMMEDIATE;<br \/>\nSQL> STARTUP;<\/p>\n<p>\u5728\u65b0\u5907\u5e93\uff08\u539f\u4e3b\u5e93\uff09\u5f00\u542f\u65e5\u5fd7\u5e94\u7528<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; alter database recover managed standby database using current logfile disconnect;\r\n\r\nDatabase altered.\r\n\r\n<\/pre>\n<p>\u5728\u65b0\u4e3b\u5e93\uff08\u539f\u5907\u5e93\uff09\u5207\u6362\u65e5\u5fd7\u5f00\u59cb\u4ece\u65b0\u4e3b\u5e93\u53d1\u751f\u65e5\u5fd7\u5230\u65b0\u5907\u5e93<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; alter system switch logfile;\r\n\r\nSystem altered.\r\n<\/pre>\n<p><strong>\uff08\u4e8c\uff09\u7269\u7406\u5907\u5e93\u7684\u53ea\u8bfb\u6a21\u5f0f\u7684\u5207\u6362<\/strong><br \/>\n\u4e3b\u5e93\u63d2\u5165\u6d4b\u8bd5\u6570\u636e<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID MYTIME    NAME\r\n---------- --------- --------------------\r\n         1 30-MAR-13 yallonking\r\n\r\nSQL&gt; alter session set nls_date_format=&#039;yyyy\/mm\/dd hh24:mi:ss&#039;;\r\n\r\nSession altered.\r\n\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID MYTIME              NAME\r\n---------- ------------------- --------------------\r\n         1 2013\/03\/30 14:05:39 yallonking\r\n\r\nSQL&gt; insert into yallonking values(2,sysdate,&#039;yallonking&#039;);\r\n\r\n1 row created.\r\n\r\nSQL&gt; commit;\r\n\r\nCommit complete.\r\n<\/pre>\n<p>\u5907\u5e93\u64cd\u4f5c<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; alter database recover managed standby database cancel;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter database open;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; select OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE,PROTECTION_LEVEL from v$database;\r\n\r\nOPEN_MODE  DATABASE_ROLE    PROTECTION_MODE      PROTECTION_LEVEL\r\n---------- ---------------- -------------------- --------------------\r\nREAD ONLY  PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE\r\n\r\nSQL&gt; alter session set nls_date_format=&#039;yyyy\/mm\/dd hh24:mi:ss&#039;;\r\n\r\nSession altered.\r\n\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID MYTIME              NAME\r\n---------- ------------------- --------------------\r\n         1 2013\/03\/30 14:05:39 yallonking\r\n         2 2013\/03\/30 15:18:41 yallonking\r\n<\/pre>\n<p>\u7136\u540e\u7ee7\u7eed\u5728\u5907\u5e93\u5c06\u5907\u5e93\u6062\u590d\u81f3\u5e94\u7528\u91cd\u505a\u6570\u636e\u72b6\u6001<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; shutdown immediate\r\nDatabase closed.\r\nDatabase dismounted.\r\nORACLE instance shut down.\r\nSQL&gt; startup mount\r\nORACLE instance started.\r\n\r\nTotal System Global Area  285212672 bytes\r\nFixed Size                  1218992 bytes\r\nVariable Size             125830736 bytes\r\nDatabase Buffers          155189248 bytes\r\nRedo Buffers                2973696 bytes\r\nDatabase mounted.\r\nSQL&gt; alter database recover managed standby database disconnect from session;\r\n\r\nDatabase altered.\r\n<\/pre>\n<p>\u6216\u8005<br \/>\nSQL> alter database recover managed standby database using current logfile disconnect;<\/p>\n<p>Database altered.<\/p>\n<p><strong>\uff08\u4e09\uff09\u6a21\u62df\u4e3b\u6570\u636e\u5e93OS\u5d29\u6e83\uff0c\u6545\u969c\u8f6c\u79fb\u5230\u7269\u7406\u5907\u5e93<\/strong><br \/>\n<a href=\"http:\/\/www.yallonking.com\/wp-content\/uploads\/2013\/04\/dg_failover1.jpg\" class=\"cboxElement\" rel=\"example_group\"803><img loading=\"lazy\" src=\"http:\/\/www.yallonking.com\/wp-content\/uploads\/2013\/04\/dg_failover1-300x223.jpg\" alt=\"dg_failover1\" width=\"300\" height=\"223\" class=\"alignleft size-medium wp-image-804\" srcset=\"http:\/\/www.yallonking.com\/wp-content\/uploads\/2013\/04\/dg_failover1-300x223.jpg 300w, http:\/\/www.yallonking.com\/wp-content\/uploads\/2013\/04\/dg_failover1.jpg 374w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u5728\u4e3b\u5e93\u6dfb\u52a0\u4e00\u6761\u6d4b\u8bd5\u8bb0\u5f55\u540e\u76f4\u63a5\u5c06os shutdown\u6a21\u62df\u707e\u96be<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID MYTIME              NAME\r\n---------- ------------------- --------------------\r\n         1 2013\/03\/30 14:05:39 yallonking\r\n\r\nSQL&gt; insert into yallonking values(2,sysdate,&#039;yallonking&#039;);\r\n\r\n1 row created.\r\n\r\nSQL&gt; commit;\r\n\r\nCommit complete.\r\n\r\nSQL&gt; exit\r\nDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production\r\nWith the Partitioning, OLAP and Data Mining options\r\n[oracle@xlong03 ~]$ exit\r\nlogout\r\n\r\n[root@xlong03 ~]# shutdown -h now\r\n\r\nBroadcast message from root (pts\/0) (Sat Mar 30 14:41:26 2013):\r\n\r\nThe system is going down for system halt NOW!\r\n[root@xlong03 ~]# \r\n\r\n<\/pre>\n<p>\u5728\u7269\u7406\u5907\u5e93\u64cd\u4f5c<br \/>\n\u67e5\u770b\u5907\u5e93\u7248\u672c<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from gv$version;\r\n\r\n   INST_ID BANNER\r\n---------- ----------------------------------------------------------------\r\n         1 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod\r\n         1 PL\/SQL Release 10.2.0.1.0 - Production\r\n         1 CORE 10.2.0.1.0      Production\r\n         1 TNS for Linux: Version 10.2.0.1.0 - Production\r\n         1 NLSRTL Version 10.2.0.1.0 - Production\r\n\t\t \r\nSQL&gt; alter database recover managed standby database cancel;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter database recover managed standby database finish;\r\nalter database recover managed standby database finish\r\n*\r\nERROR at line 1:\r\nORA-00283: recovery session canceled due to errors\r\nORA-16173: incompatible archival network connections active\r\n<\/pre>\n<p>\u6ce8\uff1a\u8be5\u5904\u9519\u8bef\u662f\u7531\u4e8e\u5728\u7248\u672c10.2\u4e0a\uff0c\u5982\u679c\u5728\u6545\u969c\u8f6c\u79fb\u8fc7\u7a0b\u4e2d\uff0coracle\u53d1\u73b0\u8fd8\u6709rfs\u5728\u6d3b\u52a8\uff0c\u5219\u5728\u4e0d\u52a0force\u5173\u952e\u5b57\u7684\u60c5\u51b5\u4e0b\u4f1a\u62a5\u9519\u3002\u572811g\u4e2d\u5df2\u7ecf\u9ed8\u8ba4\u4f7f\u7528force\u5173\u952e\u5b57\u4e86\u3002<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; alter database recover managed standby database finish force;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter database commit to switchover to primary with session shutdown;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter database open;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter session set nls_date_format=&#039;yyyy\/mm\/dd hh24:mi:ss&#039;;\r\n\r\nSession altered.\r\n\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID MYTIME              NAME\r\n---------- ------------------- --------------------\r\n         1 2013\/03\/30 14:05:39 yallonking\r\n<\/pre>\n<p>\u7531\u4e8e\u662f\u6700\u5927\u6027\u80fd\u6a21\u5f0f\u4e0b\u8fd0\u884c\u7684\uff0c\u6240\u4ee5\u6709\u6570\u636e\u4e22\u5931\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uff08\u4e00\uff09\u4ece\u4e3b\u5e93\u5207\u5230\u7269\u7406\u5907\u5e93 \u4e3b\u5e93\u67e5\u770b\u5f53\u524d\u53ef\u5207\u6362\u72b6\u6001 SQL&gt; SELECT SWITCHOVER_STAT [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[35],"tags":[56,174,172,175,173],"_links":{"self":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/803"}],"collection":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=803"}],"version-history":[{"count":9,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":813,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions\/813"}],"wp:attachment":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}