SQL Server 鏡像認證到期處理

來源:互聯網
上載者:User

今天鏡像中的主伺服器進行維護重啟,重啟後發現鏡像Disconnect,使用xp_readerrorlog 0, 1檢查錯誤記錄檔發現下列資訊:

Database mirroring connection error 5 'Connection handshake failed. The certificate used by this endpoint was not found: Certificate expired. Use DBCC CHECKDB in master database to verify the metadata integrity of the endpoints. State 85.'

前先以為是重啟導致了認證損壞,所以檢查了下主機和備機的認證是否存在:

select name, start_date, expiry_date
from sys.certificates
where name not like '##%'

檢查後發現主機的認證expiry_date時間是2011-01-01,而現在已經是13號了,可以得到一個結論,認證雖然到期但是如果鏡像沒有斷開的話認證還是可以持續使用,直到鏡像斷開。

於是認證替換,主機,重新建立新認證、修改endpoint並備份給備機:

use master 
go
--principal_cert_new如果不進行endpoint刪除的話這裡需要新的認證名稱
create certificate principal_cert_new with subject = 'mirror',start_date='2012-01-01', expiry_date='2099-06-01'; --為N年後更換認證選個日子(6.1已過)
go
alter endpoint endpoint_mirroring
for database_mirroring (authentication = certificate principal_cert_new)
go
drop certificate principal_cert
go
backup certificate principal_cert to file = 'd:\certificate\principal_cert.cer';

備機,還原主機的認證並回複鏡像:

use master 
go
create certificate principal_cert_new AUTHORIZATION mirror_user from file = 'D:\certificate\principal_cert.cer';
go
alter database mydb set partner resume
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.