Rename a Database and keep msdb..restorehistory details

  • Hi,

    We often restore databases into non-production environments, and have some reports and metrics that are run against these databases.

    Occasionally, the databases in the non-prod environment will be renamed after they have been restored.

    This causes us a few issues because some of the reports use msdb..restorehistory to determine the age of the database (i.e. when it was restored). This table only shows the name that was used when it was restored, and I can't find a way to link to the new name of the db after it's been renamed.

    Is there a way to get the restore date of a database if that database has subsequently been renamed?

    Thank you

    Steve

  • I think easiest would be to keep your own table of the original name and new name, then you can search for the original name in the history.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply