失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > MS SQL 事物日志传送能否跨数据库版本吗?

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

时间:2018-10-03 03:32:10

相关推荐

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

数据库|mysql教程

事物,日志,传送,能否,数据库,版本

数据库-mysql教程

淘客网站源码购买,vscode双击无反应,mbr xp ubuntu,tomcat和c,sqlite时间复杂度,小蚂蚱属于飞虫还是爬虫,php 括号 转义,杭州seo推广服务,办公楼租赁网站源码,响应式公司网页模版,闽字模板lzw

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

刷点券网站源码,ubuntu怎么暂时关闭,有哪些爬虫公司,网页签到php,偃师seo学校lzw

会员登陆系统源码,ubuntu启动dbe命令,反爬虫技术例子,socketio php,湛江seo博客lzw

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

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

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

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

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

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

案例1的环境:

数据库服务器

版本信息

主数据库服务器

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

辅助数据库服务器

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

案例2的环境:

数据库服务器

版本信息

主数据库服务器

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

辅助数据库服务器

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

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

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

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

相关出错信息: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 : 9 and SQL : 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.

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

如果觉得《MS SQL 事物日志传送能否跨数据库版本吗?》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。