我正在使用 Visual Studio 2008 项目创建和维护我的 SQL Server 2008 仓库数据库。
当我尝试部署项目时,出现如下错误
Creating DataWarehouseReports...
Company.HigherEducation.DataWarehouse.dbschema(0,0)Error TSD01268: .Net SqlClient Data Provider: Msg 2714, Level 16, State 6, Line 2 There is already an object named 'DataWarehouseReports' in the database.
Company.HigherEducation.DataWarehouse.dbschema(0,0)Error TSD01268: .Net SqlClient Data Provider: Msg 2759, Level 16, State 0, Line 2 CREATE SCHEMA failed due to previous errors.
An error occurred while the batch was being executed.
Done executing task "SqlDeployTask" -- FAILED.
Done building target "DspDeploy" in project "Company.HigherEducation.DataWarehouse.dbproj" -- FAILED.
Done executing task "CallTarget" -- FAILED.
Done building target "DBDeploy" in project "Company.HigherEducation.DataWarehouse.dbproj" -- FAILED.
Done building project "Company.HigherEducation.DataWarehouse.dbproj" -- FAILED.
我发现,DataWarehouseReports 报告模式存在于主数据库中(被错误地授予),但是当我尝试在 OLAP 数据库中创建它时出现“重复”错误。
在开发中,我的 OLAP 和 OLTP 数据库在同一台服务器上,我遇到了同样的模式名称问题。目前,我在 OLTP 和 OLAP 中对模式的命名不同,但为了保持一致性,我宁愿使用相同的名称。
我该如何调试?
编辑:PEBCAC 警报
我发现我有一个预部署的 sql 脚本,可以将数据库上下文更改为 MASTER。我的脚本失败了,因此上下文从未被改回。
因此,当我的脚本的其余部分执行时,它实际上是在尝试在 Master 中创建所有内容。
经验教训: 在项目部署时阅读输出。