将查询结果作为文件发送到外部 sFtp 服务器
Get query results as a file to send to an external sFtp Server
我在 Amazon RDS 中创建了一个 Sql 服务器实例。
我想做的是这样一个场景:
- 运行
SELECT
对驻留在我的云 Sql 服务器 上的数据库的查询
- 将查询结果输出到 .csv 文件。
- 将(2)中的文件发送到外部SFTP服务器。
我不确定的是:
- 如果没有我们在其中创建文件的本地服务器,步骤 (2) 中的文件将位于何处?
- AWS 是否有 FTP 解决方案。我用过 S3 但 S3 中的文件可以像普通 FTP 服务器一样访问吗?
RDS 将无法在没有帮助的情况下执行这些操作。您将需要一个 EC2 实例或其他一些 服务器 ,无论是本地托管的还是其他您可以 运行 BCP 作业、SSIS 包或其他自制的解决方案。 RDS 只是数据库引擎,RDS 上的 SQL 服务器中没有任何本地内容允许外部文件操作 and/or 传输。
来自亚马逊的 Importing and Exporting SQL Server Data Using Other Methods 页面:
Exporting Data from SQL Server on Amazon RDS
- Native database backup using a full backup file (.bak) – Using .bak files to backup databases is heavily optimized, and is usually the fastest way to export data. For more information, see Importing and Exporting SQL Server Databases.
- SQL Server Import and Export Wizard – For more information, see SQL Server Import and Export Wizard.
- SQL Server Generate and Publish Scripts Wizard and bcp utility – For more information, see SQL Server Generate and Publish Scripts Wizard and bcp Utility.
另一种选择可能是利用 AWS Lamdba 来执行此操作。我个人并没有深入研究这个问题,但是 this article from Amazon 描述了一个类似的从 Oracle 和 Postgre 导出数据的过程SQL 并且在文章的最后部分声明这对于 SQL服务器也是如此。
我在 Amazon RDS 中创建了一个 Sql 服务器实例。
我想做的是这样一个场景:
- 运行
SELECT
对驻留在我的云 Sql 服务器 上的数据库的查询
- 将查询结果输出到 .csv 文件。
- 将(2)中的文件发送到外部SFTP服务器。
我不确定的是:
- 如果没有我们在其中创建文件的本地服务器,步骤 (2) 中的文件将位于何处?
- AWS 是否有 FTP 解决方案。我用过 S3 但 S3 中的文件可以像普通 FTP 服务器一样访问吗?
RDS 将无法在没有帮助的情况下执行这些操作。您将需要一个 EC2 实例或其他一些 服务器 ,无论是本地托管的还是其他您可以 运行 BCP 作业、SSIS 包或其他自制的解决方案。 RDS 只是数据库引擎,RDS 上的 SQL 服务器中没有任何本地内容允许外部文件操作 and/or 传输。
来自亚马逊的 Importing and Exporting SQL Server Data Using Other Methods 页面:
Exporting Data from SQL Server on Amazon RDS
- Native database backup using a full backup file (.bak) – Using .bak files to backup databases is heavily optimized, and is usually the fastest way to export data. For more information, see Importing and Exporting SQL Server Databases.
- SQL Server Import and Export Wizard – For more information, see SQL Server Import and Export Wizard.
- SQL Server Generate and Publish Scripts Wizard and bcp utility – For more information, see SQL Server Generate and Publish Scripts Wizard and bcp Utility.
另一种选择可能是利用 AWS Lamdba 来执行此操作。我个人并没有深入研究这个问题,但是 this article from Amazon 描述了一个类似的从 Oracle 和 Postgre 导出数据的过程SQL 并且在文章的最后部分声明这对于 SQL服务器也是如此。