ssis 计划任务_SSIS FTP任务概述

ssis 计划任务

In this article, we will explain the File Transfer Protocol (FTP), and we will give an overview of the FTP task in SQL Server Integration Services (SSIS) and FTP connection manager.

在本文中,我们将解释文件传输协议(FTP),并概述SQL Server Integration Services(SSIS)和FTP连接管理器中的FTP任务。

介绍 (Introduction)

As the name implies, File Transfer Protocol (FTP) is a network protocol to transfer files between computers. This protocol is built on a client-server model. Using FTP you can send or receive files; sending files is noted as “put” and receiving is noted as “get”.

顾名思义,文件传输协议(FTP)是在计算机之间传输文件的网络协议。 该协议建立在客户端-服务器模型上。 使用FTP,您可以发送或接收文件; 发送文件标记为“ 放置” ,接收文件标记为“ 获取”。

You don’t need to go through more details about FTP, the main thing you should know is that even you didn’t hear about this protocol you have surely used it when uploading or downloading files and applications from your web browser or download manager.

您无需了解有关FTP的更多详细信息,您应该知道的主要事情是,即使您没有听说过该协议,您在从Web浏览器或下载管理器上载或下载文件和应用程序时也肯定使用过该协议。

If you want to learn more about FTP, you can do a simple search for “FTP” word, and there are plenty of articles online that describes this protocol very well.

如果您想了解有关FTP的更多信息,可以简单地搜索“ FTP”一词,在线上有很多文章很好地描述了该协议。

In the following sections, we will describe how to establish an FTP connection and perform FTP Tasks using SQL Server Integration Services. To run an example, we will enable the FTP server feature on our local machine (Windows 10).

在以下各节中,我们将描述如何使用SQL Server Integration Services建立FTP连接和执行FTP任务。 为了运行示例, 我们将在本地计算机 (Windows 10) 上启用FTP服务器功能

SSIS FTP连接管理器 (SSIS FTP connection manager)

Before illustrating the SSIS FTP Task, we should explain the FTP connection manager, since it is used to establish a connection with an FTP server which is required by the FTP Task.

在说明SSIS FTP任务之前,我们应该先说明FTP连接管理器,因为它用于与FTP任务所需的FTP服务器建立连接。

If you right-click on in the connection manager tab, you may note that this type of connection manager is not available in the context menu strip. To add this connection manager, you must click on the “New connection” button as shown below:

如果在“连接管理器”选项卡上单击鼠标右键,您可能会注意到,上下文菜单栏中没有这种类型的连接管理器。 要添加此连接管理器,必须单击“新建连接”按钮,如下所示:

Adding a FTP connection manager

Figure 1 – Adding an FTP connection manager

图1 –添加FTP连接管理器

Then from the connection managers list, you must choose the FTP connection manager:

然后,从连接管理器列表中,必须选择FTP连接管理器:

selecting FTP from connection managers list

Figure 2 – Selecting FTP from connection managers list

图2 –从连接管理器列表中选择FTP

After selecting the FTP connection manager, the connection manager form appears. To run an example, we have created an FTP site on port 21 which read from a local folder and doesn’t require permissions. Based on that we configured the connection manager as shown below:

选择FTP连接管理器后,将显示“连接管理器”表单。 为了运行示例,我们在端口21上创建了一个FTP站点,该站点从本地文件夹读取并且不需要权限。 基于此,我们配置了连接管理器,如下所示:

Configuring FTP connection manager

Figure 3 – FTP connection manager configuration

图3 – FTP连接管理器配置

You can note that the FTP connection manager contains the following properties:

您可以注意到,FTP连接管理器包含以下属性:

  • Server Name: The FTP server name (example: ftp.companyame.com) 服务器名称: FTP服务器名称(例如:ftp.companyame.com)
  • Server Port: The port number used 服务器端口:使用的端口号
  • User Name: The user name used for authentication 用户名:用于认证的用户名
  • Password: The password used for authentication 密码:用于验证的密码
  • Use passive mode: If checked the client activates the connection (passive mode), else the server initiates the connection 使用被动模式:如果选中,客户端将激活连接(被动模式),否则服务器将启动连接
  • Retries: Number of retires allowed to establish a connection 重试次数:允许建立连接的退休次数
  • Test Connection:  check whether our connection is successful or not 测试连接:检查我们的连接是否成功

You can read more about the FTP connection manager on the Microsoft official documentation.

您可以在Microsoft官方文档中阅读有关FTP连接管理器的更多信息

SSIS FTP任务 (SSIS FTP Task)

After creating an FTP connection manager, we should add an SSIS FTP Task to download and upload files and manages directories on the FTP server. As shown in the image below, the FTP Task is described as a task that “Works with FTP Servers. Manage directories or download and upload data files”.

创建FTP连接管理器后,我们应该添加一个SSIS FTP任务来下载和上传文件以及管理FTP服务器上的目录。 如下图所示,FTP任务被描述为“与FTP服务器一起使用。 管理目录或下载和上传数据文件”

SSIS FTP Task description from SSIS toolbox

Figure 4 – FTP Task description from SSIS Toolbox

图4 – SSIS工具箱中的FTP任务描述

In the SSIS FTP Task editor form, there are three tab pages:

