Q:

Content DB restore returns 0 sites

In the process of re-branding my client, currently running on MOSS 2007. Can't detach their live database, so decided on backing up the live, and restoring the DB to a new database.
Live is called WSS_Content_Live
Restore is called WSS_Content_Restore
Problem here is, I created a new application in Central Administrator without a site collection as the restored database already has a collection assigned. Under databases, I removed the default created DB and attached the restored database.
I've done this 100's of times before, but for some reason, with this client the restored database returns zero "0" sites. after restored.
I've tried resetting IIS in the hopes that it's a delayed response between sql and sharepoint but not such luck?
[Update]
So, I'm thinking SQL. Did a bit of investigation with our IT guys and found this
[Update 2]
The process in the link did not work. Found a solution to fiddle with the [config_db] but this is not an option for me, as I'm on the live environment and the live site needs to be active during this process.
[Update 3]
Managed to replicate this under a different environment. The problem is the ID that got assigned to the first application. Basically, I'm trying to restore Wss_Content_Live on SQL_Server_Live, to Wss_Content_Restored on SQL_Server_Live. A new database, on the same server that is hosting the original database. If we override the existing with the restore it works find, but for some reason, we are not allowed to restore the database under a different alias, as it returns 0 for the number of sites. The restoration of the database under the different alias success but the site count for the database, once attached to a new web application returns 0...

A:

This is typical (expected) behavior. You cannot attach the same content database to the same farm twice. Renaming the database will not change the object GUIDs contained within the database, so when you attach it you're essentially attaching the exact same content to a second web application. SharePoint will be unable to translate between the two since all of the referencing IDs are identical, and you can't have a site with the same ID contained within two content databases on two different web applications. Typically you're prompted during the attach that items with the same GUID will be removed. This will work fine between farms, but you can't do what you're doing on the same farm.

