Solved

How can I backup a large db?

Posted on 2003-10-24
10
289 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 69

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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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 69

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 69

Accepted Solution

by:
Scott Pletcher earned 125 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

762 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