update from mdf/ldf revisited

E

Erik vS

Hi
I'm afraid I'm not very experienced in these maters. In november 08 I bought
an XP-Pro laptop for my home-office and this had outlook 2007 with BCM
installed. I have been reading the blog/FAQ area and tried to put my question
there. I hope I have found the correct forum this time! :)

The default setting in XP was that the main and only user did not need to
log onto the computer: you start the computer and it goes right to the
desktop without logins. The "real" administrator account I did give a pw. Now
I rencently decided that I should have a pw also for the admin/user account
Erik (that's me :) but lo and behold! then BCM would not let me open my old
"MSSmallBusiness.ldf" and MSSmallBusiness.mdf. I created MSSmallBusiness2
files and used a backup which gave me part of my data back... but there must
be a way of using the ldf and mdf files to get all data back. I tried going
back to previous settings but windows would have nothing of it: if I had
created a pw for 'Erik' then this was not changed back when I tried older
system settings. I tried to simply remove the pw again, but this did not
trick the system either. I cannot go back to the old, unprotected 'Erik'.
Frustrating.
I get the "error 5 message" described on the blog, so it sees the files but
will not allow me to open it. I tried opening as the real administrator
login, but it also gave the error 5 message. It would seem that as the
original user Erik did not have a pw, any atempt to open it now is foiled by
the rule that one needs a pw! :)
I tried to modify the script that is found on the blog page so that it might
work on my swedish computer. it now looks like this:

"c:\program\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S
..\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = 'MSSmallBusiness', @filename1 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.mdf', @filename2 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.ldf';">>"C:\Documents
and Settings\Erik\Lokala inställningar\Application Data\Microsoft\Business
Contact Manager\MSSmallBusiness_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%>>"C:\Documents and
Settings\Erik\Lokala inställningar\Application Data\Microsoft\Business
Contact Manager\MSSmallBusiness_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%


I expected that running this script the txt files should appear in the
stated local app data folder but nothing shows up. Actually nothing much
seems to happen at all. Someone else had also noted that there was no
MSSMLBIZ folder on the computer. Looking for this name a search come up with
the file perf-MSSMLBIZsqlctr.ini found in the folder C:\Program\Microsoft SQL
Server\MSSQL.1\MSSQL\Binn
(please note the simple 'C:\Program\' as an exemple of what can be slightly
different on a swedish computer.

Can anyone see what is either wrong in the above scipt (I maybe did not
properly exchange the %% variable with a complete address line) or please,
please tell me what more I can do.
 
L

Luther

Hi
I'm afraid I'm not very experienced in these maters. In november 08 I bought
an XP-Pro laptop for my home-office and this had outlook 2007 with BCM
installed. I have been reading the blog/FAQ area and tried to put my question
there. I hope I have found the correct forum this time! :)

The default setting in XP was that the main and only user did not need to
log onto the computer: you start the computer and it goes right to the
desktop without logins. The "real" administrator account I did give a pw.Now
I rencently decided that I should have a pw also for the admin/user account
Erik (that's me :) but lo and behold! then BCM would not let me open my old
"MSSmallBusiness.ldf" and MSSmallBusiness.mdf. I created MSSmallBusiness2
files and used a backup which gave me part of my data back... but there must
be a way of using the ldf and mdf files to get all data back. I tried going
back to previous settings but windows would have nothing of it: if I had
created a pw for 'Erik' then this was not changed back when I tried older
system settings. I tried to simply remove the pw again, but this did not
trick the system either. I cannot go back to the old, unprotected 'Erik'.
Frustrating.
I get the "error 5 message" described on the blog, so it sees the files but
will not allow me to open it. I tried opening as the real administrator
login, but it also gave the error 5 message. It would seem that as the
original user Erik did not have a pw, any atempt to open it now is foiledby
the rule that one needs a pw! :)
I tried to modify the script that is found on the blog page so that it might
work on my swedish computer. it now looks like this:

"c:\program\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S
.\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = 'MSSmallBusiness', @filename1 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.mdf', @filename2 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.ldf';">>"C:\Documents
and Settings\Erik\Lokala inställningar\Application Data\Microsoft\Business
Contact Manager\MSSmallBusiness_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%>>"C:\Documents and
Settings\Erik\Lokala inställningar\Application Data\Microsoft\Business
Contact Manager\MSSmallBusiness_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%

