Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

System.Data.SqlClient.SqlException (0x80131904): SQL Server detected a logical consistency-based I/O error: incorrect checksum

$
0
0
Hello,


I am migrating client's database to my hosted environment, the client runs SQL Server 2008 R2, and we run SQL Server 2014.

I am stuck on restoring one log file, which left below error message when I restore it:


Restoring files
  DBFile_20150401030954.trn
Error Message: System.Data.SqlClient.SqlException (0x80131904): SQL Server detec
ted a logical consistency-based I/O error: incorrect checksum (expected: 0x512cb
ec3; actual: 0x512dbec3). It occurred during a read of page (1:827731) in databa
se ID 49 at offset 0x000001942a6000 in file 'F:\MSSQL12.INSTANCE9\MSSQL\Data\Ody
sseyTSIAKL_Data.mdf'.  Additional messages in the SQL Server error log or system
 event log may provide more detail. This is a severe error condition that threat
ens database integrity and must be corrected immediately. Complete a full databa
se consistency check (DBCC CHECKDB). This error can be caused by many factors; f
or more information, see SQL Server Books Online.
RESTORE LOG is terminating abnormally.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea
n breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception
, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj
ect stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand
 cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,
TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, Run
Behavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBe
havior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 time
out, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav
ior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletio
nSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav
ior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteScalar()
   at OnBoardingTrnRestore.FileRestorer.FileIsRestored(SqlConnection connection,
 String sourceBackupFileName, String sourceDatabaseName, String destinationDatab
aseName, String databaseName, String strFileName) in c:\Dev\WiseCloud\OnBoarding
TrnRestore\OnBoardingTrnRestore\FileRestorer.cs:line 223
ClientConnectionId:6f583f98-9c23-4936-af45-0d7e9a9949ea
Finished

I have run restore filelistonly and verifyonly in both client and my box, and both worked well:

XXX_DataD:\Program Files (x86)\XXX\Data\YYY_Data.mdf

restore filelistonly:

DPRIMARY709224693763518437208064010 000000000-0000-0000-0000-00000000000000 05121NULL27944100001483950024266CC6D17-575C-41E5-BB58-3FB4D33E288C 01NULL
XXX_LogE:\Program Files (x86)\XXX\Log\YYY_Log.ldfLNULL 319857623043518437208064020 000000000-0000-0000-0000-00000000000000 05120NULL0 00000000-0000-0000-0000-00000000000001NULL

restore verifyonly:

Attempting to restore this backup may encounter storage space problems. Subsequent messages will provide details.
The path specified by "D:\Program Files (x86)\XXX\Data\YYY_Data.mdf" is not in a valid directory.
Directory lookup for the file "E:\Program Files (x86)\XXX\Log\YYY_Log.ldf" failed with the operating system error 3(The system cannot find the path specified.).
The backup set on file 1 is valid.



Dbcc checkdb also confirmed there is no error in client sql server database.

dbcc checkdb (XXX, NOINDEX) 

Results as follows:
DBCC results for 'XXX'.
Warning: NO_INDEX option of checkdb being used. Checks on non-system indexes will be skipped.
Service Broker Msg 9675, State 1: Message Types analyzed: 17.
Service Broker Msg 9676, State 1: Service Contracts analyzed: 9.
Service Broker Msg 9667, State 1: Services analyzed: 7.
Service Broker Msg 9668, State 1: Service Queues analyzed: 7.
Service Broker Msg 9669, State 1: Conversation Endpoints analyzed: 0.
Service Broker Msg 9674, State 1: Conversation Groups analyzed: 0.
Service Broker Msg 9670, State 1: Remote Service Bindings analyzed: 0.
Service Broker Msg 9605, State 1: Conversation Priorities analyzed: 0.
DBCC results for 'sys.sysrscols'.
There are 23808 rows in 350 pages for object "sys.sysrscols".
...
DBCC results for 'BMBoard'.
There are 0 rows in 0 pages for object "BMBoard".
DBCC results for 'CusOutturnHeader'.
There are 0 rows in 0 pages for object "CusOutturnHeader".
CHECKDB found 0 allocation errors and 0 consistency errors in database 'XXX'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.


We use ftp to transfer the log files from the another country to here, I confirmed the file's MD5(checksum) is same as the copy in client's environment, we have tried to upload the file a couple of times, same outcome.

The full backup is fine, I have successfully restored a series log backups prior to this file.

Has anyone seen this issue before? It is strange, all information indicates the file is good,but somehow it goes wrong.

Below are the version details:

Client: 

MICROSOFT SQL SERVER 2008 R2 (SP2) - 10.50.4000.0 (X64) 

My environment:

Microsoft SQL Server 2014 - 12.0.2480.0 (X64) 
Jan 28 2015 18:53:20 
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: )

Thanks,

Albert



sql server 2008r2 slowness issue

