日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

服务器芯片镜像测试,模拟镜像服务器磁盘问题的两个测试【转】

發布時間:2023/12/1 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 服务器芯片镜像测试,模拟镜像服务器磁盘问题的两个测试【转】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我們知道在高安全模式下,在主服務器上提交的事務必須同時在鏡像服務器上提交成功,否則該事務無法在主數據庫上提交。

在上面的圖中,一個事務在主數據庫上提交的步驟包含:

客戶端程序將事務發送給主數據庫服務器SQLServer

主數據庫服務器?SQL Server為這個事務寫日志文件

2.1?????????主數據庫服務器將這個事務的日志內容傳遞給鏡像服務器的SQL Server

鏡像數據庫服務器SQL Server將收到的日志內容寫入到日志文件。

鏡像服務器回復主服務器寫日志的動作完成。

主服務器SQL Server回復客戶端程序該事務提交成功。

>2.主數據庫服務器SQL Server在檢查點時將該事務修改的數據頁從內存中寫入數據文件。

>3.鏡像數據庫服務器SQL Server將日志對于的數據頁在文件上做變更。

從這樣的順序中,我們提出一個問題,如果鏡像服務器的SQL Server在那個時候不能完成步驟3,是否這時主數據庫服務器對于的數據庫就不能正常的提交事務了呢?本文介紹的兩個測試就是模擬日志文件和數據庫不可用時候的測試結果

測試一:數據庫有多個數據文件和日志文件,分布在不同的磁盤上,在鏡像數據庫聯機的情況下刪除一個磁盤,即一個數據文件和日志文件不可能的測試:

1.創建數據庫test,添加四個文件。注意為第一個日志文件設置較小的大小并禁止自動增長:

test?????????????? C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\test.mdf

test_log?????????? C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\test_log.ldf

test1????????????? E:\test1.ndf

testlog1?????????? E:\testlog1.ldf

2.配置數據庫鏡像高安全模式,主服務器為SQL1,鏡像數據庫為SQL2.

3.創建兩張測試表test和test1,插入超過1,000,000行數據到test表中.由于第一個日志文件較小且不能自動增長,因此SQL Server開始使用第二個日志文件testlog1.檢查數據庫鏡像的狀態:

結果:主數據庫顯示已principal/sychronized

4.執行下面的腳本,開始事務,這個事務會執行超過10分鐘:

begin tran

insert into test ?select * from test

insert into test ?select * from test

commit

當事務開始執行1分鐘以后,暫停數據庫鏡像1分鐘,然后在手工恢復數據庫鏡像的同步:

結果:?主數據庫狀態顯示principal/synchronizing.

訪問test1表,可以返回數據。

6.手工將E盤從鏡像數據庫服務上拔出:.

結果:?主數據庫狀態立即變更為?(principal/suspend)。

測試訪問主數據庫并查詢test1表

鏡像數據庫狀態變更為:?(mirrored, suspend/restoring)

7.檢查事務的執行:

幾分鐘以后,這個事務顯示在主數據庫上提交成功。

.

8.檢查主數據庫和鏡像數據庫的SQL Server錯誤日志:

主數據庫:

Error: 1453, Severity: 16, State: 1.

‘TCP://LDUA2481460-2.DOM248146.COM:5023‘, the remote mirroring partner for database ‘test‘, encountered error 5159, status 1, severity 24. Database mirroring has been suspended.? Resolve the error on the remote server and resume mirroring, or remove mirroring and re-establish the mirror server instance.

鏡像數據庫:

‘TCP://LDUA2481460-2.DOM248146.COM:5023‘, the remote mirroring partner for database ‘test‘, encountered error 5159, status 1, severity 24. Database mirroring has been suspended.? Resolve the error on the remote server and resume mirroring, or remove mirroring and re-establish the mirror server instance.

Operating system error 2(The system cannot find the file specified.) on file "E:\test_3.ldf" during RestoreFileHdr.

Test 2:在執行并同步一個大事務的時候將鏡像數據庫刪除:

1.????創建數據庫test,包含一個數據文件一個日志文件。

test1??????????? E:\test1.mdf

test1_log??????? E:\test1_log.ldf

2.配置數據庫鏡像高安全模式,主服務器為SQL1,鏡像數據庫為SQL2.

3.創建兩張測試表test和test1,插入超過1,000,000行數據到test表中.由于第一個日志文件較小且不能自動增長,因此SQL Server開始使用第二個日志文件testlog1.檢查數據庫鏡像的狀態:

結果:主數據庫顯示已principal/sychronized

4.執行下面的腳本,開始事務,這個事務會執行超過10分鐘:

begin tran

insert into test select * from test

insert into test select * from test

commit

5.當事務開始執行1分鐘以后,暫停數據庫鏡像1分鐘,然后在手工恢復數據庫鏡像的同步:

結果:?主數據庫狀態顯示principal/synchronizing.

訪問test1表,可以返回數據。

6.手工將E盤從鏡像數據庫服務上拔出:

結果:?主數據庫狀態立即變更為?(principal/ disconnected)。

測試訪問主數據庫并查詢test1表

鏡像數據庫不存在。

7.檢查事務的執行:

幾分鐘以后,這個事務顯示在主數據庫上提交成功。

8.檢查主數據庫和鏡像數據庫的SQL Server錯誤日志:

主數據庫:

1453, Severity: 16, State: 1

‘TCP://LDUA2481460-2.DOM248146.COM:5023‘, the remote mirroring partner for database ‘test1‘, encountered error 5149, status 1, severity 16. Database mirroring has been suspended.? Resolve the error on the remote server and resume mirroring, or remove mirroring and re-establish the mirror server instance..

鏡像數據庫:

Error: 17053 Severity: 16 State: 1

RestoreFileHdr: Operating system error 2(The system cannot find the file specified.) encountered.

Error: 5159 Severity: 24 State: 1

Operating system error 2(The system cannot find the file specified.) on file "E:\test1_1.ldf" during RestoreFileHdr.

Error: 823 Severity: 24 State: 3.

The operating system returned error 21(The device is not ready.) to SQL Server during a write at offset 0x00000000012000 in file ‘E:\test1.mdf‘. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information see SQL Server Books Online.

Error: 1454 Severity: 16 State: 1.

While acting as a mirroring partner for database ‘test1‘ server instance ‘LDUA2481460-1\MSSQLSERVER1‘ encountered error 823 status 3 severity 24. Database mirroring will be suspended.? Try to resolve the error and resume mirroring.

測試結果:

主數據庫在這兩種情況下依然可以訪問并且成功提交事務

轉自:http://blogs.msdn.com/b/apgcdsd/archive/2012/03/09/10280123.aspx

總結

以上是生活随笔為你收集整理的服务器芯片镜像测试,模拟镜像服务器磁盘问题的两个测试【转】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。