我在SSMS上为所有数据库创建了一个优化作业。作业失败,并显示以下错误代码。但是,当我为此数据库单独运行优化时,它运行良好。如果我排除此数据库并对所有其他数据库进行优化,则对于其他数据库,它也会失败,并出现相同的错误。
有人对此错误有经验吗?
以用户身份执行:domain \ username。 ... 11.0.7462.6适用于64位版权(C)Microsoft Corporation。版权所有。开始时间:3:00:00 AM进度:2018-10-26 03:00:01.97来源:{FACD34E4-BAFB-46D9-8D2E-30BC2BF03D45}执行查询“ DECLARE @Guid UNIQUEIDENTIFIER EXECUTE msdb..sp ...”。 :100%完成最终进度进度:2018-10-26 03:01:00.20
资料来源:重建索引
执行查询“ USE [Databasename]” 。:完成1%最终进度进度:2018-10-26 03:01:00.22来源:重建索引执行查询“ ALTER INDEX [PK__DatabasenameActivities] ON [dbo]。[DatabasenameActiv ...” 。:2%完成最终进度进度:2018-10-26 03:01:00.22来源:Rebuild Index执行查询“ USE [Databasename]” 。: 4%完成最终进度进度:2018-10-26 03:01:00.23资料来源:重建索引
正在执行查询“ ALTER INDEX [PK__DatabasenameAlert_Id] ON [dbo]。[DatabasenameAlerts] ...” 。:完成5%进度进度:2018-10-26 03:01:00.23来源:重建索引
执行查询“ USE [Databasename]” 。:完成7%进度进度:2018-10-26 03:01:00.23来源:重建索引执行查询“ ALTER INDEX [PK__DatabasenameApplicationDatabasenameActivity] ON [db ...” 。: 8%完成的最终进度进度:2018-10-26 03:01:00.23来源:重建索引执行查询“ USE [数据库名称]” 。: 10%完成的最终进度进度:2018-10-26 03:01:00.23来源:重建索引
执行查询“ ALTER INDEX [PK__DatabasenameApplicationDatabasenameProcess] ON [dbo ...”。。:完成11%结束进度进度:2018-10-26 03:01:00.25来源:重建索引
执行查询“ USE [Databasename]” 。:完成12%最终进度进展:2018-10-26 03:01:00.25来源:Rebuild Index执行查询“ ALTER INDEX [PK__DatabasenameApplications] ON [dbo]。[DatabasenameApp ...” 。:完成14%的最终进度进度:2018-10-26 03:01:00.25来源:Rebuild Index执行查询“ USE [Databasename]” ..:完成15%的最终进度进度:2018-10-26 03:01:00.31资料来源:重建索引
正在执行查询“ ALTER INDEX [IX__DatabasenameBinaryStores_ResultId] ON [dbo ...”。。:完成17%结束进度进度:2018-10-26 03:01:00.31来源:重建索引
执行查询“ USE [Databasename]” 。:完成18%最终进度进展:2018-10-26 03:01:00.42来源:Rebuild Index执行查询“ ALTER INDEX [PK__DatabasenameBinaryStores] ON [dbo]。[DatabasenameBin ...” 。:20%完成最终进度进度:2018-10-26 03:01:00.42来源:Rebuild Index执行查询“ USE [Databasename]” 。: 21%完成最终进度进度:2018-10-26 03:01:00.44资料来源:重建索引
执行查询“ ALTER INDEX [PK__DatabasenameConfigurations] ON [dbo]。[DatabasenameC ...” 。:完成22%结束进度:2018-10-26 03:01:00.44来源:重建索引
执行查询“ USE [Databasename]” 。:完成24%最终进度进展:2018-10-26 03:01:00.44来源:重建索引执行查询“ ALTER INDEX [PK__DatabasenameConnections] ON [dbo]。[DatabasenameConn ...” 。:已完成25%的最终进度进度:2018-10-26 03:01:00.44来源:Rebuild Index执行查询“ USE [Databasename]” 。:已完成27%的最终进度进度:2018-10-26 03:01:00.44资料来源:重建索引
正在执行查询“ ALTER INDEX [PK__DatabasenameEvent__3214EC072A4B4B5E] ON [d ...” 。:完成28%结束进度:2018-10-26 03:01:00.45来源:重建索引
执行查询“ USE [Databasename]” 。:完成30%结束进度进展:2018-10-26 03:01:00.45来源:重建索引执行查询“ ALTER INDEX [PK_DatabasenameFileWatcherRepository] ON [dbo] ...” 。: 31完成完成百分比进展进度:2018-10-26 03:01:00.45来源:重建索引执行查询“ USE [Databasename]” 。:完成完成进度32%完成进度进展:2018-10-26 03:01:00.45来源:重建索引
执行查询“ ALTER INDEX [PK_DatabasenameFtpWatcherRepository] ON [dbo] ....” 。:完成34%结束进度:2018-10-26 03:01:00.45来源:重建索引
正在执行查询“ USE [Databasename]” 。: 35%完成结束进度进度...程序包执行失败...步骤失败。
仅针对错误消息中提到的数据库名称运行作业时,一切正常。
Message
Executed as user: DOMAIN\USERNAME. ....0.7462.6 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 8:20:00 AM Progress: 2018-10-25 08:20:01.97 Source: {FACD34E4-BAFB-46D9-8D2E-30BC2BF03D45} Executing query "DECLARE @Guid UNIQUEIDENTIFIER EXECUTE msdb..sp...".: 100% complete End Progress Progress: 2018-10-25 08:20:04.10 Source: Rebuild Index
Executing query "USE [Databasename] ".: 1% complete End Progress Progress: 2018-10-25 08:20:04.12 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameActivities] ON [dbo].[DatabasenameActiv...".: 2% complete End Progress Progress: 2018-10-25 08:20:04.12 Source: Rebuild Index Executing query "USE [Databasename] ".: 4% complete End Progress Progress: 2018-10-25 08:20:04.13 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameAlert_Id] ON [dbo].[DatabasenameAlerts]...".: 5% complete End Progress Progress: 2018-10-25 08:20:04.15 Source: Rebuild Index
Executing query "USE [Databasename] ".: 7% complete End Progress Progress: 2018-10-25 08:20:04.15 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameApplicationDatabasenameActivity] ON [db...".: 8% complete End Progress Progress: 2018-10-25 08:20:04.15 Source: Rebuild Index Executing query "USE [Databasename] ".: 10% complete End Progress Progress: 2018-10-25 08:20:04.15 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameApplicationDatabasenameProcess] ON [dbo...".: 11% complete End Progress Progress: 2018-10-25 08:20:04.15 Source: Rebuild Index Executing query "USE [Databasename] ".: 12% complete End Progress Progress: 2018-10-25 08:20:04.16 Source: Rebuild Index Executing query "ALTER INDEX [PK__DatabasenameApplications] ON [dbo].[DatabasenameApp...".: 14% complete End Progress Progress: 2018-10-25 08:20:04.16 Source: Rebuild Index
Executing query "USE [Databasename] ".: 15% complete End Progress Progress: 2018-10-25 08:20:04.43 Source: Rebuild Index
Executing query "ALTER INDEX [IX__DatabasenameBinaryStores_ResultId] ON [dbo...".: 17% complete End Progress Progress: 2018-10-25 08:20:04.43 Source: Rebuild Index Executing query "USE [Databasename] ".: 18% complete End Progress Progress: 2018-10-25 08:20:04.62 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameBinaryStores] ON [dbo].[DatabasenameBin...".: 20% complete End Progress Progress: 2018-10-25 08:20:04.62 Source: Rebuild Index
Executing query "USE [Databasename] ".: 21% complete End Progress Progress: 2018-10-25 08:20:04.62 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameConfigurations] ON [dbo].[DatabasenameC...".: 22% complete End Progress Progress: 2018-10-25 08:20:04.62 Source: Rebuild Index Executing query "USE [Databasename] ".: 24% complete End Progress Progress: 2018-10-25 08:20:04.63 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameConnections] ON [dbo].[DatabasenameConn...".: 25% complete End Progress Progress: 2018-10-25 08:20:04.63 Source: Rebuild Index
Executing query "USE [Databasename] ".: 27% complete End Progress Progress: 2018-10-25 08:20:04.63 Source: Rebuild Index
Executing query "ALTER INDEX [PK__DatabasenameEvent__3214EC072A4B4B5E] ON [d...".: 28% complete End Progress Progress: 2018-10-25 08:20:04.63 Source: Rebuild Index Executing query "USE [Databasename] ".: 30% complete End Progress Progress: 2018-10-25 08:20:04.65 Source: Rebuild Index
Executing query "ALTER INDEX [PK_DatabasenameFileWatcherRepository] ON [dbo]...".: 31% complete End Progress Progress: 2018-10-25 08:20:04.65 Source: Rebuild Index
Executing query "USE [Databasename] ".: 32% complete End Progress Progress: 2018-10-25 08:20:04.65 Source: Rebuild Index
Executing query "ALTER INDEX [PK_DatabasenameFtpWatcherRepository] ON [dbo]....".: 34% complete End Progress Progress: 2018-10-25 08:20:04.65 Source: Rebuild Index Executing query "USE [Databasename] ".: 35% complete End Progress Pro... The package executed successf... The step succeeded.
如上所述,当我排除错误来自的第一个数据库时,错误跳至第二个数据库。
答案 0 :(得分:0)
不建议使用SQL Server维护计划。而是使用Ola的脚本。
https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html