MS SQL 事物日志传送能否跨数据库版本吗?

WBOY
풀어 주다: 2016-06-07 17:44:50
원래의
1170명이 탐색했습니다.

SQL SERVER的事物日志传送(log shipping)功能,相信很多人都使用过或正在应用,这是MS SQL提供的一个非常强大的功能,一般需要一个主数据库服务器(primary/production database server)和辅助数据库服务器(standby server)来完成这个配置,默认情况下,主

    SQL SERVER的事物日志传送(log shipping)功能,网站空间,相信很多人都使用过或正在应用,这是MS SQL提供的一个非常强大的功能,一般需要一个主数据库服务器(primary/production database server)和辅助数据库服务器(standby server)来完成这个配置,默认情况下,主数据库和辅助数据库的版本应该是一致的,那么如果这两个数据库版本不一致,会不会有什么问题?还能做log shipping配置吗?

那么数据库版本不一致分两种情况:

    1: 类似于MS SQL 2005 64 bit SP4 与MS SQL 2005 SP3 32 bit这样的版本差别

    2: 完全不同的版本,例如MS SQL SERVER 2005 和 MS SQL SERVER 2008.

可能有人就要吐槽了,为啥要搞成不同的版本呢,这不是自己没事找事做吗?出现这种情况,真是一言难尽,历史的问题.....等等,你叫我怎么吐槽呢?好了,咱们就不纠结这些鸡毛蒜皮的事情了,现在回到上面的问题上来。

 

至于第一种情况,完全可以做log shipping,不存在什么问题,我做了两个这样的案例,都配置成功,而且工作的好好的。

 

案例1的环境:

数据库服务器

版本信息

主数据库服务器

Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86)   Dec 10 2010 10:56:29   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)

辅助数据库服务器

Microsoft SQL Server 2005 - 9.00.5000.00 (X64)   Dec 10 2010 10:38:40   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

案例2的环境:

数据库服务器

版本信息

主数据库服务器

Microsoft SQL Server 2005 - 9.00.4000.00 (Intel X86)   Dec 10 2010 10:56:29   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)

辅助数据库服务器

Microsoft SQL Server 2005 - 9.00.5000.00 (X64)   Dec 10 2010 10:38:40   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

第二种版本不同的情况,也要细分多种不同情况:

 

1: 主数据库服务器为SQL SERVER 2008, 辅助数据库服务器为SQL SERVER 2005, 对于这种情况,这是完全行不通的,因为你在SQL SERVER 2008上的备份,不能在低版本SQL SERVER 2005上还原(当然更低的版本也是如此),以此类推,Primary Server is SQL 2012 Std and Secondary Server is SQL 2008 R2 Std 这种情况也是行不通的。

 

2:主数据库服务器为SQL SERVER 2005, 辅助数据库服务器为SQL SERVER 2008R2,对于这种情况,log shipping部署时,服务器空间,你选择Standby Mode时,就会报错:

clip_image002

相关出错信息:System.Data.SqlClient.SqlError: This backup cannot be restored using WITH STANDBY because a database upgrade is needed. Reissue the RESTORE without WITH STANDBY. (Microsoft.SqlServer.Smo)

所以你只能选择No Recovery mode选项,至于这个就有点鸡肋了。关于上面出错的原因,下面这段解释非常清晰,明了(出处请见下面参考资料):

Each version of SQL Server has a database version number; for SQL 2000 it is 8, SQL 2005: 9 and SQL 2008: 10. When a database backup that came from a lower SQL Server version is restored, SQL Server will run an upgrade process to bring that older database version up to the database version supported by the new instance. This process is run automatically as part of SQL Server’s recovery process.  The recovery process itself is certain operations that need to happen to ensure the database is in a consistent state for user access (roll-forwards and roll-backs etc).

Placing a database in “Standby/Read Only” mode instructs SQL Server to recover the database after each restore, but also create a special standby file that contains information which will allow this recovery to be undone when it is time to do additional transaction logs restores. 

However unfortunately, once a database has been upgraded it cannot be undone.  This is why if you try and use the “Standby/Read Only” option when restoring a database of an older version SQL Server fails with

Msg 3180, Level 16, State 1, Line 1
This backup cannot be restored using WITH STANDBY because a database upgrade is needed. Reissue the RESTORE without WITH STANDBY.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

This error message essentially says you cannot bring an older database version online in “Standby/Read Only” mode.
But you can restore transaction logs and log shipping from an older database version to a newer database version when you keep the database offline.  This is because the recovery (and upgrade process) for the database is deferred until the point you do actually bring the database online.  This means you can log ship from an older version of SQL Server to a newer version until the point you bring that database online for user access.

翻译如下(水平有限,仅供参考):

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!