Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I backup a large db?

Posted on 2003-10-24
10
Medium Priority
?
315 Views
Last Modified: 2008-02-01

I need to do a quick and dirty backup of a database 130 GB in size...

What I plan is:

use master
go
alter database BigDB
set single_user with rollback immediate

sp_detach_db 'BigDB'


copy the db files to another server....400 GB free (RAID-5)


then, on the original server:

use master
go
sp_attach_db 'BigDB','d:\Program Files\Microsoft SQL Server\MSSQL\Data\BigDB_Data.mdf'

restore database 'BigDB' with recovery


Will this work?
 I have most of the weekend to do it.
Is there minimal risk of loss to my data?
Is there a way to do this while the db is online?

Any other suggestions? (BTW, I dont have a tape drive large enough...)


0
Comment
Question by:TARJr
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 9616844
is it all data or is some of the 130GB the transaction log?
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 9616867
have you considered transactional replication... your going to take the network traffic hit anyway?

how are you backing this up at the moment ?
0
 
LVL 70

Expert Comment

by:Scott Pletcher
ID: 9616932
Excellent point:

What are the data and log sizes respectively?

Also, note that you should *NOT* issue the RESTORE command:

restore database 'BigDB' with recovery  -- *don't* issue this

The attach will put the db back the way it was before the detach.

Finally, note that you have to copy only the data file to another drive/server; if necessary, you could attach only the data file and get a new log file created from scratch.  This could save you significant time is the log file is large.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:TARJr
ID: 9617013

Recovery model: Simple

so we don't care about the trans log...right?

log file size shows: 1.78 GB  (oops...I don't have Auto Shrink checked..can I check it now?)


0
 
LVL 70

Expert Comment

by:Scott Pletcher
ID: 9617067
Yep, don't have to worry about, but if it's that relatively small, might as well copy it also.

It will probably be worth the time to make the copy locally, then attach the original db (if you need to get running again asap), then zip the copy, then ship the zipped copy to another location.
0
 
LVL 1

Author Comment

by:TARJr
ID: 9617105

So, I can detach....copy only the .mdf file to another location...(delete the .ldf log)

then attach the original again (with recovery)...will it "look" just like it was when
I detached it?

0
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 9617123
Yes, you can attach just the data file and a new log file will be built, and the db tables, etc., will be exactly the same.

The sp_attach_db is implicitly (automatically) "with recovery".  You will not need to issue an actual RESTORE command, only the attach.
0
 
LVL 34

Expert Comment

by:arbert
ID: 9617186
Look at SQLLitespeed--cheap product.  Backed up 300gig in about 30minutes and compressed it to about 50gig....

http://www.dbassociatesit.com


Brett

0
 
LVL 1

Author Comment

by:TARJr
ID: 9750317
I looked at SQL LiteSpeed and the GUI doesn't support backup over the network...The next version may.

0
 
LVL 34

Expert Comment

by:arbert
ID: 9750386
The proc does:

EXEC xp_backup_database @database = 'hwmf_db_idea'
                      ,@filename = '\\dhwidea\c$\backup.bak'
                      ,@init = 1

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

926 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