$
0
0

responses from the sql server are very slow and sometimes the sql does not respnose.

see attach query results, does that mean a tempdb issue?

Convert SQL2005 DB to SQL2012 DB?

$
0
0

Hi,

I have a Db which is SQL 2005. I migrated it to SQL2012 (did Full backup and Restore). Set the compatibility level to 110. However, after this a small select query which use to take just a few seconds on the 2005 Server is taking more than 25 secs on the SQL2012 instance. 2 Questions-

1.Is just a backup and restore enough or there is any other setting other than compatibility level change required.

2. Why the query is taking such a long time- its a simple select.

An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database

$
0
0

Hello

We just had this error today. We did not do ANY changes to our existing ReportServer database neither to our reports.

Our infrastructure - we have sharepoint 2010 and sql server 2008 r2 with reporting services installed. 

I confirmed the following:

-->Disk space on database server OK:

-->ReportServer database not corrupted - I restored the database to my test server and ran DBCC CheckDB.

I am now looking at the Activity Monitor and have noticed that several SPID executed by the ReportServer database are blocked by a SPID executed by the ReportServerTempDB.

Would blocking be a possible cause to this problem?

Thank you all in advance

Compression on table and on clustered index

$
0
0

Hi all,

if I had a table with a clustered index on it, is it the same to rebuild the table with compression and rebuild the clustered index with compression?

Is this

ALTER TABLE dbo.TABLE_001 REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = ROW, ONLINE=ON)

Equivalent to this?

ALTER INDEX PK_TABLE_001 ON dbo.TABLE_001 REBUILD WITH (DATA_COMPRESSION=ROW, ONLINE=ON)

----------

where PK_TABLE_001 is the clustered index of the table TABLE_001

RESTORE detected an error on page (0:0) in database as read from the backup set

$
0
0

Hello Experts-

I am facing a very bizarre situations here, I was trying to restore a database from server 1 to server 2, first I take backup manually and then copy the backup to the server 2 location and restore it easily, I do this all the time but now I am getting this error:"RESTORE detected an error on page (0:0) in database <database>as read from the backup set</database>". So I tried to verify the backup with restore verify only and I get the message the data is invalid. Here is the bizarre part, I tried to restore the same database from the backup taken by my backup job automatically and it worked and I restore verify the data and it is valid. So, anytime I took a manual backup and try to restore it I get an error, but I can restore the backup from my backup job, please advise and share your experience , thank you.

Attention All SS DBE Gurus! Time to SPRING Into Action!

$
0
0

April fools out of the way, now let's find an April genius!

The name "April" is derived from the Latin verb "aperire", meaning "to open", as it is the season when trees, flowers AND MINDS start to open! And.. I can't wait to OPEN and read this month's community contributions! (groan, tenuous link!)

Things are indeed heating up around TechNet. The Wiki has become a shining example of what the community has to offer, and talent is SPRINGING FORTH from all corners of our garden of knowledge. 

If you can find the time to enrich us with your latest revelations, or some fascinating facts, then not only will you build up a profile and name for yourself within the gaze of Microsoft's very own glitterati, but you will be adding pages to the most respected source for Microsoft knowledge base articles. This could not only boost your career, but would benefit generations to come!

So don't be an April fool. Please realise the potential of this platform, realise where we are going, and join us in growing this community, learning more about you, and opening the minds of others!

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day's work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations toTechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you've contributed)

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Feel free to ask any questions below.

More about TechNet Guru Awards

Thanks in advance!
Pete Laker


#PEJL
Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over toTechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

Have you got what it takes o become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!

data display from English language to German language

$
0
0

We have got a requirement to replicate existing data from English language into German language. Please let me know what are options available to replicate the data into another language.

Thank you.



High Write Stalls on Tempdb .mdf and .ndf

$
0
0

Hi All,

We are seeing quite slow writes to our tempdb database files.  The tempdb log file writes are under 8ms, which is good, but for whatever reason the database files are registering ~250 ms stalls.  According to people that know more than I do, these numbers are horrific.  But isn't the write speed to the .ldf far more important since it writes to the log immediately, and once it is written to the log the client gets the success response?  Or do writes to tempdb work differently?  Thanks a ton for any help!

Tony


physical_namenamenum_of_writesavg_write_stall_msnum_of_readsavg_read_stall_ms
J:\Tempdb\tempdb.mdftempdev351826240.426739354112544263983409.02316362906060149
J:\Tempdb\templog.ldftemplog23920147.6043998906360915927360.34283625730994152
J:\Tempdb\tempdev1.ndftempdev1347635243.284830353675550503932299.76155115721373550
J:\Tempdb\tempdev2.ndftempdev2351625239.841740490579452543977669.59242368628791802
J:\Tempdb\tempdev3.ndftempdev3351211240.9394096426364777839984910.52353763545738516
J:\Tempdb\tempdev4.ndftempdev4351567241.2881157787846982239910511.09006652384710790
J:\Tempdb\tempdev5.ndftempdev5350992241.8127735105073619939918812.14670280669759612
J:\Tempdb\tempdev6.ndftempdev6351507240.7618738744889859939790711.66417781039288074
J:\Tempdb\tempdev7.ndftempdev7349810242.2837883422429318739912413.20970425231256451

