Azure数据迁移助手-View的迁移阻止程序对[INFORMATION_SCHEMA],sys.objects和sys.parameters的引用

时间:2019-01-28 21:58:26

标签: sql-server azure azure-sql-database

我们正在将项目数据库从本地SQL Server 2017实例移至Azure。我们一直在努力消除Data Migration Assistant报告的任何MigrationBlocker问题。从视图到我们自己数据库中的sys.objects,sys.parameters和各种[INFORMATION_SCHEMA]项目,我们有两个与未解决的引用有关的问题。

我们知道没有对其他数据库的任何引用。但是我们认为我们仍然可以在自己的模式中引用这些系统视图。怎么了?

我们尝试将第三方标识符添加到我们自己的数据库中,如下所示。还尝试对每列使用完整引用:SELECT SO.Name-> SELECT sys.object.Name

这是较小的视图:

CREATE VIEW [dbo].[VW_BUILD_PARAMETERS]
AS
SELECT 
CAST(SO.Name as sysname) AS ObjectName,
CASE SO.Type_Desc 
    WHEN 'SQL_STORED_PROCEDURE'             THEN 'Procedure'
    WHEN 'SQL_SCALAR_FUNCTION'              THEN 'Function'
    WHEN 'SQL_INLINE_TABLE_VALUED_FUNCTION' THEN 'Function'
END AS [ObjectType],
CAST(P.is_output as bit) AS IsOutPutParameter,
CAST(P.parameter_id as int) AS ParameterOrder,
REPLACE(P.name, '@','') AS ParameterName,
UPPER(TYPE_NAME(P.system_type_id)) AS ParameterType,
CASE 
    WHEN TYPE_NAME(P.user_type_id) = 'varchar' THEN          
CAST(P.max_length AS INT) 
END AS MaximumCharacterLength
FROM FOO.sys.objects AS SO    -- No change if this is: sys.objects as SO
INNER JOIN FOO.sys.parameters AS P  
   ON SO.OBJECT_ID = P.OBJECT_ID
WHERE SO.type IN ('P','FN','IF')
  AND P.parameter_id > 0

以下是DMA错误内容的示例:

View: [dbo].[VW_BUILD_PARAMETERS] has an unresolved reference to object [sys].[parameters]. For more details, please see: Line 21, Column 12.\n 

View: [dbo].[VW_BUILD_PARAMETERS] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: 
[sys].[objects].[OBJECT_ID], [sys].[objects].[objects]::[OBJECT_ID] or [sys].[parameters].[objects]::[OBJECT_ID]. For more details, please see: Line 22, Column 7.\n 

此错误中列出了14个项目。每个引用要么是sys表是未解决的引用,要么是列引用中的一个是模棱两可的。我假设如果我们修复未解决的sys表,它将解决列问题。

第二个视图仅使用[INFORMATION_SCHEMA]表,并给出相同模式的警告。

预期结果是通过解决阻塞错误使DMA工具满意,但让我们保留这两个视图。

0 个答案:

没有答案