Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Restoring SQL by Combining Tables from Backups - URGENT

Posted on 2013-01-30
5
297 Views
Last Modified: 2013-01-31
We had an issue today when someone noticed that two tables in our SQL DB were missing (the data was missing).  We have a good backup from 10 hours earlier that had the table and data but want to be able to backup today's activities then see if we can combine the DB's to meld together the combined since it was hours before someone noticed it.

In practice can this be done?
0
Comment
Question by:iNetSystem
5 Comments
 
LVL 6

Expert Comment

by:liija
ID: 38836910
There's no partial restore in SQL Server. Restore to another database and copy the data to production db a way or another.
0
 

Author Comment

by:iNetSystem
ID: 38836931
I was thinking of preventing anyone from using it for a couple of hours at which time I would:

1) Restore the DB with the majority of the records to a new DB
2) Backup today's DB
3) Find the Tables that don't have today's data and import in the data from today in the same tables into the newly created DB

If this is something that's been done before can you outline how to do it?
0
 
LVL 6

Expert Comment

by:liija
ID: 38836977
Basic things for dba, start with backup and restore. I don't have time today help you any further today, hope someone else has...
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 250 total points
ID: 38837070
>> If this is something that's been done before can you outline how to do it? <<


You can INSERT (or UPDATE) directly from one db to the other.  Like this:

INSERT INTO db_name.dbo.tablename1 ( ... )
SELECT ...
FROM db_name_restored.dbo.tablename1
WHERE
    ...


You can write/gen your own queries to sync the data.

OR: you can use MS's free program "tablediff.exe" to find data differences between tables, and gen the code to sync them; this is a line-command utility that takes getting used to but actually works pretty well once you do -- and, again, it's free.

OR: you can look into RedGate or some other vendor's data comparison software that is more powerful, has a GUI, extra options, etc..
0
 
LVL 10

Assisted Solution

by:sqlservr
sqlservr earned 250 total points
ID: 38838757
easy step to complete this situation script the 2 tables with data option and execute the script on the destination server


or
if its a huge database you can use BCP
ot
use t
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
the SQL agent on the SQL secondary replica on AOG group is disabled 5 18
Negative isnull? 3 14
AD and SQL Server 2016 2 28
Help With SQL Query 9 30
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question