aws rds监控慢sql_如何使用S3将示例数据库导入到AWS RDS Microsoft SQL Server

aws rds监控慢sql

This guide was created because it was so hard to find a way to play around with a sample database using AWS RDS MSSQL Server. I hope you find this helpful.

之所以创建本指南,是因为很难找到一种使用AWS RDS MSSQL Server来处理示例数据库的方法。 我希望你觉得这有帮助。

If you haven't set up your AWS RDS Microsoft SQL Server and Azure Data Studio, check this guide first: How to Connect your AWS RDS Microsoft SQL Server using Azure Data Studio.

如果尚未设置AWS RDS Microsoft SQL Server和Azure Data Studio,请首先检查此指南: 如何使用Azure Data Studio连接AWS RDS Microsoft SQL Server

We will be touching the technologies shown below:

我们将涉及以下技术:

  • Database: AWS RDS Microsoft SQL Server Express Edition

    数据库:AWS RDS Microsoft SQL Server Express版
  • Database tool and GUI: Azure Data Studio

    数据库工具和GUI:Azure Data Studio
  • Sample database backup copy: Amazon S3 Bucket

    示例数据库备份副本:Amazon S3存储桶

AdventureWorks示例数据库备份副本 (AdventureWorks sample database backup copy)

To get the OLTP downloads of AdventureWorks, go to this link and choose any sample database. In my example, I choose AdventureWorks2017.bak. We will upload this to the S3 Bucket.

要获得AdventureWorks的OLTP下载,请转到此链接并选择任何示例数据库。 在我的示例中,我选择AdventureWorks2017.bak 。 我们将其上传到S3存储桶。

亚马逊S3桶 (Amazon S3 Bucket)

创建S3存储桶 (Creating the S3 Bucket)

  1. Create a bucket. You can choose any bucket name (example: yourname-sample-dbs).

    创建一个存储桶。 您可以选择任何存储桶名称(例如:yourname-sample-dbs)。

2. Make sure the region is same as the AWS RDS instance.

2.确保区域与AWS RDS实例相同。

3. Tick the following checkboxes:

3.勾选以下复选框:

  • Block public access to buckets and objects granted through new access control lists (ACLs)

    阻止对通过访问控制列表(ACL)授予的存储桶和对象的公共访问

  • Block public access and objects granted through any access control lists (ACLs)

    阻止公共访问和通过任何访问控制列表(ACL)授予的对象

4. Access your bucket again by clicking on your created bucket.

4.单击创建的存储桶,再次访问您的存储桶。

将文件上传到S3存储桶 (Uploading the file to the S3 bucket)

  1. Click Upload.

    点击上传

2. Choose the database backup file. For example: AdventureWorks2017.bak. Keep choosing Next and choose Upload at the Review section.

2.选择数据库备份文件。 例如: AdventureWorks2017.bak 。 继续选择“ 下一步”,然后在“查看”部分选择“ 上传 ”。

3. Update your Bucket Policy to allow access to your S3 Bucket. Note that your ARN will differ to mine. Hit Save afterwards.

3.更新您的存储桶策略以允许访问您的S3存储桶。 请注意,您的ARN将与我的不同。 然后点击保存

{
    "Version": "2012-10-17",
    "Id": "Policy1548223592786",
    "Statement": [
        {
            "Sid": "Stmt1548223591553",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::changethis/*"
        }
    ]
}

AWS RDS-MSSQL Server Express
(AWS RDS - MSSQL Server Express)

为您的RDS实例创建选项组 (Creating an Option Group for your RDS instance)

  1. Click Option groups,

    点击选项组

2. Create an option group. Choose any name and description. For the Engine, it should match your RDS instance. In my example, I used SQL Server Express Edition so I choose sqlserver-ex.

2.创建一个选项组。 选择任何名称和描述。 对于引擎,它应与您的RDS实例匹配。 在我的示例中,我使用了SQL Server Express Edition,因此选择sqlserver-ex

Here are the following Engines and their abbreviations:

以下是以下引擎及其缩写:

  • SQL Server Enterprise Edition: sqlserver-ee

    SQL Server企业版: sqlserver-ee

  • SQL Server Standard Edition: sqlserver-se

    SQL Server标准版: sqlserver-se

  • SQL Server Web Edition: sqlserver-web

    SQL Server Web版: sqlserver-web

  • SQL Server Express Edition: sqlserver-ex

    SQL Server Express Edition: sqlserver-ex

3. Once you have created the option group, you'll need to Add option.

3.创建选项组后,需要添加选项

4. Choose SQLSERVER_BACKUP_RESTORE for your Option name. For the IAM role, it is best to create a new role.

4.选择SQLSERVER_BACKUP_RESTORE作为您的选项名称。 对于IAM角色,最好创建一个新角色。

5. Choose the S3 bucket where your database file is hosted. For scheduling, choose Immediately.

5.选择托管数据库文件的S3存储桶。 对于计划,请选择立即

6. Go back to your AWS RDS MSSQL Server instance and click Modify.

6.返回您的AWS RDS MSSQL Server实例,然后单击Modify

7. Choose the created option group with sql-server-express-backup, then Click Continue.

7.使用sql-server-express-backup选择创建的选项组,然后单击“继续”。

8. Choose to Apply immediately for scheduling of modifications.

8.选择立即应用以安排修改时间。

9. Go back to your AWS RDS MSSQL Server instance page and scroll down and modify Manage IAM Roles. Add the IAM role you have created in S3. For the Feature, choose S3_INTEGRATION.

9.返回您的AWS RDS MSSQL Server实例页面,然后向下滚动并修改Manage IAM Roles 。 添加您在S3中创建的IAM角色。 对于功能,选择S3_INTEGRATION

Azure数据工作室 (Azure Data Studio)

通过还原功能将样本数据库导入S3存储桶中 (Importing the sample database in S3 bucket through restore function)

  1. In your connected AWS RDS MSSQL Server, create a new query and type in the following:

    在已连接的AWS RDS MSSQL Server中,创建一个新查询并输入以下内容:
exec msdb.dbo.rds_restore_database 
@restore_db_name='AdventureWorks-test', 
@s3_arn_to_restore_from='arn:aws:s3:::clark-sample-dbs/AdventureWorks2017.bak';

Refresh your Azure Data Studio. Also, try restarting the application if your database did not appear or don't have permission to access it.

刷新您的Azure Data Studio。 另外,如果您的数据库没有出现或没有访问权限,请尝试重新启动应用程序。

Now you are done! Good job! 🎉🎉🎉

现在您完成了! 做得好! 🎉🎉🎉

Resources:

资源:

Connect with me on LinkedIn here

此处通过LinkedIn与我联系

翻译自: https://www.freecodecamp.org/news/cjn-how-to-import-a-sample-database-to-your-aws-rds-microsoft-sql-server-using-s3/

aws rds监控慢sql

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值