Showing posts with label sproc. Show all posts
Showing posts with label sproc. Show all posts

Monday, February 13, 2012

Attaching a DB to a Network Folder

I'm trying to attach a db to a network folder.

I used the sproc sp_attach_db from master db to attach a test db to a local drive (c:\test) and works fine.

EXEC sp_attach_db @.dbname = N'myDatabase',
@.filename1 = N'C:\Test\myDatabase.mdf'

NO PROB. With this--

but when i try to attach a test td to a network drive, (\\computer\test) does not work.

EXEC sp_attach_db @.dbname = N'myDatabase',
@.filename1 = N'\\computer\test\myDatabase.mdf'

--I get this error message -

File '\\computer\test\myDatabase.mdf' is on a network device not supported for database files.

So i'm thinking that I can not use sp_attach_db sproc to attach a db to a network drive?

Is there any other way to attach a db to a network drive?

I even tried to map the network folder and it did not work.

EXEC sp_attach_db @.dbname = N'myDatabase',
@.filename1 = N'z:\test\myDatabase.mdf'

Yeah i forgot to tell you I'm using SQL Server 2000.
If you have ever run into this kind of situation, please let me know.

Thanks.

Irv

This link may help

http://support.microsoft.com/default.aspx?scid=kb;en-us;304261

specifically the use of trace flag 1807

|||You could try adding trace flag 1807
Allows you to configure SQL Server with network-based database files.

Note: I would not do this with a database myself because I don't know the down side.

See thread http://forums.databasejournal.com/showthread.php?t=30580&goto=nextnewest

Tim S

|||

Thanks Guys, That was really helpful!

Irv

Thursday, February 9, 2012

attach/deattach database

is it possible to create a dts job or sproc that can be launched via a vbs
file or wsh script that:
1. unattaches a sql 2000 database
2. copies it to a removable drive
3. re-attaches original db
4. and does opposite at office to keep a sql in sync?
any ideas on best method and syntax would be appreciated.Scott,
If youo are trying to have a remote database that is in sync, or at least
is in syn some what, is it possible to use replication? A snap shot
replication using the SQL Server as both the publisher and the distributor
can create a push a snapshot of the entire database, or selected tables from
the database. If the databases are not connected (I noted that you want to
use a removeable drive) then a process can be developed to copy the files to
a drive and then mount the databases on the remote server. Here is just one
method:
1. Create a job that backups up the database
2. Create a DTS package that will copy the backup files to the removable
drive.
3. Step 2 of the job would be to execute the DTS package in step 2.
4. Do the reverse on the remote server but in place of the backup create a
job that restores the database.
Detaching and reattaching can be an option as well as long are not
connections to the database when it is detached. A Backup can be done
regardless if the database is in use or not.
Hope this helps.
Rick
"scott" wrote:
> is it possible to create a dts job or sproc that can be launched via a vbs
> file or wsh script that:
> 1. unattaches a sql 2000 database
> 2. copies it to a removable drive
> 3. re-attaches original db
> 4. and does opposite at office to keep a sql in sync?
> any ideas on best method and syntax would be appreciated.
>
>