Board index » delphi » Problem moving database to new location

Problem moving database to new location


2004-08-24 04:00:27 AM
delphi0
SQL server 2000 and Delphi 6
My database is in C.\OriginalLoc.
I shut down SQL server, copy the database to C:\NewLoc and delete
C:\OriginalLoc.
I start SQL server again, and start the application
The application now complains about the physical filename
in C:\OriginalLoc possibly being incorrect. This is true, since it has been
deleted,
but why does it complain in the first place. What part of the system
"remembers" C:\OriginalLoc.
My application finds the correct location of the database by locating the
application.exe and the builds a path from there. The database is in a
subdirectory
within the application directory C:\NewLoc. I believe this way of doing it
is OK,
since I have managed to fix the problem twice while investigating it,
but I could never figure how I did it. It suddenly just worked.
So the question is:
- What mechanism remembers previous DB locations?
Thanks,
Anders J
 
 

Re:Problem moving database to new location

You cannot simply do a file copy of a database to another location: the
database definition includes explicit paths to data and log files.
Your easiest path is probably to backup the DB in SQL Server, and restoring
it to another directory. This will automatically adjust file path info.
 

Re:Problem moving database to new location

This is strange, since I managed to do it twice,
although without understanding how.
Also, SQL Server Enterprise Manager can attach to a copy without any
problems.
Or is this an unfair/illogical comparison?
Anders
"Bob" <XXXX@XXXXX.COM>skrev i meddelandet
Quote
You cannot simply do a file copy of a database to another location: the
database definition includes explicit paths to data and log files.

Your easiest path is probably to backup the DB in SQL Server, and
restoring
it to another directory. This will automatically adjust file path info.