Restore MDF/LDF files

We have a situation where someone deleted content of a table from the database. We have a backup of the MDF/LDF file where we can restore the database from - though we do not want to restore the entire database but only one table. I was thinking of creating
a new database on the same SQL instance, restoring the mdf/ldf files to this newly created database and then import the information from the this database to the new db. How do I go about doing this using SQL server? Any help will be greatly appreciated. -RS

 
Hi VJ Shah,
If you are using SQL Server 2005 and higher, then we could use the Import and Export Wizard to copy the new table's data to the old one. Here are the general steps:
Right click old database, select Tasks and then select Import Data…
On the Choose a Data Source page, type your server name and select the new database, and then Next.
On the Choose a Destination page, type your server name and select your old database, and then Next.
On the Specify Table Copy or Query page, select Copy data from one or more tables or views, and the Next.
On the Select Source Tables and Views, select the table which you want to copy, 
specify the destination on the right column, and then Next.
If there are any unclear, please feel free to ask.
Thanks,
Weilin Qiao
Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.

Similar Messages

  • Optimal Locations for SQL 2005 TempDB & ReportServerTempDB MDF & LDF Files

    Hello.  I have SQL Server 2005 SP4 installed on Windows Server 2003 R2 Standard SP2. 
    The server has four CPU cores.  The server was configured with the following drive configuration.
    RAID 1 - System drive
    RAID 5 - SQL MDF files
    RAID 1 - SQL LDF files
    There is currently one of each of the following files on the server. 
    The MDF files are on the RAID 5 array, while the LDF files are on the RAID1 array for SQL LDF files.
    TempDB.mdf                                    
    ReportServerTempDB.mdf
    TempLog.ldf                                     
    ReportServerTempDB_log.ldf
    It is my understanding that having one TempDB per core is a best practice, so I should create three more TempDB’s. 
    Does that also apply to ReportServerTempDB?  Given the drive configuration of this server, where should all of the required MDF and LDF files for the TempDB’s and ReportServerTempDB’s be located?

    You cannot create more than 1 tempb in any SQL Instance. The recommendations are to have additional tempdb *data files* depending on cores upto a max of 8. Obviously this depends on every environment. This recommendation is only for tempdb. It is not
    for ReportServerTempDB’s. They are totally different and is not used similar to tempdb.
    http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1230-tempdb-should-always-have-one-data-file-per-processor-core/
    http://blogs.msdn.com/b/cindygross/archive/2009/11/20/compilation-of-sql-server-tempdb-io-best-practices.aspx
    Now, it is good to keep tempdb in its own drive, but because you dont have one specific, you can just put tempdb data files in data files drive and log file in log files drive.
    You might want to consider moving them to a seperate disk if you see IO contention.
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • How to restore .MDF file to other instance

    Hi All
    I need your help, one of my sql cluster crashed. I rebuild SQL Cluster with same instance name and cluster name. I want to know how to restore one of our user database .MDF database file. By mistaken i deleted .LDF file. And now i'm facing challenge
    to restore .MDF file.
    If anyone face this issue, please share you experience.
    Regards
    Rinks

    I entirely agree with Dan that you should restore the database from a clean backup.
    Since the cluster crashed, I suspect that the database was not shut down cleanly and in this case you will not be able to attach the MDF with the suggestions Dan made.
    It is possible to what Paul Randall calls a "hackattach", but I am not going to describe this here. You will be able to access the database, but the database may be full of corruptions. So I really hope that you have a backup.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • AUto-renaming mdf & ldf filenames when restoring a database with SQL Management Studio

    Hi!
    I am using SQL Management Studio 2014 and I am experiencing some problems when restoring a database backup.
    I have a SQL Server 2008R2 & SQL Server 2012 instances.
    On the 2012 instance, when I restore a database and rename it into a new name, the mdf and ldf files get automatically renamed into the new database name : Great, this is the behavior that I expect.
    On the 2008R2 instance, the mdf and ldf files don't automatically get renamed to match the new database name and I have to perform the renaming manually - pretty annoying.
    Has anybody experienced this problem ? If yes, do you know of a fix ?
    Thank you
    Frederic

    Hi,
    You are using an external tool (SSMS GUI interface) which give you some behaviors like default names. this is very simple, just use a simple query to restore the database and dont use the GUI if you dont like its behavior
    (this behavior might change from time to time). You can use the profiler to make sure what is
    the real query that the SSMS sent to the server.
    >> How to: Restore a Database to a New Location and Name (Transact-SQL)
    http://technet.microsoft.com/en-us/library/ms190447(v=sql.105).aspx
    -- use any name that you want in the restore
    RESTORE DATABASE MyNewAdvWorks
    FROM AdventureWorks2008R2_Backup
    WITH RECOVERY,
    MOVE 'AdventureWorks2008R2_Data' TO 'D:\MyData\MyNewAdvWorks_Data.mdf',
    MOVE 'AdventureWorks2008R2_Log' TO 'F:\MyLog\MyNewAdvWorks_Log.ldf'
    GO
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Where can i see the .mdf or .ldf files for mysql database?

    Hi i have created a database in mysql workbench. Now i want the .mdf  or .ldf files for my project deployment.  where can i see this files in my folders. I have searched in this folders.
    C:\Program Files\MySQL\MySQL Server 5.6\data.
    Couldn't find the data's here. Please Help. Actually i don't know i am on the right path. Or please tell me how can i create it?

    I think mysql has a different file structures than MS SQL. May be this link will help you
    http://www.mkyong.com/mysql/where-does-mysql-stored-the-data-in-my-harddisk/
    Satheesh
    My Blog | How to ask questions in technical forum

  • Does shrinking LDF file have any impact on restoration?

    Right now my LDF file is almost 50GB. My database is only of 10 GB size.
    Here are my questions:
    1. Why is the LDF file so huge?
    2. Is there any way to avoid the LDF file to grow so big?
    3. If I use shrink, will I have any issue while I am restoring the database in the future.

    Hi,
    1. Can be many reason , do you take frequent transaction log backups.
    2. yes by taking proper transaction log backup and putting correct and reasonable value of autogrwth  for data and log file
    3. No, not at all. Shrinking log file only removes free space.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • Unable to restore a .bak file in SQL 2012

    Environment: SQL 2012 SP1 Standard on Windows Server 2012 R2 Standard (Hyper-V instance on 2012 Standard)
    I've been trying to restore a backup file that was updated on another system by our vendor (Omnify)
    I'm getting the error: Omnify5.mdf cannot be overwritten. It is being used by the database Omnify5
    I've tried putting the database in single user mode, Ive tried taking the database offline
    I've tried rebooting
    I've tried the following code:
    use
    Master;
    GO
    alter
    database omnify5
    set
    single_user
    with
    rollback immediate;
    alter
    database omnify5
    set
    multi_user;
    Go
    And I've checked file permissions
    I've verified the BAK file
    I've re-created a backup to see if I could restore using it and still no joy.
    Anyone have another idea?
    Thanks
    Jim Bogart "bogart dot james at gmail dot com"

    It looks like the file is still accessed by some other process, make sure that the file is no longer connected with any other database
    select name,physical_name from sys.master_files
    Take the database to single_user
    Take the database offline
    Put the database in multi_user mode
    Restore the database with overwrite option ( You can either use SSMS or Restore command)
    RESTORE DATABASE PowerSQL
    FROM DISK = 'f:\PowerSQL\PowerSQL.bak'
    WITH MOVE 'YourMDFLogicalName' TO 'F:\SQLData\PowerSQL_Data.mdf',
    MOVE 'YourLDFLogicalName' TO 'F:\SQLLog\PowerSQL_Log.ldf'
    WTIH REPLACE, MOVE
    -Prashanth

  • Restore Database .ndf files

    I have a backup (.BAK file) which has bunch of .ndf files. I want to restore it on a database which has only .mdf and .ldf files. How to restore it? I am new to Sql server 2008 R2 and never restored .bak file which contains .ndf files...
    Thanks in advance...
    Thank you,

    I don't want to eliminate them. I want to restore them as well but don't know how to. Also the database where I want to restore the .bak only have .mdf and .ldf files.
    The target database is completely overwritten during the restore.  The number and size of the files after the restore will be the same as the original.  You can use the WITH MOVE and REPLACE options to relocate the files and replace the target
    database:
    RESTORE DATABASE TargetDatabase
    FROM DISK='D:\Backups\SourceDatabase.bak'
    WITH
    MOVE 'SourceDatabase' TO 'E:\DataFiles\SourceDatabase.mdf'
    ,MOVE 'SourceDatabase_Data2' TO 'F:\DataFiles\SourceDatabase_Data2.ndf'
    ,MOVE 'SourceDatabase_Data3' TO 'G:\DataFiles\SourceDatabase_Data3.ndf'
    ,MOVE 'SourceDatabase_Log' TO 'L:\DataFiles\SourceDatabase_Log.ldf'
    ,REPLACE;
    ALTER AUTHORIZATION ON DATABASE::TargetDatabase TO sa;
    Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/

  • Can I recover a damaged SQL Server 2008 database with the undamaged .mdb and .ldf files?

    Their original SQL Server was 2008, with SP unknown, but installed on D: and C: drives.  The power spike corrupted their O/S on the C:
    drive and someone reinstalled both the O/S and the SQL Server, which is now SQL 2008, SP4.  They have intact files for all system databases, both .mdb and .ldf.  Is there some way they can reconnect with the user databases using the intact copies
    of the previous system databases? I have heard that if the SQL Server is stopped, previous Master and Msdb .mdb and .ldf files moved into place and the server restarted, that any previous user database .mdb and .ldf files can be accessed by the SQL server.
    Is this the case, or are there details missing?

    Hello! try this steps
     1 Open your SQL Server Management Studio console. This application shortcut is available in the SQL Server directory in the Windows Start button.
    2  Enter the system administrator user name and password. SQL Server's administrator user name is "sa." This account is required for privileges to restore the database. If your restoring on a host provider server, use the administrator user name
    and password they supplied for your account.
     3 Right-click your database name and select "Attach." In the new window that opens, click the "Add" button to open a dialog box.
     4 Select your MDF file and press the "Ok" button. It may take several minutes to restore the database if it is a large file. Once the process is finished, browse your tables to verify the data. The database is now restored.
    If nothing helped try to use: 
    https://www.youtube.com/watch?v=1cbOYdvBW2c

  • Can not restore all data/files after disk crash.

    I have a intel MacBook Pro (2008). Hard drive crashed. I replaced the drive and all is well with that. I re-installed Leopard and the Snow Leopard upgrade. Now I am trying to restore all my files/data from my external LaCie drive. All I am seeing is it says "copying to volumes". I don't see the files or anything on my new drive. What am I doing wrong??

    Not sure, but here is a link that may help:
    http://discussions.apple.com/thread.jspa?threadID=435350&tstart=0
    Good luck!

  • How to I restore missing StickiesDatabase file from Time Machine?

    I have looked all over for a solution to this. Basically, I am trying to restore a stickiesdatabase file from a Time Machine backup. I put in a new HD and am slowly pulling files over in pieces. The thing is, the backup that had the stickies I want to restore did not seem to back that file up. I navigated to user/library to find StickiesDatabase, and it is not there, even though I went into the terminal and unhid invisible folders and files (other greyed out invisibles showed up so I know it worked). But here's the weird thing, when looking on my current hard drive, I could find that file for my new, empty stickies just fine. Also, I went further to a Time Machine backup from a year ago, and I found the stickiesdatabase file in the library as well. It's like these last two backups I did that had the stickies I want did not include that file in the backup. Any thoughts? Am I doomed? Oh, and I am currently on Mavericks and the backup in question was also Mavericks. And I have a 2008 Macbook Pro if that info is helpful.

    There is another, huge thread on TM backups on this forum and exactly this issue has come up. Sadly, no one has a perfect answer. I do not have a spare drive available to test this myself, but I would try something along these lines.
    -- Ask TM to restore your full Library and the Masters, if Referenced. I believe that TM will give you the option to not overwriting your current Library, but be careful. However you do, stick this "Recovery Library" out somewhere. (Yes, this is gonna take some time, run it overnight.)
    -- Open "Recovery" with Aperture and select the Project(s) that contain the images you want. Export these "Projects as New Library."  (Don't export as either Versions or Masters.) I would select the box "Consolidate Masters" and I would probably discard the Previews. Stick this somewhere.
    -- Now open "Original Library" and import the "Library" that you exported back into your Original Library as something like "Stupid Lost Project."
    -- You should now have a Project full of adjusted, and adjustable images. (N.B. this is basically the technique I use with my laptop. I shoot, load into AP3 on the laptop, noodle, and then export/import into AP3 on the MacPro when I get home.)
    -- Clean up. (Delete "Recovery", convert the recovered Project back to Referenced Masters, if you wish, etc.)
    One good argument for never throwing those old USB drives away.
    I have missed some of the details in the process, so be careful, but I believe that this will work until Apple lets us run Aperture inside Time Machine.
    Best wishes.

  • Cannot open dashboard from connected client to restore a single file

    I have a small business network with an existing Server 2008 R2 domain controller.  In order to backup all the client machines with an experience something like windows home server I recently purchased a new server with windows server 2012 r2 and
    installed the essentials role.
    I'm able to connect client machines (running windows 7) to the new server and get them to backup.  I assume (but have not yet tested) that I would be able to do a full image restore by creating a client restore bootable usb key and booting a client from
    that, but first I'd like to be able to browse the files in a client backup and restore a single file rather than the full image.  It seems that the only way to do that is to run the dashboard as a remoteapp from the client, but when I try that I get this
    error:
    I thought that I might need to add the remote desktop services role.  So I tried doing that and publishing the dashboard as a remoteapp, but the error still appears.  Even if that fixed the problem, though, I would be concerned that would mean we
    needed RDS CALs for each client which seems like overkill just for the ability to restore a single file from a backup.
    So, is there any other way to get to the dashboard or otherwise restore files onto a client?  
    Thanks.
    This posting is provided "AS IS" with no warranties, and confers no rights.

    Um, well looky here :)
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/cf6abdeb-a517-424c-bbef-050bee22a658/remoteapp-error-when-launching-dashboard-from-client-pc?forum=winserveressentials
    Grey
    PS: Has nothing to do with the price of eggs, but interesting ?
    http://www.windowsnetworking.com/articles-tutorials/netgeneral/host-remoteapps-windows-pcs-part1.html

  • I have an iphone 6 plus which show iphone disable connect to itunes. i tried to restore but it won't work and everytime it says "Iphone "Iphone" could not be restored because firmware file is corrupted disconnect and try again later"

    last night while i was sleeping at somone has tried to open my passcode if Iphone 6 plus model A1524. Now i cannot see the passcode screen and it just saysi phone is disable connect to itunes . Then i decided to restore my iphone and i have download almost 4 firmware files (iPhone7,1_8.3_12F70_Restore.ipsw and iPhone7,1_8.0_12A366_Restore.ipsw and iPhone7,1_8.0.1_12A402_Restore.ipsw and fourth one is iPhone7,1_8.2_12D508_Restore.ipsw.part) and restore (by holding shift in itunes and selecting file ) using itunes ( which is current version 12.1.2.27 64 bit) but for everytime two of them(while extracting ) which are (iPhone7,1_8.3_12F70_Restore.ipsw and iPhone7,1_8.2_12D508_Restore.ipsw.part) it says "Iphone "Iphone" could not be restored becuse firmware file was corrupted please disconnect and try again later" .i have tried to download "iPhone7,1_8.3_12F70_Restore.ipsw " manually and via itunes (when i download and restore using itunes it says
    "There was a problem downloading the software for the iPhone ''iPhone'' A unknown error occured (9006).
    Make sure your networks settings are correct and your network connection is active, or try again.''
    but nothing works (While for rest of two it says firmware file is not compatible).. I'm tired of these now as i'm working on this problem for 5 days ...
    Please help me as soon as possible..
    sorry for my poor english..

    Hello JD_NINJA,
    Thanks for using Apple Support Communities.
    Error 9006 when restoring your iOS device indicates that there is security software on your computer which is preventing connection to the Apple server or your device.  To troubleshoot this issue please follow the directions below.
    Check your security software
    Related errors: 2, 4, 6, 9, 1611, 9006. Sometimes security software can stop your device from communicating with either the Apple update server or with your device.
    Check your security software and settings to make sure that they aren't blocking a connection to the Apple servers.
    Get help with iOS update and restore errors - Apple Support
    When restoring your iPhone, please make sure to follow the directions in the link below to properly restore.
    Restore your device from an iCloud or iTunes backup - Apple Support
    Take care,
    Alex H.

  • I have had a series of Macs.  They have been backed up with Time Machine. I am trying to restore TM backup files from the older Macs using my new MacBook Pro.  No go.  What do I do ?

    I have had a series of Macs.  They have been backed up with Time Machine. I am trying to restore TM backup files from the older Macs using my new MacBook Pro.  No go.  What do I do ?

    I am trying to restore TM backup files from the older Macs using my new MacBook Pro.  No go.
    Migration Assistant (Finder > Applications > Utilities > Migration Assistant) is the tool that you would use to restore backups from older Macs to another Mac.
    Details are here:   http://pondini.org/OSX/MigrateLion.html   The same info applies for Mavericks and Yosemite.   If you are saying that this is a "no go".....where are you getting stuck?  What error messages do you see?

  • Lightroom - how to restore backed up files (not Lightroom catalogue) from one external drive to another?

    How to restore backed up files (not lightroom catalogue) from one external drive to another.
    I recently backuped my photo files from one external drive to another. The backup (carbon copy cloner) pointed to some corrupt files on the original drive.
    I have deleted those files and am finding good copies of them  in Time Machine backups.
    I want to get rid of the original external drive; use the recent backup as my main external and then back it up onto a brand new drive.
    What I am not sure about is how to point lightroom to the backups so it knows to look on the new drive instead of the old drive and all those exclamation marks and question marks go away.
    There are close to 60,000 images in numerous folders all with one 'parent folder.'
    My best guess is from Lightroom Help - Create and Manage Folders -  Locate Missing Folders
    Can I point to the one parent folder and all the subfolders will come back?
    Is this the process to recover files into lightroom and will there be a problem with so many photos?

    http://www.computer-darkroom.com/lr2_find_folder/find-folder.htm

Maybe you are looking for

  • EW4 Will Not Open - Application Crash

    Until now, I have used EW4 for over a year without a hitch.  It has now developed an error that causes it to crash while trying to load.  My OS is Win7 SP1 x64. The Windows Application Log always shows two errors associated with this crash.  First th

  • Problems trying to migrating ports to a new Vlan using an externar DHCP server

    Hello, here is the thing. I have the following configuration in my Core Switch: interface Vlan1  ip address 10.24.74.1 255.255.254.0 secondary  ip address 192.0.2.54 255.255.255.0  ip helper-address 10.24.86.22  no ip redirects As you see, we are usi

  • JCO's

    Hai All, I am facing some problem in while creating JCO destination. I have configured one SAP-ECC system in SLD and trying to create JCO destination but i am unable to see the created system in the dropdown where we select the R3 system. Thanks & Re

  • How do I burn a slide show to a DVD?

    When I burn a slide show I created on Photoshop Elements 11 to a DVD using Premier Elements 11, only the botton half of the photos are copied.  How do I correct this?

  • HT4623 my ipad does not have ; up date sofware; what do i do to up date sofware?

    HOW can I update my sofware in my ipad first gen,  my ipad does not have ' UP DATE SOFWARE" Is there away that I can do i?i