oracle rac與單一實例dg 切換測試

來源:互聯網
上載者:User

標籤:switch   dg   oracle rac   

rac與單一實例dg 切換測試

一、環境概述

1、環境

orace rac&單一實例dg

os: centos 5.8 64位

oracle: 10.2.0.4

2、dg同步狀態

rac1:

650) this.width=650;" width="389" height="89" src="http://s3.51cto.com/wyfs02/M02/57/63/wKioL1SZLmGxvy6TAACpLN5RWRc392.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164654.png" />

dg:

650) this.width=650;" width="459" height="112" src="http://s3.51cto.com/wyfs02/M00/57/63/wKioL1SZLnbBlgraAACpIOzBUug425.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164712.png" />

dg現已同步狀態

3、歸檔情況

rac

650) this.width=650;" width="409" height="167" src="http://s3.51cto.com/wyfs02/M01/57/66/wKiom1SZLeui70PSAAE2kyp6KJQ124.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164718.png" />

650) this.width=650;" width="407" height="147" src="http://s3.51cto.com/wyfs02/M02/57/63/wKioL1SZLqOi9U5-AAFA5GpZmzY435.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164727.png" />

dg:

650) this.width=650;" width="406" height="147" src="http://s3.51cto.com/wyfs02/M02/57/66/wKiom1SZLhGgFSV1AAEjZyZ-4iM500.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164750.png" />

二、rac切備,dg切主,切換測試

1、rac1&rac2 手工切歸檔

rac1:

alter system switch logfile;執行兩次 兩次間隔30s

rac2:

alter system switch logfile;執行兩次 兩次間隔30s

2、檢查兩庫之間的歸檔

rac:

thread 1:

650) this.width=650;" width="418" height="279" src="http://s3.51cto.com/wyfs02/M00/57/63/wKioL1SZLsuhh3h-AAFgclYvd4Y892.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164754.png" />

thread 2 :

650) this.width=650;" width="421" height="230" src="http://s3.51cto.com/wyfs02/M00/57/66/wKiom1SZLi7wwPc4AAFGSjk_Epo292.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164800.png" />

dg:

650) this.width=650;" width="410" height="273" src="http://s3.51cto.com/wyfs02/M01/57/63/wKioL1SZLu6ifY4cAAFkEx4EplY831.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164807.png" />

3、準備切換工作

關閉rac庫關閉,並把rac1起到open

rac1&rac2

shutdown immediate;

rac1

startup open;

 

4、開始切換(執行時間80s左右)

ALTER DATABASE COMMIT TO SWITCHOVER TOPHYSICAL STANDBY WITH SESSION SHUTDOWN;

 

命令執行完,查看資料庫狀態

650) this.width=650;" width="281" height="88" src="http://s3.51cto.com/wyfs02/M01/57/66/wKiom1SZLlii7Hp3AAAscwgZ4ik754.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164813.png" />

此時,為nomount狀態

 

使用alterdatabase mount把庫起到mount狀態時

650) this.width=650;" width="303" height="95" src="http://s3.51cto.com/wyfs02/M00/57/63/wKioL1SZLw-ySGrXAABcWOJ26HM612.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164819.png" />

 

重啟資料庫到mount

shutdownimmediate;

startupmount;

 

查看資料庫角色與狀態

650) this.width=650;" width="419" height="186" src="http://s3.51cto.com/wyfs02/M00/57/66/wKiom1SZLnaSxBs5AABjmoqNhqI709.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164826.png" />

此時 主庫rac1已變為備庫

 

dg切換為主庫(1s執行完成)

ALTERDATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

查看dg庫狀態

650) this.width=650;" width="397" height="89" src="http://s3.51cto.com/wyfs02/M01/57/63/wKioL1SZLzDgU1rdAAA5M5NT-PA007.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164830.png" />

dg切換為主庫,資料庫狀態為mount,把庫起到open狀態(執行時間8s)

alterdatabase open;

 

rac庫起用自動回復(3s執行完成)

recover managed standby database disconnectfrom session;

 

5、新的主備庫歸檔應用情況

新主庫(dg)

650) this.width=650;" width="414" height="370" src="http://s3.51cto.com/wyfs02/M02/57/63/wKioL1SZL0jStaDYAAHKN7Cs-uU807.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164835.png" />

rac:

650) this.width=650;" width="406" height="412" src="http://s3.51cto.com/wyfs02/M02/57/66/wKiom1SZLqyw9407AAIQSJrXO_c991.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164954.png" />

 

在新主庫(dg)上手工切歸檔兩次

alter system switch logfile;

 

再次查看兩庫之間的歸檔情況

新主庫(dg)

650) this.width=650;" width="465" height="291" src="http://s3.51cto.com/wyfs02/M00/57/63/wKioL1SZL2ORRBbhAAF6qUgiV4o350.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164959.png" />

rac庫:

650) this.width=650;" width="469" height="345" src="http://s3.51cto.com/wyfs02/M00/57/66/wKiom1SZLsrSS8MUAAF6qUgiV4o099.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223164959.png" />

由此可以新的主備庫關係是正常的

 

三、dg切備,rac切主,切換測試

1、新主庫(dg)切為備庫(執行時間60s左右)

dg:

ALTER DATABASE COMMIT TO SWITCHOVER TOPHYSICAL STANDBY WITH SESSION SHUTDOWN;

 

執行完切換,資料庫為nomount狀態,將庫重啟到mount狀態

shutdown immediate;

startup mount;

 

查看dg庫的資料庫角色

650) this.width=650;" width="389" height="82" src="http://s3.51cto.com/wyfs02/M01/57/63/wKioL1SZL4fj1A6wAAA-1h-UFz0801.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223165007.png" />

 

2、rac庫切為主庫(執行時間1s)

ALTER DATABASE COMMIT TO SWITCHOVER TOPRIMARY WITH SESSION SHUTDOWN;

 

查看資料庫角色並將資料庫啟到open狀態

650) this.width=650;" width="402" height="164" src="http://s3.51cto.com/wyfs02/M01/57/66/wKiom1SZLunS0TpTAABJGB7Kr6g707.jpg" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" title="QQ圖片20141223165010.png" />

切換完成。

 

將rac2 庫開啟

startup open;

 

本文出自 “Li_weikang” 部落格,請務必保留此出處http://liweikang.blog.51cto.com/3246878/1593926

oracle rac與單一實例dg 切換測試

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.