简体   繁体   English

将部署在SQL Server上的SSIS包复制回Visual Studio 2008

[英]Copying SSIS packages deployed on SQL Server back to Visual Studio 2008

My Development SSIS box with my Visual studio 2008 installation is not working anymore. 我的Visual Studio 2008安装中的Development SSIS框不再起作用。 I am trying to figure out how I can take the packages running on my production SQL 2008 SP2 server and insert them into a new installation of Visual Studio on a new server. 我试图弄清楚如何获取在生产SQL 2008 SP2服务器上运行的软件包并将它们插入新服务器上的Visual Studio的新安装中。

thanks 谢谢

Packages are just xml files. 包只是xml文件。 Just copy the files local, create a new empty project and then import the *.dtsx files into the project by using the Add Existing dialog choice from the Solution explorer. 只需将文件复制到本地,创建一个新的空项目,然后使用“解决方案”资源管理器中的“添加现有”对话框选择,将* .dtsx文件导入该项目。

I'm assuming the OP is aware of a basic file copy but I believe their issue is they have the packages deployed into the MSDB. 我假设OP知道基本文件副本,但是我相信他们的问题是他们已将软件包部署到MSDB中。

To extract packages from the MSDB, you must first identify where in the msdb they exist. 要从MSDB中提取程序包,必须首先确定它们在msdb中的位置。 For that, you can query sysssispackagefolders and sysssispackages or you can just use my query SSIS Package Query 为此,您可以查询sysssispackagefolders和sysssispackages,也可以只使用我的查询SSIS Package Query

Armed with that query, the column of interest is the PackagePath column. 有了该查询,感兴趣的列就是PackagePath列。 Couple that with dtutil and you have an extract-o-matic for package recovery. 将其与dtutil结合使用 ,您将获得Extract -o-matic来进行软件包恢复。

The base form of an extract from MSDB on localhost to the current folder in the file system would look like. 从本地主机上的MSDB提取到文件系统中当前文件夹的基本形式看起来像。

dtutil /sourceserver localhost /SQL "Package" /copy file;.\\Package.dtsx

Extract-o-matic 提取物

Run this query in Text mode (ctr-T) This query generates a series of dtutil calls which in turn extracts SSIS packages from a server. 在文本模式(ctr-T)中运行此查询。此查询生成一系列dtutil调用,这些调用又从服务器提取SSIS包。

;
WITH FOLDERS AS
(
    -- Capture root node
    SELECT
        cast(PF.foldername AS varchar(max)) AS FolderPath
    ,   PF.folderid
    ,   PF.parentfolderid
    ,   PF.foldername
    FROM
        msdb.dbo.sysssispackagefolders PF
    WHERE
        PF.parentfolderid IS NULL

    -- build recursive hierarchy
    UNION ALL
    SELECT
        cast(F.FolderPath + '\' + PF.foldername AS varchar(max)) AS FolderPath
    ,   PF.folderid
    ,   PF.parentfolderid
    ,   PF.foldername
    FROM
        msdb.dbo.sysssispackagefolders PF
        INNER JOIN
            FOLDERS F
            ON F.folderid = PF.parentfolderid
)
,   PACKAGES AS
(
    -- pull information about stored SSIS packages
    SELECT
        P.name AS PackageName
    ,   P.id AS PackageId
    ,   P.description as PackageDescription
    ,   P.folderid
    ,   P.packageFormat
    ,   P.packageType
    ,   P.vermajor
    ,   P.verminor
    ,   P.verbuild
    ,   suser_sname(P.ownersid) AS ownername
    FROM
        msdb.dbo.sysssispackages P
)
SELECT 
    -- assumes default instance and localhost
    -- use serverproperty('servername') and serverproperty('instancename') 
    -- if you need to really make this generic
    'dtutil /sourceserver localhost /SQL "'+ F.FolderPath + '\' + P.PackageName + '" /copy file;.\' + P.PackageName +'.dtsx'
FROM 
    FOLDERS F
    INNER JOIN
        PACKAGES P
        ON P.folderid = F.folderid
-- uncomment this if you want to filter out the 
-- native Data Collector packages
-- WHERE
--     F.FolderPath <> '\Data Collector'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM