You will find a lot of information about within the WWW but nobody tells you about the background and if you make this wrong that you will run out of sync.
If you go on your commandline in your MOSS 2007 environment you should type
stsadm -o sync -listOldDatabases 0
You get a full list with your siteCollections which normally should be synced every hour. If you type the same command in following way
stsadm -o sync -listOldDatabases 1
You should get an command line output „No databases match the criteria for this Shared Service Provider“
This is good at this time. If you count your output you will see that you have listed only WebApplications with refer to your SSP.
Start to rename the database now
First catch the databasename (you have two possiblities)
1) stsadm.exe -o enumContentDBs -url „http://<yourSiteCollection>“
2) Navigate to your Central Administration -> Application Management -> Content databases (located within SharePoint Web Application Management) -> Select your web application. You will see the database name. I prefer to do this on command line.
Start to rename your content database go on commandline and type
stsadm -o prepareToMove -contentDB <yourDatabaseServer>:<yourDatabaseName> -site „http://<YourSiteCollection>“
Now you are ready to detach your database
stsadm -o deleteContentDB -url „http://<yourSiteCollection>“ -databaseServer <yourDatabaseServer> -databaseName <yourDatabaseName>
Go on your database server make a backup and restore. During you restore you can rename you database to the correct name.
Go back to your MOSS 2007 server and type
stsadm -o addContentDB -url „http://<yourSiteCollection>“ -databaseServer <yourDatabaseServer> -databaseName <yourDatabaseName>
Now you have successfully renamed your content database.
You can check on the commandline you sync status. If you don‘ t do that you are out of sync of your database. You need to repair this.
Last but not least do not forget to remove the old database from your SQL server. Keep the backup a while before you delete from your harddisc.
Refer following article which explain how to detach a database from you MOSS 2007 environment Detaching Databases in MOSS 2007 Environments