all groups > sql server programming > july 2006 >
You're in the

sql server programming

group:

opening SQL server 2000 MDF + LDF file from DVD


opening SQL server 2000 MDF + LDF file from DVD chentiangemalc
7/13/2006 11:16:01 PM
sql server programming:
Hi,

I'm in the process of writing an application to open a database as read only
to view historical log data on a DVD. The databases were created with SQL
Server 2000. I am able to open them with SQL Server 2005 Express Edition, but
have to copy them onto my harddrive first.

I've had a look with google but didn't find any clear info.

What can I do so that I can open them read only from the DVD drive?

I haven't done programming for over year so a bit out of touch. I think
maybe I will need SQL 2000 MSDE?

The database won't include all the LDF files, so the database will be
incomplete, just want to view what is on the DVD.

Thanks if you have any advice...


Re: opening SQL server 2000 MDF + LDF file from DVD Arnie Rowland
7/13/2006 11:34:21 PM
You could use sp_attach_db. Check in Books on Line for a refresher,
parameters, etc.

You will need both the data file (mdf) and a single log file (ldf) to
successfully attach the read-only db. The log file can be the smallest
possible since it can't be written to.

--
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."



[quoted text, click to view]

Re: opening SQL server 2000 MDF + LDF file from DVD chentiangemalc
7/13/2006 11:39:01 PM
Ideally I don't want to copy the files to the harddisk, I want them to stay
on DVD if possible.

I'm not sure if it's possible?

The database is historical data collected in an industrial process control.
The client has no way to view this on any machine except the machine that
created the database. I just want to make a quick utility for displaying the
data on othe DVD.

If I have to I will copy the DVD temporarily onto the harddisk, but it's
2-4 GB file so wouldn't be very fast...



[quoted text, click to view]
Re: opening SQL server 2000 MDF + LDF file from DVD chentiangemalc
7/13/2006 11:42:02 PM
Thanks, that sounds like it should work.

Just looking in my original post I realise I should have said MDF+NDF.

I have the MDF, NDF and LDF file on the DVD.


[quoted text, click to view]
Re: opening SQL server 2000 MDF + LDF file from DVD Uri Dimant
7/14/2006 12:00:00 AM
Hi
Well, one thing consider , sql server may encounter a probelm whit attach
DATABASE because the files weren't detach first as it describes in the
BOL.



[quoted text, click to view]

Re: opening SQL server 2000 MDF + LDF file from DVD Uri Dimant
7/14/2006 12:00:00 AM
Hi
Copy the files on hard disk and then RESTORE the database

You don't want to store the file on DVD ,do you?


[quoted text, click to view]

Re: opening SQL server 2000 MDF + LDF file from DVD Helmut Woess
7/14/2006 12:00:00 AM
Am Thu, 13 Jul 2006 23:16:01 -0700 schrieb chentiangemalc:

[quoted text, click to view]

It is possible with some limitations:
http://www.sqlteam.com/item.asp?ItemID=127

Re: opening SQL server 2000 MDF + LDF file from DVD oj
7/14/2006 12:13:17 AM
If you did not set the original database to readonly before you detach it
and put it on the CD/DVD, you will not successfully attach it as readonly.
In another word, if the database is still set as read_write, on attach (via
sp_attach_db or create/for attach), the system will have to put it back into
that mode. Having it on a readonly media will cause a failure.

--
-oj



[quoted text, click to view]

Re: opening SQL server 2000 MDF + LDF file from DVD Arnie Rowland
7/14/2006 12:14:28 AM
It will be necessary to move the db files to a drive with the same path as a
'typical' dvd, attach them, adjust file sizes (shrinkdatabase and
shrinkfile), and then detach them BEFORE burning to disk.

This will not work unless the file location is properly recorded within the
datafile itself. It the disk is burned with the file thinking that it is
located on D:, it will not open of E:. Copying to the hard disk is the more
robust option.

See: http://www.sqlteam.com/item.asp?ItemID=127

--
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."



[quoted text, click to view]

AddThis Social Bookmark Button