Skip to main content

Posts

Showing posts from October, 2019

System.Data.SqlClient.SqlError: Directory lookup for the file "log.ldf" failed with the operating system error 2 (The system cannot find the file specified.).

Hi there. This is another short and quick post for you. I like these mini posts because the solutions are easy and it's usually a common issue such as permissions or script syntax. In today's scenario, I have a new instance where I would like to restore a database to, but the database restore is not working. The specific error is: System.Data.SqlClient.SqlError: Directory lookup for the file "log.ldf" failed with the operating system error 2 (The system cannot find the file specified.). With this error, it is best to investigate the location of the file. I tried to get to the location and... it doesn't exist. That is why I am receiving this error. To fix this issue I will need to update the log file path for my instance. In SSMS, right click the instance and choose properties. Go to the 'Database Settings' page > and update the path for the Log directory. Not...

How to find who deleted a database?

Hi Everyone! This post is another short and sweet post. I was at work and a coworker asked me if I could tell them who deleted a particular database on their developer server. A delete action is part of using DDL statements in SQL server. DDL stands for Data Definition Language. DDL commands impact the structure of the database so create, alter or delete are popular examples of this. You can read more about DDL statements here . To find who the culprit is, all you have to do is: In SSMS, Right click your instance >choose 'Reports' > 'Standard Reports' > 'Schema Changes History' Note: This report will show you all the DDL statement executions for the instance. That's it :). If you have any further questions, please post below. Thank you and Happy reading, -marshé hutchinson #learnSQLwithme