Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore Process Problem - Help

Status
Not open for further replies.

inarobis

IS-IT--Management
Joined
Apr 3, 2006
Messages
71
Location
CH
Hello guys,

I need super help :(

I would like to restore a database and I tried everything!

use master
RESTORE DATABASE Test_prod
from disk= 'e:\MSSQL\BACKUP\TESTSANDBOXBACKUP.BAK'
WITH RECOVERY

-- Apply the first transaction log backup.
RESTORE LOG Test_prod
from disk= 'e:\MSSQL\BACKUP\TESTSANDBOXBACKUP.BAK'
WITH RECOVERY

go

and

the results:

/*-----------------------------
use master
RESTORE DATABASE Test_prod
from disk= 'e:\MSSQL\BACKUP\TESTSANDBOXBACKUP.BAK'
-----------------------------*/
Server: Msg 3101, Level 16, State 2, Line 2
Exclusive access could not be obtained because the database is in use.
Server: Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.
Server: Msg 3101, Level 16, State 2, Line 7
Exclusive access could not be obtained because the database is in use.
Server: Msg 3013, Level 16, State 1, Line 7
RESTORE LOG is terminating abnormally.

I already tried to alter table to single_user and to restore the database but nothing... please how can I do it?

I used the the master admin in order to do my modification but for this database another user is set. test_user could be that?

in the process info I have an user for Test_prod user: tester ???

Ina
 
Here's one problem:
use master
RESTORE DATABASE Test_prod
from disk= 'e:\MSSQL\BACKUP\TESTSANDBOXBACKUP.BAK'
WITH RECOVERY

Notice the last line.....you RECOVERED the database after restoring the full backup. You cannot restore any further backups once the database is recovered.

Change that last line to WITH NORECOVERY.

Another issue......if you are RESTORING, how can the database already exist? You don't restore to an existing database - unless you use the REPLACE command.

What, exactly, are the steps you are following?
-SQLBill

Posting advice: FAQ481-4875
 
Thanks guys,

I would like to restore a database of a program, that doesn't work anymore. This database is TEST_PROD in order to use my program again.
RESTORE THE DATA OF TEST_PROD
RESTORE LOG OF TEST_PROD
It is better to restore to another database and assign it to the software.

Ina
 
It is better to restore to another database and assign it to the software.
Huh?

Do you have an active database called TESTSANDBOX? If so, you can't restore it to the same instance. The .mdf and .ldf files already exist. Even if you call the database a different name, the data and log files still have the same name as an active database.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top