?
Solved

copy mdf and ldf files

Posted on 2015-01-26
7
Medium Priority
?
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 51

Accepted Solution

by:
Vitor Montalvão earned 2000 total points
ID: 40570687
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
ID: 40570696
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
ID: 40570697
Thanks Vitor!
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 51

Expert Comment

by:Vitor Montalvão
ID: 40570704
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
ID: 40570710
sweet
so the backup utility within sql server does not necessarily rely on sql agent being started?
0
 

Author Comment

by:jamesmetcalf74
ID: 40570713
also... command to run backup for all databases without having to name every one?
0
 
LVL 51

Expert Comment

by:Vitor Montalvão
ID: 40570735
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

801 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