Solved

copy mdf and ldf files

Posted on 2015-01-26
7
217 Views
Last Modified: 2015-01-26
proper and safe way to copy ldf and mdf files.

sql server is the rdbms

is it safe for me to stop the sql service and then copy the mdf files or ldf files.
or do i have to detach or brind the db's offline to make this a safe process.

i need to copy the mdf and ldf files on a instance but i can't use the backup service for this.
it needs to be a copy and paste job.

also, dumb question but thought i would check my bases.
making a copy of the mdf and ldf files is just as good as making a full copy only backup of a database correct.

thanks a bunch
0
Comment
Question by:jamesmetcalf74
  • 4
  • 3
7 Comments
 
LVL 45

Accepted Solution

by:
Vitor Montalvão earned 500 total points
Comment Utility
is it safe for me to stop the sql service and then copy the mdf files or ldf files.
Yes but stopping SQL Service would make any database in that instance to be unavailable. Also could stop any running process and so with impact in any application.

or do i have to detach or brind the db's offline to make this a safe process.
Safe just because it's only makes a single database offline. Be careful with what I said above about the running processes. The same applies here for the processes relative to the database.

i need to copy the mdf and ldf files on a instance but i can't use the backup service for this.
Why not?
0
 

Author Comment

by:jamesmetcalf74
Comment Utility
because the sql agent won't start and the server seems jacked up.  Wanted to make some copies of the databases before I dug into the problem.  windows event log won't start either
0
 

Author Closing Comment

by:jamesmetcalf74
Comment Utility
Thanks Vitor!
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
You can run a backup from SSMS. Just create a new query and run the following command:
BACKUP DATABASE DatabaseName TO DISK='<Path\Filename.bak>'

Open in new window

0
 

Author Comment

by:jamesmetcalf74
Comment Utility
sweet
so the backup utility within sql server does not necessarily rely on sql agent being started?
0
 

Author Comment

by:jamesmetcalf74
Comment Utility
also... command to run backup for all databases without having to name every one?
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
There's no backup utility in SQL Server, only the backup command.
SQL Server Agent is only a schedule task for SQL Server. What it does for backups is run the same backup command in a configured schedule.

Try the following command for backing up all databases (I didn't test it):
exec Sp_MSForEachDB 'BACKUP DATABASE ? TO DISK='C:\temp\?.bak''

Open in new window

0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now