Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

copy mdf and ldf files

Posted on 2015-01-26
7
Medium Priority
?
285 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 52

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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 52

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 52

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

604 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