I created a new database in my test instance.Then I restore the same database into the same instance.First time it went successfully.Then immediately I fired another restore the next second.I got the following message.(1)I want to know even though I haven't done a single transaction how come the question of tail log comes.(2)If I backup the log using norecovery then the restore happens fine.Please elaborate.I will be very thankful.
Msg 3159, Level 16, State 1, Line 1 The tail of the log for the database "TEST" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally.
It's just warning you that the DB is in full recovery and hence (since full recovery means you're worried about data loss) restoring may lose transactions. If you don't care either switch the DB to simple recovery or do the restore WITH REPLACE.
You can check this link for further details about Tail-Log Backups http://msdn.microsoft.com/en-us/library/ms179314.aspx. To avoid this message and you don't need a complex restore solution, try this free tool unspammed.