Accidentally change database name (SQL Server 2008) It didn't happen to me YET. But I was thinking about this.

I was messing around with my training environment, and by mistake I clicked in the database name, and then I touched the letter A.



Let's assume that I hit enter. Now the database is called A, and I don't remember the original name. CTRL + Z doesn't work.



What to do in a case like this, in a production environment?

I know it could not happen, because the database isn't set as SINGLE USER. But if it happens. What to do? For argument's sake, let's say it's a database that nobody is using right now.
Right click on the database, go to files. You can see the original file names. This will help you to find the correct database name easily. The file names won't be changed on a rename.

You can also try to take a look at your fn_dblog. It's undocumented but you can see (and filter) for the latest actions. 

SELECT * 
FROM fn_dblog(NULL,NULL)