Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

Filegroup Restore and error "The online restore to database 'DB' failed."

$
0
0

Hi all,

SQL Server 2012 EE

Win Server 2008 R2

I am doing some tests regarding backup and recovery. Here is what i have done so far:

 - I have created a small database

 - populated it,

 - generated a full backup,

 - Truncate a table

 - Restore (here is where i am getting into issues)

Here are the detailed steps

-- backup full

BACKUP DATABASE TESTE1 TO DISK='K:\Instances\MSSQL11.MSSQLSERVER\MSSQL\Backup\bkp_full_manual_teste1_25082014.bak';

-- backup transaction log

BACKUP LOG TESTE1 TO DISK='K:\Instances\MSSQL11.MSSQLSERVER\MSSQL\Backup\bkp_tlog_manual_teste1_25082014.bak';

-- truncate

truncate table TESTE.TAB_TESTES_03


-- restore full

USE MASTER;
RESTORE DATABASE TESTE1 FILEGROUP='FG02'
FROM DISK='K:\Instances\MSSQL11.MSSQLSERVER\MSSQL\Backup\bkp_full_manual_teste1_25082014.bak'
WITH STATS=20, REPLACE, NORECOVERY;

-- restore transaction log

RESTORE LOG TESTE1 FROM DISK='K:\Instances\MSSQL11.MSSQLSERVER\MSSQL\Backup\bkp_tlog_manual_teste1_25082014.bak'
WITH RECOVERY;

... in the "restore full" step i get the following error:

Msg 3101, Level 16, State 1, Line 1
Exclusive access could not be obtained because the database is in use.
Msg 4348, Level 16, State 1, Line 1
The online restore to database 'TESTE1' failed. It may be appropriate to perform an offline restore instead. An offline restore is initiated by using BACKUP LOG WITH NORECOVERY.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

What i've read so far is that in the EE edition, i can restore a filegroup online. as you can see, i am using the EE version:

Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
    Feb 10 2012 19:39:15
    Copyright (c) Microsoft Corporation
    Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)

What am i doing wrong?

Thanks in advance.


Viewing all articles
Browse latest Browse all 5123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>