Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2004, 04:15 AM
Authorized User
 
Join Date: Jun 2004
Location: Georgetown, Selangor, Malaysia.
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hlchuah77
Default Backup database

I have formatted my hdd this recently, I forgot to backup my database (in fact, I don't know how), all the data are lost subsequently. I want to know how to backup my database to a different hard drive, and import it back from the drive where I back-up before, to the formatted drive when my OS is ready.

This is my second question:

My friend want me to give him a copy of my database (my database schema) because he want to use it, the problem is that he is staying far away from where I stay, and my friend don't want me to export data to him via internet as it is insecure. Any solution?

Thanks.

Reply With Quote
  #2 (permalink)  
Old December 4th, 2004, 10:47 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Once you have SQL install and Patch with SP3A

Is your Drive on the same computer/Server?
If it is use this

Example to restore database

Code:
RESTORE DATABASE TestDB 
   FROM DISK = 'c:\Northwind.bak'
   WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
   MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'

To back up your database and give to a friend you have several options

Depending on its size make a back and burn it to a CD. You can also Zip or compress the backup file and then burn it to a cd. If you have Winzip you can encrypt it or password protect the file for email.
Example for backing up database
Code:
BACKUP DATABASE Northwind 
   TO DISK = 'c:\Northwind.bak'

Jaime E. Maccou
Applications Analyst
Database Programmer
Reply With Quote
  #3 (permalink)  
Old December 4th, 2004, 01:12 PM
Authorized User
 
Join Date: Jun 2004
Location: Georgetown, Selangor, Malaysia.
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hlchuah77
Default

Hi, jemacc, I am not so clear about this:

 
Quote:
quote:RESTORE DATABASE TestDB
Quote:
   FROM DISK = 'c:\Northwind.bak'
   WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
   MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'


It is quite clear what the first line and second line are, but I am not so understand what the third and fourth line are. What does it means?

I know 'Northwind' and 'Northwind_log' are the backed-up database and its log, rite? But why move to 'c:\test\testdb.mdf' and 'c:\test\testdb.ldf'?

I have browsed through my C directories, I see there are numbers of database table and log file in this => C:\Program Files\Microsoft SQL Server\MSSQL\Data

If I follow yours example, is it correct if I code as this:

WITH MOVE 'Northwind' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data',
MOVE 'Northwind_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data'[/quote]





Reply With Quote
  #4 (permalink)  
Old December 4th, 2004, 01:34 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

The "move" . If you had your original database in a different folder or disk this will allow you to move the location of the data and log files. It is best practice not to have your application file and your data files in the same drive or location.

Code:
RESTORE DATABASE TestDB 
   FROM DISK = 'c:\Northwind.bak'
   WITH RECOVERY, REPLACE,
   WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
   MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'
With replace - this will wipe out all data files/log files and restore the database based on the info generated in the backup. If you were to move the data files/log files to a new location you would need to have the file name and specify the new location via the move option with restore.

If you keep the same database name then

Code:
RESTORE DATABASE NorthWind
   FROM DISK = 'c:\Northwind.bak'
and it will restore to it default location




Jaime E. Maccou
Applications Analyst
Database Programmer
Reply With Quote
  #5 (permalink)  
Old December 5th, 2004, 11:57 AM
Authorized User
 
Join Date: Jun 2004
Location: Georgetown, Selangor, Malaysia.
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hlchuah77
Default

Understand finally, thanks. :)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Backup compad ASP.NET 2.0 Basics 1 February 5th, 2008 11:06 AM
backup of database MunishBhatia SQL Server 2005 0 October 5th, 2007 04:20 AM
Backup of Database (C#) meljab BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 March 31st, 2007 11:45 AM
Backup Database gaurav_jain2403 SQL Server 2000 0 August 3rd, 2006 12:57 AM
Database Backup prakash.wadkar ADO.NET 1 February 22nd, 2005 01:06 PM



All times are GMT -4. The time now is 02:58 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.