{"id":1112,"date":"2013-08-20T12:18:16","date_gmt":"2013-08-20T04:18:16","guid":{"rendered":"http:\/\/www.yallonking.com\/?p=1112"},"modified":"2013-08-20T12:18:16","modified_gmt":"2013-08-20T04:18:16","slug":"adg%e4%b8%8d%e5%bd%b1%e5%93%8d%e4%b8%bb%e5%ba%93%e4%b8%8b%e7%9a%84%e5%a4%87%e5%ba%93failover%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"http:\/\/www.yallonking.com\/?p=1112","title":{"rendered":"ADG\u4e0d\u5f71\u54cd\u4e3b\u5e93\u4e0b\u7684\u5907\u5e93FAILOVER\u6d4b\u8bd5"},"content":{"rendered":"<p>\u4f17\u6240\u5468\u77e5\uff0c\u5f53\u6570\u636e\u5e93dg\u642d\u5efa\u5b8c\u6210\u540e\uff0c\u90fd\u9700\u8981\u8fdb\u884cswitchover\u548cfailover\u6d4b\u8bd5\uff0c\u5176\u4e2dfailover\u5728\u751f\u4ea7\u4e2d\u5f88\u96be\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4e0b\u8fb9\u4fbf\u662f\u4e00\u4e2a\u5728\u4e0d\u5f71\u54cd\u4e3b\u5e93\u7684\u60c5\u51b5\u4e0b\uff0c\u8fdb\u884c\u7684\u4e00\u4e2a\u6a21\u62df\u7684failover\u7684\u6d4b\u8bd5\uff0c\u4ee5\u4fbf\u5bf9\u5f53\u524ddg\u7684\u53ef\u7528\u6027\u7684\u4e00\u4e2a\u6d4b\u8bd5\u3002<\/p>\n<p>\u4e4b\u524d\uff0c\u6211\u5728\u4e3b\u5907\u5e93\u540c\u6b65\u7684\u60c5\u51b5\u4e0b\uff0c\u5c06\u4e3b\u5907\u5e93\u4e2d\u7684\u6587\u4ef6tnsnames.ora\u4e2d\u7684\u76f8\u5173\u914d\u7f6e\u6ce8\u9500\u540e\uff0c\u4ee5\u4e3a\u4e3b\u5907\u5e93\u4f1a\u4e0d\u540c\u6b65\u4ee5\u4fbf\u8fdb\u884cfailover\u7684\u6d4b\u8bd5\uff0c\u4f46\u662f\u5728\u5b9e\u9645\u6d4b\u8bd5\u4e2d\uff0c\u4e3b\u5907\u5e93\u8fd8\u662f\u4fdd\u6301\u540c\u6b65\u7684\uff0c\u6240\u4ee5\uff0c\u53ef\u4ee5\u63a8\u6d4b\uff0c\u6570\u636e\u5e93\u5df2\u7ecf\u5c06\u8fd9\u4e9b\u914d\u7f6e\u8bb0\u5f55\u8fdb\u5185\u5b58\u6216\u8005\u6570\u636e\u5e93\u4e2d\u4e86\u3002\u6240\u4ee5\u8be5\u6761\u8def\u65e0\u6cd5\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n<p>\u4e0b\u8fb9\u4fbf\u662f\u4e00\u4e2a\u572811g\u7248\u672c\u4e2d\uff0c\u4f7f\u7528\u5907\u5e93\u95ea\u56de\u53caADG\u7279\u6027\u7684\u4e00\u4e2arac+dg\u7684\u53ef\u884c\u6d4b\u8bd5\u65b9\u6848\u3002<\/p>\n<p>====================================================================================================<br \/>\n\u8bbe\u7f6e\u5907\u5e93\u95ea\u56de<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select log_mode from v$database;\r\n\r\nLOG_MODE\r\n------------\r\nARCHIVELOG\r\n\r\nSQL&gt; show parameter db_recovery_file_dest\r\n\r\nNAME                                 TYPE        VALUE\r\n------------------------------------ ----------- ------------------------------\r\ndb_recovery_file_dest                string      \/u01\/app\/oracle\/flash_recovery\r\n                                                 _area\/rac_adg\r\ndb_recovery_file_dest_size           big integer 3852M\r\n\r\nSQL&gt; show parameter db_flashback_retention_target\r\n\r\nNAME                                 TYPE        VALUE\r\n------------------------------------ ----------- ------------------------------\r\ndb_flashback_retention_target        integer     1440\r\n\r\n\r\nSQL&gt; select FLASHBACK_ON from v$database;\r\n\r\nFLASHBACK_ON\r\n------------------\r\nNO\r\n\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  630501376 bytes\r\nFixed Size                  2230992 bytes\r\nVariable Size             264242480 bytes\r\nDatabase Buffers          360710144 bytes\r\nRedo Buffers                3317760 bytes\r\nDatabase mounted.\r\nSQL&gt; alter database flashback on;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter database open;\r\n\r\nDatabase altered.\r\n\r\nSQL&gt; alter database recover managed standby database disconnect from session;\r\n\r\nDatabase altered.\r\n<\/pre>\n<p>\u4e3b\u5e932\u4e2a\u8282\u70b9\u7684\u72b6\u6001<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\n[grid@11grac1 ~]$ crs_stat -t\r\nName           Type           Target    State     Host        \r\n------------------------------------------------------------\r\nora....SM1.asm application    ONLINE    ONLINE    11grac1     \r\nora....C1.lsnr application    ONLINE    ONLINE    11grac1     \r\nora....ac1.gsd application    OFFLINE   OFFLINE               \r\nora....ac1.ons application    ONLINE    ONLINE    11grac1     \r\nora....ac1.vip ora....t1.type ONLINE    ONLINE    11grac1     \r\nora....SM2.asm application    ONLINE    ONLINE    11grac2     \r\nora....C2.lsnr application    ONLINE    ONLINE    11grac2     \r\nora....ac2.gsd application    OFFLINE   OFFLINE               \r\nora....ac2.ons application    ONLINE    ONLINE    11grac2     \r\nora....ac2.vip ora....t1.type ONLINE    ONLINE    11grac2     \r\nora.DATA.dg    ora....up.type ONLINE    ONLINE    11grac1     \r\nora....ER.lsnr ora....er.type ONLINE    ONLINE    11grac1     \r\nora....N1.lsnr ora....er.type ONLINE    ONLINE    11grac2     \r\nora.asm        ora.asm.type   ONLINE    ONLINE    11grac1     \r\nora.cvu        ora.cvu.type   ONLINE    ONLINE    11grac2     \r\nora.gsd        ora.gsd.type   OFFLINE   OFFLINE               \r\nora....network ora....rk.type ONLINE    ONLINE    11grac1     \r\nora.oc4j       ora.oc4j.type  ONLINE    ONLINE    11grac2     \r\nora.ons        ora.ons.type   ONLINE    ONLINE    11grac1     \r\nora.racdb.db   ora....se.type ONLINE    ONLINE    11grac1     \r\nora.scan1.vip  ora....ip.type ONLINE    ONLINE    11grac2 \r\n<\/pre>\n<p>\u5907\u5e93\u72b6\u6001<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select open_mode from v$database;\r\n\r\nOPEN_MODE\r\n--------------------\r\nREAD ONLY WITH APPLY\r\n\r\n\r\n<\/pre>\n<p>\u786e\u8ba4\u540c\u6b65<br \/>\n\u4e3b\u5e93\u4efb\u610f\u8282\u70b9\u64cd\u4f5c<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; sho user\r\nUSER is &quot;TEST&quot;\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n\r\nSQL&gt; insert into yallonking values(4,&#039;cfca&#039;,sysdate);\r\n\r\n1 row created.\r\n\r\nSQL&gt; commit;\r\n\r\nCommit complete.\r\n\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         4 cfca                 20-AUG-13\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n\t\t \r\nSQL&gt; conn \/as sysdba\r\nConnected.\r\nSQL&gt; alter system archive log current;\r\n\r\nSystem altered.\r\n<\/pre>\n<p>\u5907\u5e93\u9a8c\u8bc1<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; conn test\/test\r\nConnected.\r\nSQL&gt; select * from yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         4 cfca                 20-AUG-13\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n<\/pre>\n<p>\u5f00\u59cb\u8fdb\u884cfailover\u6d4b\u8bd5\uff08\u5907\u5e93\u8bfb\u5199\u6253\u5f00\u540e\u5e76\u6062\u590d\u539f\u72b6\u7ee7\u7eed\u540c\u6b65\u4e8e\u4e3b\u5e93\u7684\u6d4b\u8bd5\uff09<\/p>\n<p>\u5728\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 recover managed standby database finish;\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; select open_mode from v$database;\r\n\r\nOPEN_MODE\r\n--------------------\r\nREAD WRITE\r\n\r\n<\/pre>\n<p>\u4e0b\u8fb9\u5728\u4e3b\u5e93\u4efb\u610f\u8282\u70b9\u63d2\u5165\u6d4b\u8bd5\u6570\u636e<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from test.yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         4 cfca                 20-AUG-13\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n\r\nSQL&gt; insert into test.yallonking values(5,&#039;yunxingbu&#039;,sysdate); \r\n\r\n1 row created.\r\n\r\nSQL&gt; commit;\r\n\r\nCommit complete.\r\n\r\nSQL&gt; alter system archive log current;\r\n\r\nSystem altered.\r\n\r\n<\/pre>\n<p>\u5728\u5907\u5e93\u67e5\u786e\u8ba4\u5df2\u7ecf\u770b\u4e0d\u5230\u540c\u6b65\u540e\u7684\u6570\u636e<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from test.yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         4 cfca                 20-AUG-13\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n\r\n<\/pre>\n<p>\u5728\u5907\u5e93\u63d2\u5165\u6d4b\u8bd5\u6570\u636e<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; insert into test.yallonking values(6,&#039;ceshi&#039;,sysdate);\r\n\r\n1 row created.\r\n\r\nSQL&gt; commit;\r\n\r\nCommit complete.\r\n\r\nSQL&gt; alter system archive log current;\r\n\r\nSystem altered.\r\n<\/pre>\n<p>\u5728\u4e3b\u5e93\u67e5\u770b\u662f\u5426\u6709\u5f71\u54cd<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from test.yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         4 cfca                 20-AUG-13\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n         5 yunxingbu            20-AUG-13\r\n<\/pre>\n<p>\u4e0b\u8fb9\u5f00\u59cb\u6062\u590d\u5907\u5e93\u4e3a\u4e4b\u524d\u7684\u72b6\u6001<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select to_char(standby_became_primary_scn) fallover_scn from v$database;\r\n\r\nFALLOVER_SCN\r\n----------------------------------------\r\n1354815\r\n\r\nSQL&gt; shutdown abort\r\nORACLE instance shut down.\r\nSQL&gt; startup mount;\r\nORACLE instance started.\r\n\r\nTotal System Global Area  630501376 bytes\r\nFixed Size                  2230992 bytes\r\nVariable Size             264242480 bytes\r\nDatabase Buffers          360710144 bytes\r\nRedo Buffers                3317760 bytes\r\nDatabase mounted.\r\nSQL&gt; flashback database to scn 1354815;\r\n\r\nFlashback complete.\r\n\r\nSQL&gt; alter database convert to physical standby;\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\r\nORACLE instance started.\r\n\r\nTotal System Global Area  630501376 bytes\r\nFixed Size                  2230992 bytes\r\nVariable Size             264242480 bytes\r\nDatabase Buffers          360710144 bytes\r\nRedo Buffers                3317760 bytes\r\nDatabase mounted.\r\nDatabase opened.\r\nSQL&gt; alter database recover managed standby database disconnect from session;\r\n\r\nDatabase altered.\r\n<\/pre>\n<p>\u68c0\u67e5\u5907\u5e93\u6570\u636e\u540c\u6b65\u60c5\u51b5<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nSQL&gt; select * from test.yallonking;\r\n\r\n        ID NAME                 MYDATE\r\n---------- -------------------- ---------\r\n         4 cfca                 20-AUG-13\r\n         1 yallonking           14-MAY-13\r\n         2 oraking              14-MAY-13\r\n         3 oraking              14-MAY-13\r\n         5 yunxingbu            20-AUG-13\r\n<\/pre>\n<p>\u81f3\u6b64\u5168\u90e8OK\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f17\u6240\u5468\u77e5\uff0c\u5f53\u6570\u636e\u5e93dg\u642d\u5efa\u5b8c\u6210\u540e\uff0c\u90fd\u9700\u8981\u8fdb\u884cswitchover\u548cfailover\u6d4b\u8bd5\uff0c\u5176\u4e2dfailover\u5728 [&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":[174],"_links":{"self":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/1112"}],"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=1112"}],"version-history":[{"count":1,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/1112\/revisions"}],"predecessor-version":[{"id":1113,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/1112\/revisions\/1113"}],"wp:attachment":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1112"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}