Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8960707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:43:11+00:00 2026-06-15T15:43:11+00:00

I mistakenly deleted some rows b , can I recover them back using logs

  • 0

I mistakenly deleted some rows b , can I recover them back using logs or SSMS

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:43:12+00:00Added an answer on June 15, 2026 at 3:43 pm

    If your database is in simple recovery mode, then you are possibly out of luck. You can restore to the most recent backup, but if it was a long time ago it may not contain copies of the rows you deleted and wish to reinsert. It is also very likely that other data has been inserted in the meantime. You could restore to a new database and then do SQL surgery to get the vanished data back in.

    If your database is in full recovery mode, then:

    1. Find the last full backup, any incrementals since then, and all log backup files since the last incremental or full, and restore them up to the correct point in time. You could overwrite your database if that is acceptable, or you can restore to a new database and perform SQL surgery.

    2. The restoration process will look something like this:

      BACKUP DATABASE YourDB TO DISK = 'D:\MSSQL\Data\YourDB\YourDB Pre-Repair.bak'
      -- It is CRUCIAL you take a new backup before doing ANYTHING so you don't
      -- make another mistake you can't reverse.
      
      RESTORE DATABASE YourDB FROM DISK
         = 'D:\MSSQL\Data\YourDB\YourDB 20121208 110000.bak' WITH REPLACE, NORECOVERY;
      -- be very careful with REPLACE as needing it proves there is un-backed-up data
      RESTORE LOG YourDB FROM DISK
         = 'D:\MSSQL\Data\YourDB\YourDB 20121208 111500.log' WITH NORECOVERY;
      RESTORE LOG YourDB FROM DISK
         = 'D:\MSSQL\Data\YourDB\YourDB 20121208 113000.log' WITH NORECOVERY;
      -- restore more log files, all of them, in order, with none skipped
      RESTORE LOG YourDB FROM DISK
         = 'D:\MSSQL\Data\YourDB\YourDB 20121209 020000.log'
         WITH STOPAT = '20121209 01:57:00', RECOVERY;
      

      Note that I used WITH STOPAT here, which allows you to restore your database up to a specific point in time. In my example, log backups were taken every 15 minutes, and the fatal query was issued at 1:57:15 AM on 2012-12-09.

    If you want to restore a database to a new one, you have to do something like this:

    RESTORE DATABASE NewDB FROM DISK
       = 'D:\MSSQL\Data\YourDB\YourDB 20121208 110000.bak'
    WITH
       MOVE 'YourDBLogicalName' TO 'D:\MSSQL\Data\NewDB.mdf',
       MOVE 'YourDBLogicalName_Log' TO 'L:\MSSQL\Logs\NewDB.ldf';
    

    Use RESTORE FILELISTONLY to figure out what’s in the backup. If there are multiple backups in the same file, there’s more syntax to read out that info and then specify which one you want to work with. Use sp_helpdb 'YourDB' to find out where to put your NewDB database and Log files.

    Then there’s more script to rename the logical files, if you want (which I always do).

    Of course, silly me, I’m just realizing now that you could use the SSMS GUI to do most of this. But if you want to start understanding all this stuff and becoming really good at it, I recommend writing the script. I am a developer, but can restore databases lickety-split without having to ask for the “official” DBA’s help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I mistakenly did bzr ignore For some files that I don't want to ignore.
My visual studio 2010 crashed when some carelessness [bit of madness] mistakenly pressed start
I am currently using what I (mistakenly) thought would be a fairly straightforward implementation
I have a file conflict with my co-worker in .idea/workspace.yml. I mistakenly deleted my
I was 'cleaning up' a project and deleted some of the references to libs
Hi mistakenly I have deleted my MySQL database from Windos XP based PC (this
I mistakenly removed all users for mysql ... So I can't connect to mysql.
I mistakenly took the address of the reference returned by the back() operator in
I am working on zend framework. I have mistakenly created some actions which are
I am using scss with haml in my rails3 project. I mistakenly typed zindex:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.