在“ SSIS FTP任务编辑器”表单中,有三个选项卡页:

  • General: On this page, we should specify the task name, description, the FTP connection manager we will use to establish a connection and whether this task stops on FTP operation failure

    常规 :在此页面上,我们应该指定任务名称,描述,将用于建立连接的FTP连接管理器以及该任务是否在FTP操作失败时停止

    SSIS FTP Task editor - General tab page

    Figure 5 – FTP Task general tab page

    图5 – FTP Task的General选项卡页面

  • File Transfer: On this page, we can configure the operation we need to execute. As shown in the image below, there is a different operation that can be executed such as:

    文件传输 :在此页面上,我们可以配置需要执行的操作。 如下图所示,可以执行不同的操作,例如:

    • Send files: Upload files from your machine to the FTP server 发送文件 :将文件从您的计算机上载到FTP服务器
    • Receive files: Download files from the FTP server 接收文件 :从FTP服务器下载文件
    • Create a local directory: Create a directory on your machine 创建本地目录 :在计算机上创建目录
    • Create a remote directory: Create a directory on the FTP server 创建远程目录 :在FTP服务器上创建目录
    • Remove local directory: Delete a directory on your machine 删除本地目录 :删除计算机上的目录
    • Remove remote directory: Delete a directory on the FTP server 删除远程目录 :删除FTP服务器上的目录
    • Delete local files: Delete files from your machine 删除本地文件 :从您的计算机上删除文件
    • Delete remote files: Delete files from the FTP server 删除远程文件 :从FTP服务器删除文件


    And each one of these operations has its configuration, you will note that the available properties on this page will change when the operation type change

    每个操作都有其配置,您会注意到,当操作类型更改时,此页面上的可用属性也会更改

    SSIS FTP Task editor - File Transfer tab page

    Figure 6 – FTP task file transfer tab page

    图6 – FTP任务文件传输选项卡页面

  • Expressions: This page is used to evaluate the SSIS FTP Task properties as expressions (similar to any other SSIS task) 表达式 :此页面用于将SSIS FTP任务属性评估为表达式(类似于任何其他SSIS任务)

In this example, we will upload files from the local machine to the FTP server, so we will select the “Send Files” operation type. As shown in the image below, we have to set the following parameters:

在此示例中,我们将文件从本地计算机上载到FTP服务器,因此我们将选择“发送文件”操作类型。 如下图所示,我们必须设置以下参数:

  • Local Parameters: which are related to the files we need to upload: 本地参数 :与我们需要上传的文件有关:
    • IsLocalPathVariable: Specify if we need to read the local path from an SSIS variable IsLocalPathVariable :指定是否需要从SSIS变量读取本地路径
    • LocalPath: Specify the local file path; if IsLocalPathVariable is set to true then we have to select the SSIS variable. Else, we need to select a File Connection Manager LocalPath :指定本地文件路径; 如果IsLocalPathVariable设置为true,那么我们必须选择SSIS变量。 否则,我们需要选择一个文件连接管理器
  • Operation: which are related to the FTP operation: 操作 :与FTP操作有关:
    • Operation: The operation type (we mentioned it above) 操作 :操作类型(我们在上面提到过)
    • IsTransferASCII: Indicate whether files transferred to and from the remote FTP server should be transferred in ASCII mode IsTransferASCII :指示是否应以ASCII模式传输往返于远程FTP服务器的文件。
  • Remote Parameters: which are related to the destination (FTP Server) 远程参数 :与目标(FTP服务器)相关
    • IsRemotePathVariable: Specify if we need to read the destination path from an SSIS variable IsRemotePathVariable:指定是否需要从SSIS变量读取目标路径
    • RemotePath: Specify the destination file path; if IsRemotePathVariable is set to true then we have to select the SSIS variable. Else, we need to enter it manually RemotePath:指定目标文件路径; 如果IsRemotePathVariable设置为true,那么我们必须选择SSIS变量。 否则,我们需要手动输入
    • OverwriteFileAtDest: Select if we want to overwrite the existing file on the FTP server OverwriteFileAtDest :选择是否要覆盖FTP服务器上的现有文件

Configuring FTP Task to upload file to the FTP Server

Figure 7 – Configuring FTP Task

图7 –配置FTP任务

After configuring the FTP task, we execute the package. If we go to the remote directory, we will see that the file is uploaded successfully.

配置FTP任务后,我们执行该程序包。 如果转到远程目录,将看到文件已成功上传。

File added successfully to the remote path

Figure 8 – File uploaded to the remote path

图8 –文件上传到远程路径

If you need to read more information about different SSIS FTP Task operations, you can refer to the Microsoft official documentation.

如果需要阅读有关不同的SSIS FTP任务操作的更多信息,则可以参考Microsoft官方文档。

结论 (Conclusion)

In this article, we have briefly described File Transfer Protocol (FTP) and how to establish FTP connections and how to perform FTP operations such as uploading and downloading files in SQL Server Integration Services.

在本文中,我们简要介绍了文件传输协议(FTP)以及如何建立FTP连接以及如何执行FTP操作,例如在SQL Server Integration Services中上载和下载文件。

翻译自: https://www.sqlshack.com/an-overview-of-ssis-ftp-task/

ssis 计划任务

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值