Solved

How can I backup a large db?

Posted on 2003-10-24
10
252 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:ScottPletcher
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
 
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:ScottPletcher
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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:
ScottPletcher 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SLQ View not updating 10 46
SQL Percentage - Bring back full percentage 5 48
Help in Understanding a SQL Query 7 27
separate column 24 20
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now