If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Restore

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-09, 15:51
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
Restore

Hi guys I know this is a Noob and silly question but I am trying to do a restore
and I am trying to do this corredtly. is this ok??
Code:
USE master
GO

RESTORE DATABASE <SoftWareTesterdb>
	FROM  DISK = N'<D:\Database\MSSQL\MSSQL.1\MSSQL\Backup\NonProductionDiff.bak' 
WITH  
	FILE = 1,  
	NOUNLOAD,  
	REPLACE,
	STATS = 10
GO
Reply With Quote
  #2 (permalink)  
Old 07-01-09, 17:13
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,781
Remove the < from the path to the file.
Reply With Quote
  #3 (permalink)  
Old 07-01-09, 23:51
Brett Kaiser Brett Kaiser is offline
SQLTeam Scrub
 
Join Date: Nov 2002
Location: Jersey
Posts: 9,976
Have you tried filelistonly to look at the dump first?
__________________
Brett
8-)

It's a Great Day for America everybody!
My Blog
My SQL Blog dbforums Yak CorralRadio 'Rita
dbForums Member List SQLTeam Member List
It's 5:00 Somewhere Pearls
The physical order of data in a database has no meaning.
Reply With Quote
  #4 (permalink)  
Old 07-07-09, 12:49
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
Hi all I'm just practicing restoring. I deleted a table from the Adventureworks Database. Here is the statement I used. Any Advice

RESTORE DATABASE [AdventureWorks] FROM DISK = N'E:\TestBackup\NonProdFull' WITH FILE = 1, REPLACE, NOUNLOAD, STATS = 10
GO

here is message I got, hope I did this correctly
10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
60 percent processed.
70 percent processed.
80 percent processed.
90 percent processed.
100 percent processed.
Processed 21432 pages for database 'AdventureWorks', file 'AdventureWorks_Data' on file 1.
Processed 2 pages for database 'AdventureWorks', file 'AdventureWorks_Log' on file 1.
RESTORE DATABASE successfully processed 21434 pages in 3.416 seconds (51.400 MB/sec).
Reply With Quote
  #5 (permalink)  
Old 07-07-09, 14:03
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,781
The results look correct to me. Is your table back?
Reply With Quote
  #6 (permalink)  
Old 07-07-09, 14:50
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
it sure is I just wanted to make sure that is the correct restore process
Reply With Quote
  #7 (permalink)  
Old 07-08-09, 13:48
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
I have another question when I did a restore from Differential I got this error message
Code:
RESTORE LOG [AdventureWorks] FROM  DISK = N'E:\TestBackup\NonProdDiff' WITH FILE = 1, REPLACE, NOUNLOAD, STATS = 10
GO
Msg 3117, Level 16, State 4, Line 1
The log or differential backup cannot be restored because no files are ready to rollforward.
Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.
Reply With Quote
  #8 (permalink)  
Old 07-08-09, 15:04
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,781
Did you restore the full backup before with NORECOVERY?
Reply With Quote
  #9 (permalink)  
Old 07-08-09, 15:18
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
No I didnt restore with the NORECOVERY

sorry I reread what you posted and that was all wrong LOL

Last edited by desireemm; 07-08-09 at 18:49.
Reply With Quote
  #10 (permalink)  
Old 07-08-09, 17:51
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
ok did a restore with NoRecovery and here is the message I got, looks like the log is too recent to apply to the database.

10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
60 percent processed.
70 percent processed.
80 percent processed.
90 percent processed.
100 percent processed.
Processed 21432 pages for database 'AdventureWorks', file 'AdventureWorks_Data' on file 1.
Processed 2 pages for database 'AdventureWorks', file 'AdventureWorks_Log' on file 1.
RESTORE DATABASE successfully processed 21434 pages in 3.333 seconds (52.680 MB/sec).
Msg 4305, Level 16, State 1, Line 3
The log in this backup set begins at LSN 57000000030400034, which is too recent to apply to the database. An earlier log backup that includes LSN 57000000028000001 can be restored.
Msg 3013, Level 16, State 1, Line 3
RESTORE LOG is terminating abnormally.
Reply With Quote
  #11 (permalink)  
Old 07-08-09, 21:11
Thrasymachus Thrasymachus is offline
SQL Server Street Fighter
 
Join Date: Nov 2004
Location: Down The Rabbit Hole
Posts: 7,766
I think you are missing a t-log back between the time of the database backup and the time of the t-log you tried to apply.
__________________
software development is where smart people go to waste their lives
Reply With Quote
  #12 (permalink)  
Old 07-09-09, 12:19
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
thank you thrasy
Reply With Quote
  #13 (permalink)  
Old 07-10-09, 13:19
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
I Tried doing a restore yesterday and today and this is the error message I got

TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore failed for Server 'GCSQLTEST'. (Microsoft.SqlServer.Smo)

For help, click: Source&#58; ID&#58; &#40; &#41; - Events And Errors Message Center&#58; Message Details

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdN...0&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
Reply With Quote
  #14 (permalink)  
Old 07-10-09, 13:19
desireemm desireemm is offline
Registered User
 
Join Date: Feb 2004
Location: Alpine Califormia
Posts: 1,695
sorry i posted twice my mistake

Last edited by desireemm; 07-10-09 at 13:23.
Reply With Quote
  #15 (permalink)  
Old 07-10-09, 15:16
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,781
When you do a restore, you need to kick everyone out of that database, or else they will hold a lock on that database. What I do, is set the database to RESTRICTED_USER, before a restore, just to make sure that no non-admin user can get in. You can also set the database OFFLINE, if you have some applications that for reasons beyond your control are running as administrators. Remember to use the WITH ROLLBACK IMMEDIATE option, as well. Otherwise, you have to wait for the users to politely finish up.
Reply With Quote
Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On