SELECT files.physical_name, files.name,
  stats.num_of_writes, (1.0 * stats.io_stall_write_ms / stats.num_of_writes) AS avg_write_stall_ms,
  stats.num_of_reads, (1.0 * stats.io_stall_read_ms / stats.num_of_reads) AS avg_read_stall_ms
FROM sys.dm_io_virtual_file_stats(2, NULL) as stats
INNER JOIN master.sys.master_files AS files
  ON stats.database_id = files.database_id
  AND stats.file_id = files.file_id

Transaction log full using MERGE

$
0
0

Hi everyone, I'm facing an issue using the MERGE statement in SQL 2012, some times for some reason the transaction log is full and I don't know how to break it in different batch process or do something better in order to avoid to have the transaction log be full. I'm using different process and in all of them we use MERGE with Commits.

Any advice? any recommendation or way to handle it?

Regards,

Sebastian

Change instance name

$
0
0

Hi,

I have one database CON running on server dex-mum-con. I used to connect this Database using dex-mum-con\CON through SSMS.

Now I have changed the hostname to dex-del-rex and database name to REX. But the SQL Service is still running with name SQL Server (CON) and I have to use e-dhq-rex\CON to connect. let me know how to change it?




Single Database for Multiple applications For Data warehousing Purpose

$
0
0

Hi All,

We have recently configured Transactional replication for our core prod boxes, from where we are fetching data into stagingDBRPT which is being used as part of data ware housing for reporting purpose.

Now we got requirement for second application which is also part of data ware housing, and for this tables required are same which are there in  stagingDBRPT. So for this can we use same database stagingDBRPT as source for both the applications.

number of table in stagingDBRPT-40,and these all are used by application A

number of tables required for secondary application-15(same tables present in stagingDBRPT)

So can we use the same source for both the applications, and up to my knowledge as these applications are reporting purpose so there won't be any insert or update which leads to blockings

Could please someone help me in this.

With Regards,

Ram

SQL VDI Error and Database restore failed

$
0
0

Hi,

I have a Prod database about 550GB and I want to restore on QA server (RAM   - 132GB and CPU's - 16).

I requested to my backup team to restore the same. When backup team started restore from tool (CommVault), restore failing continuously. When I start looking into event logs I found an error - SQL VDI Error and backup team also facing same error.

Finally restore not happened. Next day I suggested another server to restore same database and it's completed successfully without any issue (32GB RAM and 8CPU's).

below is the completed error description which is logged in eventvwr,

SQLVDI: Loc=CVDS::Close. Desc=Open devices!. ErrorCode=(0). Process=8116. Thread=3668. Client. Instance=. VD=Global\1dc77079-b2c4-23ea-9b25-4ae3b01260b1_SQLVDIMemoryName_0.

SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0). Process=8116. Thread=3668. Client. Instance=. VD=Global\1dc77079-b2c4-23ea-9b25-4ae3b01260b1_SQLVDIMemoryName_0.

SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=1528. Thread=1380. Server. Instance=MSSQLSERVER. VD=Global\1dc77079-b2c4-23ea-9b25-4ae3b01260b1_SQLVDIMemoryName_0.

Can anyone explain what is SQL VDI error?

Regards,

Syed Jakeer


SQL 2012 FileTable remote access through Mgmt Studio

$
0
0

I'm having trouble accessing the FileTable directory from any machine other than the local server.  Does anyone know of a detailed resource for explaining all of the permission 'areas' to allow remote access?

On the SQL 2012 server:

I can open 2012 Mgmt Studio, expand down to the FileTable, right-click and Explore the FileTable Directory.  Directory appears and contents are visible.

On remote computers:

Doing the same action as above results in: 'The File location cannot be opened.  Either access is not enabled or you do not have permissions for the same.'

I'm using the same domain account on both systems, and it is a local OS admin & Sysadmin on the SQL server and local OS admin on the remote computer.  Tried turning firewalls off on both machines.

I setup the Filestream and FileTable using the documentation at: http://msdn.microsoft.com/en-us/library/ff929144 'FileTables (SQL Server)

Any suggestions?

Cheers,

J


SQL SERVER 11.0.5058 Page locks

$
0
0

The table wbs_nxtno has 1 non-clustered index. We use this table to store key values for order numbers etc. The transaction is creating a page level and row level lock. The page level lock is preventing any other user from update a different key value record. How do we lock in row id only, so that different users can obtain and update different key value record. Below are the create table and index command. Along with our test SQL's etc.

