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) "Money can't buy you happiness." Maybe so, but it can make your unhappiness a LOT more comfortable!

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

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