SQL Server: can we find out who renamed the database?
1 answer
The rename operation will be recorded in the TLOG no matter how you do it.
I did a little test and renamed the database. This rename operation is recorded in the TLOG, as you can see in the screenshot below:
You can read the log and find out the name using this query:
select
suser_sname([transaction sid]) as username,*
from
fn_dblog(null,null)
This falls under the points below
- Your db master is in full recovery model.
- Even if your master db is not in full recovery model, you can still get this data if it is not truncated.
Also note that the read log on a live database is not recommended, so I advise you to take TLOG backups and read them separately
+5
source to share