I expected that running this script the txt files should appear in the
stated local app data folder but nothing shows up. Actually nothing much
seems to happen at all. Someone else had also noted that there was no
MSSMLBIZ folder on the computer. Looking for this name a search come up with
the file perf-MSSMLBIZsqlctr.ini found in the folder C:\Program\MicrosoftSQL
Server\MSSQL.1\MSSQL\Binn
(please note the simple 'C:\Program\' as an exemple of what can be slightly
different on a swedish computer.

Can anyone see what is either wrong in the above scipt (I maybe did not
properly exchange the %% variable with a complete address line) or please,
please tell me what more I can do.

Try running the sqlcmd without the ">>" and the rest of the line.
That's hiding sqlcmd's output.

If sqlcmd fails with a permission error, try setting the files
permissions on MSSmallBusiness.mdf and the ldf so that anyone can read
and write those files.
 
E

Erik vS

Hello Luther,

Thank you for your support. I think I followed your instructions, but no
success.

I changed the cmd file to this:
@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 MSSmallBusiness 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\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S
..\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = 'MSSmallBusiness', @filename1 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.mdf', @filename2 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.ldf';

Removeing everything after and including the ">>". Before doing this, I also
tried a version where only what was on that line was removed. The later lines
were kept. When this is run a command line window opens. There is a text
shown in it and a fraction of a second later the window is closed. I'm sorry,
but I can't tell you what the text is. If it is a permission error I don't
know.
Something I still have missed do you think?

I then went ahead to change the rights to the files. This took awhile as I
first had to discover that one has to uncheck the "simplified ownership" in
the folder alternatives.
I peeked in the security settings of the working MSSmallBusiness2 ldf/mdf
pair. Here NETWORK SERVICE as well as a "user" with a long name
(SQLServer2005MSSQLUser$LENOVO-MSSM...) had full rights. I made sure the same
rights were given to the old ldf/mdf files. I then tried to se if I could
access it from within Outlook (handle database/other databases...) It will
now not tell me that I don't have access (no more error 5 message) but on the
other hand there is nothing listed to pick from... I now also tried to run
the modified script and see if anything would happen. Nothing. I even run the
older script, but nothing happened either.

What can I do?

Erik von Stedingk
 
E

Erik vS

I just spotted something that I think is new, but might have been something I
overlooked (I don't think so though). The working ldf file is named
"MSSmallBusiness2._log.LDF". I think it previously was called
"MSSmallBusiness2.ldf". The time stamp of the file has not been changed.
Can this clue help?
Erik
 
L

Luther

Hello Luther,

Thank you for your support. I think I followed your instructions, but no
success.

I changed the cmd file to this:
@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 MSSmallBusiness 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\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S
.\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = 'MSSmallBusiness', @filename1 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.mdf', @filename2 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.ldf';

Removeing everything after and including the ">>". Before doing this, I also
tried a version where only what was on that line was removed. The later lines
were kept. When this is run a command line window opens. There is a text
shown in it and a fraction of a second later the window is closed. I'm sorry,
but I can't tell you what the text is. If it is a permission error I don't
know.
Something I still have missed do you think?

I then went ahead to change the rights to the files. This took awhile as I
first had to discover that one has to uncheck the "simplified ownership" in
the folder alternatives.
I peeked in the security settings of the working MSSmallBusiness2 ldf/mdf
pair. Here NETWORK SERVICE as well as a "user" with a long name
(SQLServer2005MSSQLUser$LENOVO-MSSM...) had full rights. I made sure the same
rights were given to the old ldf/mdf files. I then tried to se if I could
access it from within Outlook (handle database/other databases...) It will
now not tell me that I don't have access (no more error 5 message) but onthe
other hand there is nothing listed to pick from... I now also tried to run
the modified script and see if anything would happen. Nothing. I even runthe
older script, but nothing happened either.

What can I do?

Erik von Stedingk






- Show quoted text -

Instead of double clicking on the RestoreDB.cmd file, open a cmd
window, and there run the comand:
"c:\program\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S
..\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = 'MSSmallBusiness',
@filename1 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.mdf',
@filename2 =
'C:\Documents and Settings\Erik\Lokala inställningar\Application
Data\Microsoft\Business Contact Manager\MSSmallBusiness.ldf';

Then the cmd window won't close before you have a chance to read it.
 
E

Erik vS

Great! Thanks! Just to leave a searchable trace here to help anone with the
same problem, I'll write what I did with your last advice. There are a few
more hurdles. If you wish you maybe can comment what I write, in case I say
something stupid. :)

I first got an answer telling me "the database MSSmallBusiness already
exists. Please choose another database name". So I went to the folder,
renamed the MSSmallBusiness files BackupTest. Then edited the script
accordingly: replaced MSSmallBusiness with BackupTest everywhere. Ran the
script and just got the prompt as an answer. Hurray? Lesson: we can't have
MSSmallBusiness and MSSmallBusiness2 as names? Too close?

Checked the size of MSSmallBusiness2.mdf which was smaller (38MB) than the
BackupTest.mdf (57MB). No change. But, you'll see: no worries. It is not the
case that the latter is imported into the former as I thought.

Opened Outlook. No changes visible. Went into the DB-handling area and now I
can SEE, under "other databases" the BackupTest database! Can't do much more
with it though. Went into "Create or chose a database". I now had the choice
between MSSmallBusiness2 and BackupTest. I picked the latter of course.
Waiting window comes up then an error message. "Missing item" or something.
No change done. Rats. Closed Outlook, killed the process even, went back in.
Still the wrong list of contacts. Went into "Create or Chose" again. This
time no error message, but also no change in the contact list. Went into
"handle database" and "look for errors". Ran it. Closed the window and YES!
there it was!!!

Backed up everything and went to bed. ;-)
Thanks again
E
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top