Solved

How can I backup a large db?

Posted on 2003-10-24
10
282 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
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.
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
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

839 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