Restore AWS RDS Databases On-Premises

AWS, RDS, SQL Server, Uncategorized
Did you know that you can restore AWS RDS databases to a SQL Server 2022 instance running locally using native backup and restore? Well you can. Let's talk about it. Why S3? So, why put backups on S3 at all? Two big reasons. Let's say you're mostly, or strictly, on-premises with your servers. You can use S3 storage on AWS as a way to get your backups offsite. I just recently tried to help someone in the forums who was taking backups, but not testing them in any way, only to find that their local storage had become corrupted and when they needed the backup, it wasn't there. First, of course, they should be testing their backups. However, in addition, they should have moved the backup to an offsite location.…
Read More

What Happens On AWS RDS?

AWS, RDS
I was talking with some developers from my team about monitoring, and I said, "We all use the same tools," referring to other monitoring software. Then, it hit me. How is AWS collecting monitoring data on it's RDS servers, specifically, the SQL Server instances. So, I set out to determine what happens on AWS RDS when it comes to the native monitoring. The Setup This part should be as obvious as it is easy. I'm going to use Extended Events. I've written before about how AWS RDS supports Extended Events, so I won't repeat all that here. I'll just leave you with the session I'm running to see what happens on AWS RDS: CREATE EVENT SESSION [ExEventTesting] ON SERVER ADD EVENT sqlserver.rpc_completed, ADD EVENT sqlserver.sql_batch_completed ADD TARGET package0.event_file (SET filename…
Read More

AWS RDS Restore To A Point In Time

AWS, PostgreSQL, RDS
The single most important part of backups are not backups. The single most important part of backups are restores. It doesn't matter a lick if you have 100, flawless backups of your database if you can't restore one of them. So, let's get started and talk about how perform an RDS restore. RDS Restore I'm going to use the portal because I like how GUIs allow me to easily illustrate what I'm doing. However, I'll probably do another post soon on how to use the command line to do this. That is the better approach in most cases. If you connect up to a database within RDS, you get a menu, Actions: Right there, near the bottom is what we're looking for, Restore to point in time. Clicking on this…
Read More

AWS RDS Backups

AWS, PostgreSQL, RDS
One of the things I love the most about Platform as a Service when it comes to data is the fact that you get RDS backups, built in. Go to the forums. Evidently, backups are one, or more, of the following:a) insanely difficult, so no one does themb) not considered important so no one does themc) not necessary in modern systems because of X technology so no one does them Then, someone deletes a row the business wants back. Someone drops a table. Someone drops a database. Then you find that one, or more, of the following is true:a) no one has ever tried to restore from X technology and you can'tb) come to find out, X technology doesn't really do backupsc) backups are still fundamental to protecting data Enter,…
Read More

Learning PostgreSQL: The Tools

AWS, PostgreSQL, RDS
In case you don't know, I've been writing a series of articles over on Simple-Talk as I learn PostgreSQL. It's all from the point of view of a SQL Server person, expanding into a new technology. In other words, a true story. I thought I'd take a moment here on my own blog to talk about the tools I'm using and why I chose those. AWS RDS Let's establish up front, I'm lazy. Very lazy. So yeah, I'm trying to learn this new technology, but I'm going to find as many ways to use the knowledge, skills & tools I already have as I can. Now, I first started learning PostgreSQL because I wanted to learn more about how Flyway works. Further, as I also needed to learn how to…
Read More

Extended Events in AWS RDS

AWS, RDS
For the longest time, we didn't have one of the most useful tools for monitoring SQL Server behavior, but I just found out that, indeed, you can use Extended Events in AWS RDS. I'm not waiting around. Let's see it in action. Setup For Extended Events in AWS RDS AWS has posted the documentation on what you have to do in order to enable the collection of Extended Events within RDS. Normallly, I'd follow along with the documentation. However, I'm going to approach this like I knew that Extended Events support was there, but I wasn't aware of the docs. So, I'm starting in SSMS and I'm just going to try plugging in the Extended Events GUI to see what happens. Further, I'm going to use the simplest method for…
Read More

SQL Server Backups on AWS RDS

RDS
One of the things I love the most about Platform as a Service offerings is the fact that it makes it so I don't have to do silly things backup SQL Server databases on RDS. However! I'm also a paranoid control freak, aka, a DBA. While I appreciate that AWS has a good backup process and I can test it through recovery of my databases, I still want to do my own backups under some circumstances. Can I backup SQL Server databases on RDS? No and yes. Let's talk about it. Backup SQL Server Databases on RDS I have an RDS SQL Server instance running right now on AWS. I can connect up to it and run the following command: BACKUP DATABASE HamShackRadio; Which results in the following: Msg 262,…
Read More

AWS RDS and SQL Server Deadlocks

AWS, RDS
What's the story with AWS RDS and SQL Server deadlocks? I'm approaching AWS RDS like I was taking on a new role at a new organization. Do we have backups in place? Yes, great. Can I test them? Yes. Do they meet our RTO & RPO? Yes. Moving on. What have we got for monitoring? AWS RDS has a good percentage of the fundamentals. Now, it's laid out a little oddly. You have the stuff going through CloudWatch which is largely OS oriented. Then you have enhanced monitoring, which you have to turn on, which covers eight key metrics for SQL Server. Finally, you can enable Performance Insights which gives you metrics on query behaviors (and yeah, any or all of these may be the subject of upcoming blog posts).…
Read More

Fun Fact: AWS RDS and system_health

AWS, RDS
Did you know that the system_health Extended Event session was running in your RDS instances? Well, it is. HOWEVER. This query, which works perfectly fine on my on premises instance of SQL Server, will fail: SELECT @path = dosdlc.path FROM sys.dm_os_server_diagnostics_log_configurations AS dosdlc; SELECT @path = @path + N'system_health_*'; WITH fxd AS (SELECT CAST(fx.event_data AS XML) AS Event_Data FROM sys.fn_xe_file_target_read_file(@path, NULL, NULL, NULL) AS fx ) SELECT dl.deadlockgraph FROM ( SELECT dl.query('.') AS deadlockgraph FROM fxd CROSS APPLY event_data.nodes('(/event/data/value/deadlock)') AS d(dl) ) AS dl; Whereas, thanks to Aaron Bertrand, this query will work just fine: WITH fxd AS (SELECT CAST(fx.event_data AS XML) AS Event_Data FROM sys.fn_xe_file_target_read_file(N'system_health*.xel', NULL, NULL, NULL) AS fx ) SELECT dl.deadlockgraph FROM ( SELECT dl.query('.') AS deadlockgraph FROM fxd CROSS APPLY event_data.nodes('(/event/data/value/deadlock)') AS d(dl) ) AS dl;…
Read More

Getting Started on AWS RDS

AWS, RDS
I'm expanding my skill set into AWS in a big way. So, one of the things I do when I'm learning a technology is to write blog posts about that tech. So, prepare yourself for a bunch of info on AWS. I'll be working with RDS, which will include SQL Server & PostgreSQL for certain. I'll also be posting quite a bit on AWS DevOps as I get into it. The usual stuff, including SQL Server, query tuning, Extended Events, Azure, Azure DevOps, and all the rest is not going away. I'm just adding another topic. Today, we're getting started on AWS RDS. Creating an RDS Instance The thing is, there's a lot of documentation available on getting started on AWS RDS, directly from Amazon. It's embedded neatly into the…
Read More