After deleting data from SQL database, deleted data stored in log file or is it permanently deleted from database?
When deleting data from database log file get increased the size, why?
After shrink the database it will reduced the file size
edit 1::
in your fifth row you desc why log file incresed but after completing the delete command why it is not free the disk space ,the records maintain as it is in log file . is it possible to delete data without storing into the log file ? because i deleted near about 2 millions data from the file it will incresed the 16GB space of the disk
So, as you described the log behavior – it is reduces size after shrink – you use Simple recovery model of your DB.
And there is no any copy of deleted data left in log file
If you ask – how to recover that data – there is no any conventional way.
If you ask for data security and worried about deleted data left somewhere in the DB – yes, there are – see ghosted records. And obviously some data can be recovered by third party tools from both DB file types – data and log.
The db log is increased by size because it holds all the data being deleting until
DELETEcommand finishes, because if it fails – sql server should restore all the partially deleted data due to atomicity guarantee.Additional answers:
instead of deleting all the data like this:
delete in small chunks: