Moving data and log files  
Author Message
JimDJohnson





PostPosted: Fri Jun 10 04:30:25 CDT 2005 Top

SQL Server Developer >> Moving data and log files

Hi there.

Is there an easy/correct way to move a database's data and log files(.mdf,
.ldf) to a new location? I know there must be a simple way (system stored
procs or something) - I've just been stumbling around manually copying,
creating new databases, restoring, renaming etc....

Note: dont assume any level of intelligence on my part!

Any suggestions would be appreciated!

SQL Server30  
 
 
Jacco





PostPosted: Fri Jun 10 04:30:25 CDT 2005 Top

SQL Server Developer >> Moving data and log files The knowledge base article "Moving SQL Server databases to a new location
with Detach/Attach"
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q224071
gives you the complete manual.

--
Jacco Schalkwijk
SQL Server MVP




> Hi there.
>
> Is there an easy/correct way to move a database's data and log files(.mdf,
> .ldf) to a new location? I know there must be a simple way (system stored
> procs or something) - I've just been stumbling around manually copying,
> creating new databases, restoring, renaming etc....
>
> Note: dont assume any level of intelligence on my part!
>
> Any suggestions would be appreciated!
>
>


 
 
marcmc





PostPosted: Fri Jun 10 05:21:06 CDT 2005 Top

SQL Server Developer >> Moving data and log files be careful that some idiot doesn't remove/delete your log file though as
happened me. However it was my fault that I detached the database and tried
to reattach with single file thus thinking I could create a new log file.
sp_attach_single_file_db is EXTREMELY UNRELIABLE.



> The knowledge base article "Moving SQL Server databases to a new location
> with Detach/Attach"
> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q224071
> gives you the complete manual.
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
>


> > Hi there.
> >
> > Is there an easy/correct way to move a database's data and log files(.mdf,
> > .ldf) to a new location? I know there must be a simple way (system stored
> > procs or something) - I've just been stumbling around manually copying,
> > creating new databases, restoring, renaming etc....
> >
> > Note: dont assume any level of intelligence on my part!
> >
> > Any suggestions would be appreciated!
> >
> >
>
>
>
 
 
JosephPruiett





PostPosted: Fri Jun 10 11:01:04 CDT 2005 Top

SQL Server Developer >> Moving data and log files You can do anything in SQL that you can in DOS shell scripting by using EXEC
master.dbo.XP_CMDSHELL 'command'. Example
EXEC master.dbo.xp_CMDSHELL 'DIR /B' which will give all file listings from
you default directory. Which means if you can get it copy the file from one
directory to another in dos then you can use a scripts using XP_CMDSHELL to
copy mdf and ldf.

Hope this points you in right direction.




> Hi there.
>
> Is there an easy/correct way to move a database's data and log files(.mdf,
> .ldf) to a new location? I know there must be a simple way (system stored
> procs or something) - I've just been stumbling around manually copying,
> creating new databases, restoring, renaming etc....
>
> Note: dont assume any level of intelligence on my part!
>
> Any suggestions would be appreciated!
>
>