CREATE TABLE wbs_nxtno ( wn_system_key     CHAR(10),
                         wn_key_value      INTEGER,
                         wn_usr_id         CHAR(20),
                         wn_user_date      DATE
                        );

CREATE INDEX i_wbs_nxtno ON wbs_nxtno ( wn_system_key, wn_key_value );

ALTER TABLE wbs_nxtno SET (LOCK_ESCALATION=DISABLE); 

ALTER INDEX i_wbs_nxtno ON wbs_nxtno SET (ALLOW_PAGE_LOCKS = OFF,ALLOW_ROW_LOCKS = ON);

BEGIN TRANSACTION
update wbs_nxtno
set wn_key_value = wn_key_value
where wn_system_key = 'TPSYSNXSTK'
--COMMIT TRANSACTION

Below is an SQL to show the locks on a specified table:

SELECT
    OBJECT_NAME(P.object_id) AS TableName,
    Resource_type,
    request_session_id
FROM
    sys.dm_tran_locks L
    join sys.partitions P
ON L.resource_associated_entity_id = p.hobt_id
WHERE   OBJECT_NAME(P.object_id) = 'wbs_nxtno'

Results:

TableNameResource_typerequest_session_id
wbs_nxtnoRID 64
wbs_nxtnoPAGE64


Lock request killed but still I have no access

$
0
0

Hi guys, I am running in a though situation. I was called from one of my guys, he was enable to see the tables in one of our database:

as you can see it was a lock error. I ran the sp_who2 and sp_who and the dbcc_opentran(). The error was a process suspended. I opened the Activity Monitor and killed the process. But I still facing with the error above.

Any suggestion how I can resolve the issue?

Many thanks

Shrinking tempdb file

$
0
0

Hi all,

I have SQL Server 2012 Enterprise Edition, I have the need to shrink one of the tempDB data files (I've 8 data files) Currently this data file is 25GB, SQL Server says me that I have 65% space free into the file, I've tried to issue the following statement:

USE [tempdb]
GO
DBCC SHRINKFILE (N'tempdev' , 16384)
GO

The command runs for some seconds without errors:

DbIdFileIdCurrentSizeMinimumSizeUsedPagesEstimatedPages
21331388862912012086001208600

But the size of the datafile remains he same.

SQL2005 database backup wrongly restored

$
0
0

Hi,

I'm using SQL 2005. It's been mistakenly restored to a previous backup (to about 1 month ago). Is there any chance to undo the restore process or the data are totally lost?

Thanks in advance

Windows Internal Database - Backup failing

$
0
0

Hi all,

need your help for failing backups on WID database.

We have installed RDS environment on Win 2012 R2 which also installs a RDCms WID database.
Windows Server Backups are failing on WID backups with:

"Failed to flush the commit table to disk in dbid 5 due to error 2601. Check the errorlog for more information"

According to the KBs i found this is a known problem and is fixed in higher SPs.

But how can i install a SQL Server 2012 SP on a WID?!

Thanks!!!

Is there something more efficient than EXISTS statement?

$
0
0

Hi All,

I have this query:

select
waco,
ltrim(rtrim(wammcu)) as wammcu,
wadoco,
walitm, 
wadl01,
case 
when wastrx = 0 
then null 
else 
proddta.JulianToDate(wastrx) 
end 
AS wastrx,
wauom,
cast(wasoqs / 10000 as numeric (15,4)) as wasoqs,
cast(wasocn / 10000 as numeric (15,4)) as wasocn,

--THIS IS THE PART TO OPTIMIZIE
(select
 sum(cast(glaa / 100 as numeric (15,2)))
from
 proddta.f0911
where
glkco=waco and
glco =waco and
gldct='IV' and
glsblt = 'W' and
glsbl = right(replicate('0',8) + CONVERT(varchar,CONVERT(int,wadoco)),8)  and
exists
(select * from  proddta.f4095
 where
 mlanum in (3220,3260,3270,3280) and
 mlco=glco and
 mldcto=wadcto and
 mldct=gldct and
 mlcost='A1' and
 mlobj=globj)) as A1_Account 
--END OF THE PART TO OPTIMIZE

from  
proddta.f4801
where
waco='00010' and
wadcto='WO' and
wasrst='99' and
wastrx >=  114001
and exists
(
select 

from 
proddta.f0911
where
glkco=waco and
glco =waco and
gldct='IV' and
glsblt = 'W' and
glsbl = right(replicate('0',8) + CONVERT(varchar,CONVERT(int,wadoco)),8)  and
gldgj between  114001 and  114031
)


It takes a very long time to execute, my T-SQL is almost rusted, is there a way to improve the query with new costruct T-SQL has?

Viewing all 12963 articles
Browse latest View live


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