Powershell部署脚本:
Executing: C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe /Action:Publish /SourceFile:********.dacpac /Profile:Release.Publish.xml /TargetConnectionString:server=********;database=********;uid==********;pwd=********;app=********;timeout=900 /p:IgnoreAuthorizer=True /p:IgnorePermissions=True /p:IgnoreRoleMembership=True /p:IgnoreUserSettingsObjects=True /p:BlockOnPossibleDataLoss=False /p:TreatVerificationErrorsAsWarnings=True /p:GenerateSmartDefaults=True
Error *** The object [********] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Error *** The object [********_log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Info Initializing deployment (Complete)
Info Analyzing deployment plan (Start)
Info Analyzing deployment plan (Complete)
Info Updating database (Start)
Info Starting ********.sql
Info Update complete.
Info Updating database (Complete)
Info Successfully published database.
Release.Publish.xml:
False
False
True
False
True
False
Release.sql
1
False
为什么要放弃mdf和mdf?
从使用命令行工具面向项目的数据库开发:我可以看出修复可能是使用DoNotDropObjectType使DropObjectsNotInSource行为更负责任,如果是这样的话?
老实说,我很困惑,为什么这个问题一开始就是个问题。
发布于 2018-05-15 13:02:35
如果mdf和ldf文件位于非默认位置(或具有非默认前缀/名称),则需要将该信息添加到SSDT项目中。这将有助于模式比较操作(在执行发布时发生),以确定文件位于正确的位置,不需要删除/重新创建文件。
右键单击项目->添加新项->文件组文件
你会得到这样的东西:
/*
Do not change the database path or name variables.
Any sqlcmd variables will be properly substituted during
build and deployment.
*/
ALTER DATABASE [$(DatabaseName)]
ADD FILE
(
NAME = [SqlFile1],
FILENAME = '$(DefaultDataPath)$(DefaultFilePrefix)_SqlFile1.ndf'
)
修改该脚本,使其指向所需的主数据文件(mdf)位置,并且您的部署应该进行得更加顺利。
注意,$(DefaultDataPath)
是由目标实例的设置设置的:
$(DefaultFilePrefix)
由publish.xml文件中的"TargetDatabaseName“设置。
https://dba.stackexchange.com/questions/206701
复制相似问题