今天恢复某个数据库时出现如下的错误:
Msg 208, Level 16, State 1, PRocedure sp_MSrestoredbreplication, Line 72Invalid object name 'master.dbo.MSreplication_options'.Msg 3165, Level 16, State 1, Line 1Database 'MYDBNAME' was restored, however an error was encountered while replication was being restored/removed. The database has been left offline. See the topic MSSQL_ENG003165 in SQL Server Books Online.Msg 3167, Level 16, State 1, Line 1RESTORE could not start database 'MYDBNAME'.Msg 3013, Level 16, State 1, Line 1RESTORE DATABASE is terminating abnormally.
恢复的数据库此时处于脱机状态
---------------------------------------------------------------------------------------------------------------
联机丛书搜索MSSQL_ENG003165
找到如下解决方案:
1. 执行 ALTER DATABASE 以使数据库联机;例如:ALTER DATABASE AdventureWorks SET ONLINE。 有关详细信息,请参阅 ALTER DATABASE (Transact-SQL)。 如果要保留复制设置,请转到步骤 2。 否则,转到步骤 3。
2. 执行 sp_restoredbreplication (Transact-SQL)。 如果此存储过程成功执行,则还原完成。 如果此存储过程未成功执行,请转到步骤 3。
3. 执行 sp_removedbreplication (Transact-SQL) 以删除所有复制设置。 如果需要,请重新配置复制。 如果您根据建议将复制拓扑编写了脚本,请使用脚本来重新配置该拓扑。
我执行到第2步的时候成功删除复制设置了,脚本如下:
ALTER DATABASE MYDBNAME SET ONLINE USE MASTER DECLARE @srv_orig AS sysname = 'MYINSNAME' DECLARE @db_orig AS sysname ='MYDBNAME' EXEC sp_restoredbreplication @srv_orig,@db_orig ALTER DATABASE MYDBNAME SET MULTI_USER;
新闻热点
疑难解答