Solved

copy mdf and ldf files

Posted on 2015-01-26
7
252 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 49

Accepted Solution

by:
Vitor Montalvão earned 500 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 49

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 49

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Master DB with Masterkey 1 40
ms sql + get number in list out of total 7 45
tempdb log keep growing 7 45
Add a step to a system backup job 6 36
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…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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