Are you using SQL2K or SQL2K5 (or later)? If SQL2K5 (or later), you can implement a standby server or log shipping rather than replication to achieve fast switch-over capability. If SQL2K, then it's still possible to manually configure log shipping. Obviously you need to script the movement of transaction logs manually rather than relying on system doing it for you under SQL2K5.However, if you must use replication, identity columns are no big issues either. You need to ensure you have the following system in place(1) configure all tables that have identity columns with Not For Replication clause. This ensures that subscribers will receive the records with the same identity value as publisher.(2) Prior to switching over the backup server, run a batch of DBCC CheckIDENT(TableName, reseed, last_used_key) on the standby database. You need to retrieve the last_used_key using select max(key_name) from mytable.With this system in place, switching from production over to the standby server using replicated data will be a breeze and you will not need to modify the database application itself.
To use dbcc checkident, you must have already taken your subscriber database out of subscription mode (which is necessary before you can bring it online for production use anyway).
What does 标识列 mean? I presume it is identity in English? If my understanding of the error message is correct, it is saying that the table you are referring to (mysql) doesn't have an identity column at all! Check to ensure you haven't inadvertently disabled identity on that table.In addition to what I said about taking the database out of the subscription mode, you actually only need to call dbcc checkident(tablename, reseed) without having to specify the seed value. In SQL 2000, the system will automatically look for the maximum value used and use it as the current seed.
一个是IDENTITY,保存对应关系.
现在服务器的的IDENTITY 不用动
使用 dbcc checkident to reset identity value不需要修改程序
把服务器A上的数据库AData,复制服务器B上的数据库BData上去罗。那还能怎么样?
备用服务器订阅成功后,IDENTITY这个字段就是已经改变。如果再执行类似如下的代码会有错误。
DEclARE @autoid int
set @autoid=(SELECT MAX(autoid) FROM mysqlpub)
if @autoid is NULL
SET @autoid=0
DBCC CHECKIDENT (mysqlpub, RESEED,@autoid)
服务器: 消息 7997,级别 16,状态 1,行 7
'mysqlpub' 不包含标识列。
DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。
To use dbcc checkident, you must have already taken your subscriber database out of subscription mode (which is necessary before you can bring it online for production use anyway).
What does 标识列 mean? I presume it is identity in English? If my understanding of the error message is correct, it is saying that the table you are referring to (mysql) doesn't have an identity column at all! Check to ensure you haven't inadvertently disabled identity on that table.In addition to what I said about taking the database out of the subscription mode, you actually only need to call dbcc checkident(tablename, reseed) without having to specify the seed value. In SQL 2000, the system will automatically look for the maximum value used and use it as the current seed.