While the backups are easy to do, the restores can be trickier when one database has been restored into another, as this means the logical filename will not match the physical one.
This isn’t an issue when the client has only a handful of databases, but when there are 30 or even a hundred, it becomes much more of an issue. However, you can select database details in SQL Server from the sys.master_files single, system-wide view.
I started off with a simple script and then developed it through to generating the backup and restore scripts directly.
This small series includes the four scripts I created.