Restoring a BCM database from SQL .mdf and .ldf files (Windows Vista or XP)
If you need to restore a BCM database from the .mdf and .ldf SQL database files, you can use the following script to attach the SQL database.
Be sure to install the latest version of BCM and all service packs before running this script, since BCM will not connect to databases that were created using newer versions of BCM.
Copy the text below into Notepad and follow the instructions. Let me know if you have any questions about this.
~ Clinton Ford
@ECHO OFF
REM Restore a BCM database from the SQL .mdf and .ldf files (Windows Vista or XP)
REM --------------------------------------------------------------------------------
REM Instructions
REM 1.) Install and configure BCM on the destination computer.
REM 2.) Copy your backup .mdf and .ldf files into the BCM database folder.
REM To do this, click Start | Run, then enter the following text into the text box and click "OK":
REM %LOCALAPPDATA%\Microsoft\Business Contact Manager\
REM NOTE: You might need to rename your .mdf and .ldf files if a pair of files with the same name already exists
REM 3.) Now, modify this script in Notepad by doing the following:
REM 4.) Press CTRL+H in Notepad to open the Replace dialog
REM 5.) Type <BACKED_UP_DATABASE_NAME> in the "Find what" box
REM 6.) In the "Replace with" box, enter the name of the backed up BCM database (without the .mdf file extension)
REM 7.) Save this script to your Desktop as RestoreDB.cmd
REM 8.) Run this script by double-clicking on the RestoreDB.cmd file on your Desktop
REM 9.) From the main Outlook window, select "Business Contact Manager | Database Tools | Create or Select a Database..."
REM 10.) Select your backed up database from the drop-down list and click "Next"
"c:\program files\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S .\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = '<BACKED_UP_DATABASE_NAME>', @filename1 = '%LOCALAPPDATA%\Microsoft\Business Contact Manager\<BACKED_UP_DATABASE_NAME>.mdf', @filename2 = '%LOCALAPPDATA%\Microsoft\Business Contact Manager\<BACKED_UP_DATABASE_NAME>.ldf';">>"%LOCALAPPDATA%\Microsoft\Business Contact Manager\<BACKED_UP_DATABASE_NAME>_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%>>"%LOCALAPPDATA%\Microsoft\Business Contact Manager\<BACKED_UP_DATABASE_NAME>_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%
Comments
- Anonymous
October 23, 2007
PingBack from http://business.wpbloggers.com/?p=9923 - Anonymous
October 31, 2007
i have attempted to follow this process, however when I goto start and run and put in %LOCALAPPDATA%MicrosoftBusiness Contact ManagerI receive an error message that says "WINDOWS CANNOT FIND %LOCALAPPDATA%MicrosoftBusiness Contact Manager.What is my next move? - Anonymous
November 09, 2007
I received the same error so I've got the same question, what next? - Anonymous
November 12, 2007
I uninstalled BCM2003 and installed BCM2007. Everything looks ok except for the email history . We dont see the old history and there does not seem to be any history being created. Any help would be appreciated.Thanks. tsscontact@yahoo.com . David Solis - Anonymous
November 14, 2007
To link existing emails to the contacts, you can click BCM->Manage E-mail Auto Linking menu and use Search and Link functionality.Make sure the all contact email addresses and folders are checked in the the dialog that comes up when you click the Manage Email Auto Linking dialog. - Anonymous
December 04, 2007
We upgraded from BCM 2003 to BCM 2007. All looked well until we noticed some of the contacts in BCM did not port over. I have a backup of the old data in the form of SQL 2000 backup, and I have it live on SQL 2005.How can I convert this old data into the BCM 2007? Unfortunately, I don't have a .bcm backup, only every other backup.Are there any good scripts I can use to bring over the missing data? Any help will be appreciated -- larry@dangelocpa.comThank you, Larry Leffler - Anonymous
December 12, 2007
Hi buckfam6 and steves2983,%LocalAppData% is an environment variable only in Vista. There is an enbironment variable %AppData% in XP, but that is not what we want here. Apologizies for not mentioning this in the script. You can introduce a new environment variable in XP by going to Control Panel --> System --> Advanced --> Environment Variables.-Sateesh - Anonymous
December 12, 2007
Hi leffler,Did you try the above script? If I understand correctly, you have mdf and ldf files in SQL Server 2005 which you want to restore in BCM V3.-Sateesh - Anonymous
December 12, 2007
Hi leffler,There is another post in this same blog: Restoring an Automatic SQL backup. Please see if that helps you.-Sateesh - Anonymous
January 21, 2008
Our customers don't want to upgrade to Ofice 2007; they want Windows XP reloaded and all their app functionality restored.I've modified your script for Win XP and BCM 2003, e.g. "C:Program FilesMicrosoft SQL Server80" instead of "...90", etc., but the program "sqlcmd.exe" is nowhere to be found, nor does the subfolder ".MSSMLBIZ" exist.Do you have an MDF restore solution that works for BCM 2003?Thanks. - Anonymous
January 21, 2008
Hi Mike,If you have BCM V2, the SQL instance name is not MSSMLBIZ. It has a different name starting with MICROSOFT. Till BCM V2 SP3, BCM shipped with MSDE. Only from BCM V2 SP4 that MSDE was replaced with SQL Express.Inorder for the script to work with BCM V2, you need to change the V2 instance name, the location of the MSDE sql exe file, the location where BCM V2 stores the mdf and the ldf files. Try making these changes and let me know if it works.-Sateesh - Anonymous
April 17, 2008
This happens to me at least twice a year with BCM.something crashes the machie. This time a bad memory stickNow BCM will not load and it tells me to start the SQL. It wont start and tells me to go to a MS web site for help. I go through the people chatter and try the three things that are suggested. Uncompresisng a file, directory, running a repair utility, and nothing works.I cannot get bcm to even start. Should I have some support package like I bought with ACT $149.00 per year to fix bugs? This should not be that hard. And now I have been without a database I need for over a week. LAst time I had India help it took two weeks to get my $59.00 help to come up with a solution. - Anonymous
April 24, 2008
Not sure if I am in the right place but having difficulty with BCM and the product and services list. We have been using Opportunitys to create our quotes which then link to Accounting 2008. Why if I put new products and services into the list in bcm they not show in the accounts products and services but does if its done the other way round. And why when you add products or services in the quote itself does not not save to the product and services list. Input a whole load of info into a quote believing its saving to the list.Any advice would be gratefully recievedThanks - Anonymous
September 03, 2008
The comment has been removed - Anonymous
September 04, 2008
Hi MikeSo did you copy the .mdf and .ldf file toc:Documents and Settings<user name>Local SettingsApplication DataMicrosoftBusiness Contact Manager folder?OS Error 5 means it is there, but you have been denied access. Is the login information same on the old machine and the new machine?ThanksVinit [MSFT] - Anonymous
September 04, 2008
The login information as per user is the same but the computer names are different? Is there an issue in trying to run the Dbase in SQL Server 2000?, when I go into the ENterprise Manager I cannot drop down to the attached databases because it requires SQL 2005, but when I try to install SQL 2005 I have a problem with the instance of SQL 2005 Express?Thanks - Anonymous
September 04, 2008
So i believe you are using BCM 2003 i.e BCM Version 2. Is this on XP or Vista?If you have Enterprise Manager for 2000 it should work with 2000 database. Did you migrate your database from SQL 2000 to SQL 2005?ThanksVinit [MSFT] - Anonymous
September 04, 2008
I am using the BCM in XP that came with Office Ultimate 2007. I didn't knowingly migrate to 2005? Essentially the Database ran fine on the old computer until it got damaged, I was able to recover the ldf and mdf files. I reinstalled the same copy of Office Ultimate on the new laptop I recieved from a coworker. I have a copy of SQL 2005 and 2000.Thanks for your help. - Anonymous
September 04, 2008
i see. Did you try renaming the .mdf file (before you do that please make a copy of your .MDF file) and running the command above? From the error it says the file already exists.-Vinit [MSFT] - Anonymous
September 15, 2008
BCM Team, I have the same issue that Mike Bassell mentioned in a previous comment. I have a clients computer with BCM 2003 and this script does not appear to work. Sateesh replied to him but I still don't understand. Can someone please clarify what exactly needs to be changed in order for the script to work? Thanks,
- Ben
If you have BCM V2, the SQL instance name is not MSSMLBIZ. It has a different name starting with MICROSOFT. Till BCM V2 SP3, BCM shipped with MSDE. Only from BCM V2 SP4 that MSDE was replaced with SQL Express. Inorder for the script to work with BCM V2, you need to change the V2 instance name, the location of the MSDE sql exe file, the location where BCM V2 stores the mdf and the ldf files. Try making these changes and let me know if it works.
- Anonymous
September 15, 2008
BCM Team, Environment: XP SP3 Fresh Install of Office 2003 and BCM Installed BCM SP1 Cannot located the sqlcmd.exe file.... Thanks,
- Ben
Anonymous
September 15, 2008
Hi If you have BCM 2003, you should probably update it with SP3. Sqlcmd.exe can be found under C:Program FilesMicrosoft SQL Server"version of sql"ToolsBinn Thanks Vinit [MSFT]Anonymous
October 07, 2008
I have the same issue with mdf and ldf, I have them renamed in the localbusiness manager directory (I renamed them idmachines) Yet when I go to bcm database tools select it doesn't see idmachines After I ran the script the idmachines restore result.txt only contained file attach db returned 0 Vista SP1 2007 Outlook 12 and BCM 3Anonymous
November 04, 2008
I'm very much a novice at data recovery. Here's my story: I run XP Pro and I upgraded from Office for Small Business 2003 to Office for Small Business 2007. The upgrade went well, including the recognition of my existing BCM files. But, Outlook 2007 with BCM ran slowly and there was a connectivity issue to my corporate exchange server they haven't de-bugged yet. So I elected to uninstall Office for Small Business 2007 and reinstalled Office for Small Business 2003. That went well except it won't recognize my BCM .mdf or .ldf files. I spent four and a half hours on the phone with Microsoft's BCM team in southern India yesterday trying to rename the files so they could be recognized in BCM 2003 again. They gave up on it saying the files were corrupted and are unrecoverable because of the upgrade to 2007, then subsequent reversion to 2003. I don't buy this explanation yet. Any guidance on recovery is greatly appreciated. I have a few hundred business contacts with related phoncon records, appointments, etc that are quite valuable to my business. Thanks for taking a minute to read my sad story and for any assistance that may come of it. If necessary I'll find someone with lots more chops at this than me to carry out any instructions offered. Gary1029Anonymous
November 05, 2008
Hi Gary When you would have upgraded from BCM 2003 to 2007 we would have created a back up of your database under "My Documents/My Business " folder. You can simply restore it in BCM 2003. let me know if this helped Thanks Vinit [MSFT]Anonymous
November 05, 2008
Vinit, Thank you for your response. A file titled GarysBusinessContactManager.sbb does indeed exist right where you said it would be! It is dated for the date I performed the upgrade to 2007. How do I restore it so that BCM 2003 will recognize it? I clicked on Database Tools, Manage Database, and Restore. It's looking for file extension .msbcm. The file is currently named GarysBusinessContactManager.sbb. Thanks for your assistance. GaryAnonymous
June 28, 2009
Hi BCM Team, My old laptop was sent off for repair but was lost by the courier. I am trying to restore my BCM from files I had on the hard drive. I am not a technical expert but managed to restore it once with the help of my neighbour - however stupidly I then deleted the extra databases (MSSmallBusiness2) and then found that BCM would no longer work. I have since restored and reformatted the hard drive a couple of times to try a clean reload but have not succeeded. The text files that have been created after running the RestoreDB.cmd say HResult 0x2, Level 16, State 1 Shared Memory Provider: Could not open a connection to SQL Server [2]. Attach DB Returned:1 Attach DB Returned:0 and HResult 0x2, Level 16, State 1 Shared Memory Provider: Could not open a connection to SQL Server [2]. Attach DB Returned:1 plesae can you help me get back up and running many thanks PhilipAnonymous
June 29, 2009
Hi Philip, I searched online for the error message that you are getting and found a useful acticle that could help you. Please refer to this and let me know if it helped http://littletalk.wordpress.com/2008/03/21/an-error-has-occurred-while-establishing-a-connection-to-the-server-when-connecting-to-sql-server-2005-this-failure-may-be-caused-by-the-fact-that-under-the-default-settings-sql-server-does-not-all/ Thanks Vinit [MSFT]Anonymous
July 01, 2009
Greetings. Being rather unfamiliar with BCM as a whole, I apologize for being rather verbose in this post. We are speaking about Outlook 2003 with the Business Contact Manager installed. Every time we enter Outlook we receive numerous: Managed MAPI Service Catastrophic Failure error messages. Could not initialize CLR. The parameter is incorrect. We have been trying to restore the BCM file. Recently, with the help of this article, we have recovered several important finds. In %LOCALAPPDATA%MicrosoftBusiness Contact Manager one WILL find the .ldf and .mdf files that are spoken about in this article. In any event, we are trying to restore the BCM file to allow the file to be opened. Now, interestingly enough, we created a ‘Test’ profile on the machine in question in Outlook 2003. The test profile opens with no error messages save an error about Microsoft Office Outlook SMS add-in. However, the second we try to add anything related to the Business Contact Manager file in, for example, Data File Management under the ‘File’ menu, we receive the Managed MAPI Service Catastrophic Failure message repeatedly. What should we do? Should we reinstall Office Outlook 2003? What risk does this pose to losing the Outlook Data files? Also, a separate Office Outlook 2003 version does exist on another computer. I have read here that installing Office 2007 creates a backup of the BCM files on the machine. I do believe that there is a trial version of Office 2007 installed, but I have yet to open Outlook or take a look at that. At the moment, the only concern is the recovery of the BCM file from the ldf and mdf files. They are titled: Prosearch.ldf and Prosearch.mdf. The mdf file is approximately 100,000 kB and the ldf is approximately 15,000 kB. Moreover, a glimpse in the Control Panel in Add/Remove Programs does not reveal much information about BCM. All that is listed for BCM in add/remove programs applet window is the Business Contact Manager Update for Outlook 2003. We are not that familiar with SQL and simply need assistance restoring this BCM file from these two files. Any help on this issue is greatly appreciated.Anonymous
August 02, 2010
does this method work on windows 7 and bcm 2003 to bcm 2007? When i do the steps above, I am not able to see bcm (repaired) as one of the legit databases. Any ideas?Anonymous
September 02, 2010
Hi guys, I use BCM 2007 on office 2010 on my personel computer (windows 7)... I export BCM database.... Then my IT manager import it company server 2003 then server 2005 on XP server... But I cannot add or change any record. Error message is : "must declare the scalar variable @ID"... I can still use it on my computer but not in server... Any suggestion... Please....Anonymous
November 02, 2010
Hi Guys, I tried the above script, but I doesn't do the trick for me.... My situation: Using BCM 2007, I am trying to start all over using an old offline database. I've got the folder which has the .ldf and .mdf file and also the two folders Cache and Config (not sure if I need those). At first I simply put the files and folders in the userappdatamicrosoftBusiness Contact Manager folder. Then I went to BCM to select that database instead of the current SmallBusiness database, but it wouldn't select that old database in the dropdown menu. I guess I'm missing the right file and BCM doens't recognise this as a 'complete' database? Net, I've tried the script to attach the two files, but keep getting the message that the 'name already exists'. I've tried renaming both the .ldf and .mdf file but then it give me the message that the filenames do not correspond to the primairy database file. Can anybody help me out on this? Would be greatly appreciated! Cheers, GjaltAnonymous
November 17, 2010
I have the same problem as Gjalt. I have tried everything in this blog. My files (.mdf & .ldf) are in the correct place and yet they do not appear in the drop down menu when selecting a database. Any help? CalumAnonymous
December 02, 2010
thaaanks...working perfectly with my BCM 2007 SP2 (after i changed the Path from the script to my german Windows version)Anonymous
January 19, 2011
Hello, I tried to follow the top posting but when I click the command, I get a notepad message with the following: HResult 0x2, Level 16, State 1 Shared Memory Provider: Could not open a connection to SQL Server [2]. Attach DB Returned:1 Any ideas?Anonymous
June 26, 2011
I tried the same steps as Gjalt above with not much better outcome. Not too keen on this program. It doesn't see the file in the drop down.Anonymous
August 24, 2011
I get this error? Attach DB Returned:3Anonymous
November 28, 2011
The comment has been removedAnonymous
October 09, 2012
Will this script work for BCM for Outlook 2010 (32-bit)?Anonymous
May 28, 2014
Hi, How can I extract the data from these database files? I am trying to move to a new CRM and need the history and opportunity information in a better format. Thanks,Anonymous
October 24, 2014
The comment has been removedAnonymous
August 07, 2015
The comment has been removed