Database restore seems trigering offline index build - sql

I have a strange behaviour with Sql server 2008 R2 SP2.
First I restore a backup of database.
Then I launch this command
DBCC OPENTRAN
And I get this response:
Transaction information for database 'Pitming'.
Oldest active transaction:
SPID (server process ID): 34s
UID (user ID) : -1
Name : offline index build
LSN : (4082671:527:134)
Start time : Jul 17 2014 8:59:38:107AM
SID : 0x0
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
then it's impossible to delete the database I always get an error saying the database is in use.
It's also impossible to truncate the log
This behaviour is not present in SQL 2005
Any Idea ?

I can't comment until my reputation is higher so forgive me if this "answer" is off the mark. If you are restoring to SQL2008 R2 a backup that was created with an earlier version of SQL Server the problem may be with full-text indexes. If this is the case try setting your server's Full Text Upgrade Option to 1 (Reset) before the restore. Then rebuild the full-text indexes after the database is upgraded to 2008 R2.
http://msdn.microsoft.com/en-us/library/ms186858(v=sql.105).aspx
"After you restore a SQL Server 2005 or SQL Server 2000 database to SQL Server 2008 R2, the database becomes available immediately and is then automatically upgraded. If the database has full-text indexes, the upgrade process either imports, resets, or rebuilds them, depending on the setting of the upgrade_option server property."

Related

How convert SQL Server 2008 R2 database to SQL Server 2012 completely

How open my SQLServer2008R2 database in SQLServer2012. When I open the database these problems happened:
I can't edit and open tables because this error show:
Invalid prefix and suffix characters.
When I want design tables this error show:
The backend version isn't supported to design database diagram or tables.
When you detach and attach database, the compatibility level of old database is maintained. It is one of the limitations of detach and attach method.
Reference
If we attach a database having a higher version, SQL Server maintains
the database compatibility. We can change the compatibility level once
the database is online
Once you change the compatibility level to suit SQL Server 2012, you can use the new features of the SQL Server 2012.
Read more on upgrading database
ALTER DATABASE DatabaseName SET COMPATIBILITY_LEVEL = 110
GO

SQL Server 2012 - Could not find an entry for table or index with partition ID xxxxx

I noticed this morning strange behavior with a full text index which led to me finding the following issue when doing a DBCC CHECKDB('MY_DATABASE'):
Msg 602, Level 21, State 30, Line 1
Could not find an entry for table or index with partition ID 72057607797997568 in database 8. This error can occur if a stored procedure references a dropped table, or metadata is corrupted. Drop and re-create the stored procedure, or execute DBCC CHECKDB.
This issue also shows itself when trying to drop the FullTextCatalog (as I think this error is somehow linked with the FullTextIndex in some way).
I've applied the Cumulative Update 7 to SQL Sever 2012 as some posts I've read suggest this is an issue with SQL Server itself but to no avail.
The partition doesn't seem to exist either based on no rows being returned when I run the following:
SELECT *
FROM sys.partitions
WHERE partition_id = 72057607797997568
I believe this issue is preventing me from rebuilding my FullTextIndex which seems to be corrupted (search results not returning what they should). Does anyone know how to solve it?
SQL Version:
Microsoft SQL Server 2012 (SP2-CU7) (KB3072100) - 11.0.5623.0 (Intel X86)
Jul 9 2015 12:12:26
Copyright (c) Microsoft Corporation
Standard Edition on Windows NT 6.1 (Build 7601: ) (WOW64)
I couldn't find an answer to recover from this problem. We initially tried to restore from Log files to the last good backup, but it turned out that one of the log files re-introduced the problem. The eventual fix was to restore some data from the log files and the rest using RedGate Data Compare

How to create a database snapshot in SQL Server 2008 R2

I used the below command to create a database snapshot in SQL Server 2008 R2:
CREATE DATABASE "dbss" ON (
NAME = "os-file-name",
FILENAME = 'path')
AS SNAPSHOT OF "dbName";
GO
I got this error:
Database Snapshot is not supported on Standard Edition (64-bit).
Does anyone knows how can I create a database snapshot in SQL Server 2008 R2?
Database Snapshot is a feature of the Enterprise Edition and the 2008 Developer Edition.
Besides that there is only little use of Snapshots for a "common user". Most things can be done with a backup too.
Main purpose for snapshots are expensive queries on rapidly changing data.
If you got a huge database and need to execute a query for a report that takes some time there is the danger that data may change while the query / procedure fetches data for the report. In this case you need snapshots. There you can query all your data without having problems with changing data.

Truncate_only deprecated in SQL2008

The following statement
BACKUP LOG [AMS_Prod_log] WITH TRUNCATE_ONLY
works fine in SQL Server 2005 but it doesn't with 2008. It seems truncate_only is deprecated in 2008. Could you please let me know how to achieve this in 2008? What care needs to be taken like backup... etc?
You can backup log to nul device:
BACKUP LOG [databaseName]
TO DISK = 'nul:' WITH STATS = 10
This will mark transaction log as backed-up like TRUNCATE_ONLY option did.
The nul: device is like black hole - so you could not restore from such backup.
This is the list of features depreciated in SQL 2005 i.e. they will not be available in SQL 2008.
http://msdn.microsoft.com/en-us/library/ms143729%28SQL.90%29.aspx
Your alternative is provided in the link.

Problem restoring a 2005 SQL DB with 2008

I have a DB I created with SQL Server 2005 and created a backup (*.bak) now I want to restore it with 2008 but ouch, I get the following error:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Restore failed for Server 'SHIMMY-PC\SQLEXPRESS'. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The media set has 2 media families but only 1 are provided. All members must be provided. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
When you did the original backup, the 'Destination' window had two different paths listed. You selected one, assuming that the backup would use only that one path. What actually happened was that the backup striped itself onto both paths - half the backup onto each. The restore message you are getting is because the restore wants both halves of the backup, but can only find one.
I don't think it's a 2008 problem, can you install the backup back to sql 2005.
Check out this post.