重复模式

发布于 2024-07-30 05:17:02 字数 1399 浏览 3 评论 0原文

我正在使用 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 Alert

我发现我有一个预部署 SQL 脚本,它将数据库上下文更改为 MASTER。 我的脚本失败了,因此上下文从未被更改回来。

因此,当我的脚本的其余部分执行时,它实际上是在尝试在 Master 中创建所有内容。

经验教训: 在项目部署时读取输出。

I am creating and maintaining my SQL Server 2008 warehouse database using a Visual Studio 2008 project.

When I try to deploy the project, I get an error as below

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.

What I found, is that the DataWarehouseReports reports schema exists in the master database (granted, by mistake), but I get the "duplicate" error when I try to create it in the OLAP database.

In development, my OLAP and OLTP databases are on the same server, and I encounter the same problem for schema names. For now, I have named schemas differently in the OLTP vs. the OLAP, but for consistency sakes, I would rather have the same name.

How do I debug this?

edit: PEBCAC Alert

I found out that I have a pre-deployment sql script that changes the database context to MASTER. My script was failing and therefore the context never was changed back.

So when the rest of my script executed, it was actually trying to create everything in Master.

Lesson learned: Read the output when the project Deploys.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

望喜 2024-08-06 05:17:02

基本上,VS2008 项目创建一个 .SQL 文件,其中更改数据库只是创建数据库的位置。 如果您在预部署中更改上下文,则需要您将其更改回来。

Basically, the VS2008 project creates a .SQL file and in which the change DB is only where the DB gets created. If you change context in the Pre-Deployment, it is up to you to change it back.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文