Ok so I have a .bak file which is a backup of our old CRM data. This has come from a backup of an SQL SErver database (not sure what version). What I am trying to achieve is converting all the data that file contains in a .CSV that I can then use to import the data into a different CRM.
I have tried the obvious things, renaming the file .csv and trying various text editors and applications that claim to be able to view these kind of files. All I ever get is a ton of gibberish, by that I mean a ton of characters and symbols that clearly do not represent what is in the data backup.
From what I have obtained already, I need to restore this file to an SQL Server database, and then do the export to .csv. I have managed to set up a trial version of SQL server 2012, however when I try to import the file (import from flat file option), when I get to the preview, it appears to just be gibberish populating the fields again, and if I then run that anyway, its fails and returns errors. I can confirm that another CRM company had managed to restore this and extract what they needed, sadly we decided not to continue with them, but based on that, I would say the .bak file is not corrupted.
I assume I am doing something wrong. My question is what is the correct way to import / restore a .bak file into MS SQL 2012?
Is there an alternative that I have missed or is this not the right approach to begin with?
Any help greatly appreciated as always!
I recently needed to convert a MS SQL Server database backup in .BAK format to anything digestible by other tools such as CSV, SQL. The only thing I found was online converter RebaseData. It's free for smaller file sizes, up to 10MByte.
Related
I have a .mdf file (some GB) that contains data from an old application. However I need to work with some information that is stored in this database. Different to similar questions I have not developed this application, I do not have a SQL Server running, I just have the file.
I already installed MDF Viewer (http://www.sqlmdfviewer.org/) and I can see the information that I need there in two tables but this tool can really only display the content, it is not possible to export or even copy/paste.
I have also installed SQL Server Management Studio Express as this software was mentioned in other questions but if I want to open the mdf file I get an error "The operation could not be completed".
Is there some tool like MDF Viewer that can also export the content of a table? Excel, CSV, ... something that I can read and work with?
I have foxpro data table files ".dbf",".fpt",".cdx" .
I want to read data in the files and import it to SQL server 2008
I have windows 8 OS installed on my machine. I could not find compatible visual foxpro version for windows 8.
Also I have used dbfviewer tool to view data in .dbf file but I cannot check data in .fpt file
Any help is appreciated.
I don't know why people want to close an legit question... My guess they have no clue.
I am running windows 8.1 and use VFP 9 regularly. It may not claim to be directly compatible because M$ has discontinued support on the product, so why even test on platforms they have no concern with. Have you tried VFP9?
Another approach some people use is downloading the VFP OleDb Provider and use it via .net, or even through SQL-Server to use a connection, query the raw data into SQL Server, then run through conversion techniques while everything IS in SQL server.
VFP 9 also has from its top-level menu
Tools --> Wizards --> Upsizing
and guides you through how to pick either a directory of free tables, or pick a database and identify which server to connect to, etc, etc.
Hopefully some good starting points for you to run with and check back if you get stuck somewhere else down stream...
You only need to worry about the DBF file.
As noted in Microsoft's online documentation, Visual FoxPro's DBF, FPT, and CDX files are "Table", "Table Memo", and "Compound Index", respectively.
The DBF is the "core" file, containing the description of the fields as well as the information about each record and the actual data for most data types. For FoxPro's memo-style data types, the information for each record is written onto the equivalent FPT file instead of the DBF itself.
The CDX is a record of the FoxPro indexes, and rather that containing data just contains compiled and ordered pointers to which records match which indexed expressions.
You could purhcase a copy of Visual FoxPro 9, as it seems to work on Windows 8 albeit with some quirks. However, if you only want the data and do not have an exist VFP license, you are better off using the free OLE provider DRapp mentioned in his answer, and sending your data to a more modern format.
You can also use DBF Commander Pro to export DBF files to SQL Server.
To carry out this operation, you'll only need DBF and FPT files - they contain data of Memo field(s). CDX files are not needed since VFPOLEDB provider doesn't support indexes at all.
Install the app, open a DBF file, click File -> Export to DBMS. Then provide the connection string (or Build it). For MS SQL Server 2008 it will look as follows:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=userid;Initial Catalog=databasename;Data Source=servername
Click Connect button in order to check the connection, then choose the destination table from the dropdown list:
At the bottom of the window you'll see the command-line that can be used for uploading DBFs to a database in a batch mode. Click Export button to start the process.
DBF Commander Pro has 20-days full featured trial period, so you can do the job for free and you'll economize $300 on Visual FoxPro license :)
In Windows 7, I can create an ODBC connection to a Foxpro data source. I don't know if that capability still exists in Windows 8, but I don't see why it wouldn't.
Once that connection exists, the data becomes available for any other tool that can utilize ODBC. At that point, you could import the data into Excel, massage it, then load it into SQL Server. Alternatively, you could also access the data directly via VBScript to either dump it to a text file or import it directly into SQL Server.
Generally to get the meta data from SQL Server backup files, we need to use TSQL commands like restore headeronly or restore filelistonly. However, there are some third party tools can read this information directly from the backup files, like this one http://www.yohz.com/sqlbakreader_details.htm. Since this tool don't have a command line version, which makes it less useful. I want to know whether there are some ways that I can read this data directly.
Thanks.
The .bak file is a Microsoft Tape Format file. Here's a PDF that contains the format.
Of interest to you will be:
For a quick dump (if you are on the SQL Server in question that created the backup), you can do select from the [msdb].[dbo].[backup*] tables.
See this article for more info.
I think you may be able to use SQL Servers SMO libraries and write your own in .net or Powershell. If you take a look at this page http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.restore.readbackupheader.aspx there are code samples in VB.Net and Powershell.
Let us start with...yes I am new to SQL and really only a lightweight programmer. So I am assuming that I am doing something horribly wrong. I have spent days on the MS forums looking for an answer to no avail. So I am going to give as much info as possible.
Application language is VBExpress 2010 and using SQLExpress 2008. The Database contain basic tables, no stored procs, no views, no diagrams. The Application has configured diagrams where one of the tables has inner joins... Tables origninally built in SSMS, but have been altered in VBE.
Anytime I run the application, even after exiting the application, if I then go to SSMS I can see the database name but I cannot open it up (no + beside it). If I try I get an error that says:
One or more files do not match the primary file of the database. If you are attempting to attach a database retry the operation with the correct files. If this is an existing database the file may be corrupted and should be restored from a backup."
When I look at the files, I see two log files, one with _1 appended on to it. If I delete the logfiles before opening SSMS, everything opens fine. If I had already opened SSMS then I have to delete the files, reboot my computer and then I can access the database through SSMS...
I recently found that if I go into SSMS, take the database offline and then bring it back online I can get access back.
Anytime I open SSMS, I have to completely reboot my computer before VBE will reconnect the database.
The bottom line is that I cannot back up the database without either deleting the log files or doing an offline/online cycle in SSMS....
This is driving me nuts. I cannot possilby deploy the application if I cannot achieve a normal backup procedure. And I cannot seem to get any kind of answer about why this is happening.
What am I doing so WRONG?
If you are using SQL Server 2008 then, reattach the database files and it will must be stored in C:\Program Files\Microsoft SQL Server\MSSQL 10.MSSQLSERVER\MSSQL\DATA.
And recheck the database on that folder and it will take backup and restore point of Primary files of Database. Don't modify/delete the database files. If the location of log files are changed the it will shows the error. Please give your mail id I'll send a program to restore and backup of database files in winrar.
Thank you
Regards,
Naresh.
I don't have any experience in SQL databases.
I want to use Microsoft SQL server and i need to ask two questions:
I want to know what are the disadvantage and advantage of saving the data in the mdf file.
Is there some easy way to 'copy' the data that i saved in the mdf file to the regular table ?
1) Question doesn't make sense: All data is stored in .mdf or .ndf data files (in reality the extension doesn't matter, it's just a convention)
2) You seem to be mixing the concept of a table and a data file. Backups are used to create safe copies of your data. The tables you see in SSMS are stored in data files (via filegroups).
If you don't know anything about SQL Server, you should start by finding a good book (and go to a good training course) to understand the basic concepts. The documentation is very extensive, but it's really a reference and not a learning tool.
Having said that, have you read the documentation on files and filegroups in SQL Server? All data in SQL Server is stored in .mdf (and possibly .ndf) files. Unless you're using SQL Server Compact, I believe.
And what are "regular tables"? Are you perhaps using Access as a front-end to SQL Server?