SQL server Assertion failed error while sending mail with Excel or PDF attachments - sql-server

I used to send mails from SQL server using the sp_send_dbmail with attachments.
But for the past 10 days the mails are not triggered. I checked the procedure and tried it without the attachments and it works. If an Excel or a PDF attachment is there, the procedure throws the below error...
Location: SpcAlloc.cpp:914
Expression: pPage->IsType (Page::TEXT_MIX_PAGE)
SPID: 89
Process ID: 2108
Msg 3624, Level 20, State 1, Procedure sp_send_dbmail, Line 449
A system assertion check has failed. Check the SQL Server error log for details. Typically,
an assertion failure is caused by a software bug or data corruption. To check for database
corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during
setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft
in the latest Service Pack or in a QFE from Technical Support.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Any Suggestions ?

you will see more details in sqlserver error log and errorlog points out to dump location as well..
Right now,here are your options
1.Try checking if you are on the latest version of sqlserver and if you are not try upgrading to latest CU or SP
2.If you get this error even after upgrading to latest CU or SP,try contacting microsoft support
IF you are latest version of sqlserver,you will have more luck as it has some extensions like SQL Server Diagnostics (Preview) .Once you are done installing this extension, you will provide below screen to upload dump
after uploading,SSMS will analyze the dumps for you and present relevant KB's like below

Related

MSSQL error: "Script level upgrade for database 'master' failed ... upgrade step 'msdb110_upgrade.sql' encountered error 200, state 7, severity 25."

All of a sudden one day (on my DEV PC) my Microsoft SQL Server 2012 instance (installed as instance name "SQL2012") would not start (all my other installed instances did). Trying to start it manually under Services failed. I don't recall making any recent changes prior to this. The cause of the failure was a mystery.
On inspecting Event Viewer, under System it showed a rather amusing error message [emphasis mine]:
The SQL Server (SQL2012) service terminated with the following service-specific error:
WARNING: You have until SQL Server (SQL2012) to logoff. If you have not logged off at this time, your session will be disconnected, and any open files or devices you have open may lose data.
checking under Application Event Log, I found these 2 error messages (preceded by a number of MSSQL$SQL2012 informational messages):
Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 200, state 7, severity 25. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
followed by:
Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
Fearing having lost my system databases (and not having a backup of them to restore - who makes backups of their system dbs anyway??) and needing to access the instance, and attached databases - I was willing to try anything. Even the possible restore of the system databases: Restoring the SQL Server Master Database Even Without a Backup - but that looked quite complex.
Fortunately, I was eventually able to start the instance (thank you to this answer: https://stackoverflow.com/a/59676743/4993856 which I trusted, because Pinal Dave also mentions that particular switch in: SQL SERVER – Script level upgrade for database ‘master’ failed because upgrade step msdb110_upgrade.sql encountered error 926, state 1, severity 25) if I ran:
net start mssqlserver$SQL2012 /T902
This pointed to some issue with the upgrade script... (Remember SQL is installed with instance name: SQL2012, hence the mssqlserver$SQL2012 used above for the named instance).
After some more searching I discovered this post: Installing service pack / cumulative update on SQL Server 2016 / 2017 breaks database engine (not exactly the same SQL version as mine) which pointed to the following possible Region Settings setting (Control Panel [when viewed by 'icons'] > All Control Panel Items > Region > Administrative > "Change system locale..."):
"Beta: Use Unicode UTF-8 for worldwide language support" in Region Settings
THAT WAS IT!!! After de-selecting that option (and possibly restarting my computer), the MSSQL Server 2012 Instance started up without any issue, and I was able to access all my previously attached databases.
I assume the pending upgrade scripts ran successfully. Thinking back about it now, it is possible that I agreed to installing a SQL Update, and never bothered to test access to the instance afterwards.
I also don't recall exactly why I chose to enable that specific setting under Region Settings, possibly due to some Linux compatibility, but it looks like it has become defaulted 'on' in recent Windows builds.
I got the same problem SQL2017 after update Windows Patch Hotfix3391(KB5001228)
after restart server MSSQL Fail to start and event viewer shown error below
Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 200, state 7, severity 25. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
Solution
Fix by remove Beta:Use Unicode UTF-8 for Worldwide lang.. in the Region Settings
Then it require restart server. After restart MSSQL can start as normal.
The problem is the msdb_110.sql update script, the script is a bit of a mess, with mixed tabs and spaces (wtf?).
It tries to run a couple of procedures that fail, on startup of sql-server. They fail when the code-page is 65001 (usually because the BETA utf-8 code page option has been selected) and so SQL server fails to start.
This appears to happen any time a SQL Server update is installed. I only experience this error with SQL Server 2017, not 2019
Why?
Don't know? The script is a mess.
Solution
Deselect the use utd-8 code page option
Restart the machine
Start sql server and let it run the script
(optional) reselect the use utd-8 code page option
Restart machine again and sql server
(optinal but recommended) uninstall windows, install a unix and run postgres

Sage 300 CRE Timberline Data ODBC Driver DELETE Error

I am trying to automate archiving of the Log files generated by sage. We generate an average of 15,000 log entries a day and the LogViewer in sage is so slow it is nearly unusable after a month. I am querying the data older than seven days and then inserting it to our SQL Server. Using the same connection string I can query data from the QLM Master Log but when I go to delete data I get an error.
With my Sage user service account:
ERROR [42000] [Simba][SimbaEngine ODBC Driver][DRM File Library]Access denied.
With my personal Sage user account. I was failing at opening second connection with this error: (Still not sure why but not directly relevent)
ERROR [08001] [Simba][SimbaEngine ODBC Driver][DRM File Library]Invalid account name.
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
Once i adjusted my code to no longer attempt a second connection open I get the same error:
ERROR [42000] [Samba][SimbaEngine ODBC Driver][DRM File Library]Access denied.
Any help would be appreciated but I am looking for.
Is this actually a permissions issue?
Is the problem with my Windows User account OR Sage user account?
What access is required to run the delete command?
After speaking with a Sage 300 CRE Certified Consultant I have been informed that data in Log Viewer is not editable via ODBC, and to remove data I have to use the Log Viewer interface. According to the consultant Sage has an open DLL that would provide the functionality but it would open other areas of the program as well and they do not give it out normally.
Though it runs somewhat counter to jrummell's comments this is what I was told; the expert has spoken the project is officially at a dead end pending the acquisition of this open DLL.
I will let the community know if any additional information pertaining to this question is uncovered.

How to debug SQL Server 2014 Managed Backup to Azure?

I'm hoping to configure and use SQL Server 2014's Managed Backup to Azure feature. I've tested a manual backup to URL T-SQL query, and it worked. But, the backups created by the managed backup to Azure feature are failing to finish.
The managed backup process leaves a bunch of 0 byte backup files on Azure storage, and they're all locked (active leases) because of the failed backup process. I'm trying to figure out what the issue is. My SQL Server 2014 edition is the Web edition, which apparently does not support compression. The SQL Server Management Studio dialog for configuring the managed backup to Azure feature does not provide any options for compression, though. So, perhaps it's trying to compress the backup file and failing? I don't know how to see what's actually being tried by SQL Server while it does its automated backup to Azure, though. Anybody have any ideas there?
I'm seeing the following errors in the event log ...
Date 10/1/2014 3:10:39 PM
Log SQL Server (Current - 10/1/2014 2:42:00 PM)
Source Backup
Message
BACKUP failed to complete the command BACKUP LOG CaseLaw. Check the backup application log for detailed messages.
Date 10/1/2014 3:12:01 PM
Log SQL Server (Current - 10/1/2014 2:42:00 PM)
Source spid71
Message
Error: 18210, Severity: 16, State: 1.
Date 10/1/2014 3:12:01 PM
Log SQL Server (Current - 10/1/2014 2:42:00 PM)
Source spid71
Message
BackupVirtualDeviceFile::DetermineFileSize: SetPosition(0,EOF) failure on backup device 'https://caselaw.blob.core.windows.net/sqldb01-mssqlserver/CaseLaw_d68e6c91feba4f7f891a66cb86fcce8d_20141001151038-05.log'. Operating system error Backup to URL received an exception from the remote endpoint. Exception Message: The remote server returned an error: (409) Conflict..
I can't read the full 409 error message, so I've got no idea what the actual 409 error is. According to MSDN, there are multiple possible 409 responses.
I have been struggling with this issue for several days. I tried a manual scheduled task that runs my T-SQL query, which works, but I can't have it automatically clean itself up after X days, using that method. Any ideas? Thanks!
This is indeed related to COMPRESSION being set on the backup command that gets called by the Managed Backup process.
Enabling debug messages pointed me to the stored procedure getting called: [msdb].[smart_admin].[sp_do_backup]. If you look inside this stored procedure you will see "COMPRESSION" hard coded into the various backup commands that it issues.
A find and replace for "COMPRESSION" to "NO_COMPRESSION" should fix your issue.
Note this only need apply to SQL 2014 Web Edition, as other versions support compression, and this shouldn't even come up.

sql server incorrect checksum error on deployment

When I try to start the Sql Server (SqlExpress) service I got the following message:
I've looked at the log file (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG) and find out the following lines:
2010-03-09 06:12:35.51 spid7s Error: 824, Severity: 24, State: 2.
2010-03-09 06:12:35.51 spid7s SQL
Server detected a logical
consistency-based I/O error: incorrect
checksum (expected: 0x3ee24b20;
actual: 0x8d0681bd). It occurred
during a read of page (1:375) in
database ID 1 at offset
0x000000002ee000 in file 'C:\Program
Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\master.mdf'.
Additional messages in the SQL Server
error log or system event log may
provide more detail. This is a severe
error condition that threatens
database integrity and must be
corrected immediately. Complete a full
database consistency check (DBCC
CHECKDB). This error can be caused by
many factors; for more information,
see SQL Server Books Online.
2010-03-09 06:12:35.51 spid7s SQL
Trace was stopped due to server
shutdown. Trace ID = '1'. This is an
informational message only; no user
action is required.
How can I solve it?
Thank you!
Sounds like your master mdf file (master database) is corrupted.
Options include:
1. Restoring from backup
2. Detach existing databases (if possible), remove, and reinstall.
You might want to look a little deeper to see why this happened. It might be a failing drive on that machine. In which case, your number one priority is going to be to fix the hardware.
Try DBCC with proper parameters (CHECKFILEGROUP). If that does not help.... try identifying whether the error is in an index (then you can recreate that).
Otherwise.... get the backups. You HAVE backups, or?? ;) (good test for those - could have been a real database, not just the mater)
As this is master...
...detach all databases, get a new master generated (if anything ails reinstall server), reattach databases.
I know this is an old question, this blog post helped me tremendously. Help this will benefit others who run into the same issue down the road.
You should read the article for detailed step-by-step process. But this is the key command.
DBCC CheckTable ('corrupted_table', REPAIR_ALLOW_DATA_LOSS)

Sql server 2005 torn page,error 424

My Dell pc failed;it was blue screen.I fixed that problem by formatting and reinstalling OS and other software that i have been using.Then I recoved my db designed using sqlserver 2005 and other files using recovery tools ;Easy Recovery 6.0.
The problem is : When I try to attach the recovered file(lpdb.mdf),It can not attached.The operation fails with the following message :
TITLE: Microsoft SQL Server Management Studio
Attach database failed for Server 'SAPC'. (Microsoft.SqlServer.Smo)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
SQL Server detected a logical consistency-based I/O error: torn page (expected signature: 0x55555555; actual signature: 0x4c093c91). It occurred during a read of page (0:0) in database ID 0 at offset 0000000000000000 in file 'F:\Recovered\lpdb_log.LDF'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. (Microsoft SQL Server, Error: 824)
Is there any who can help me?
I thank you!
Dejene.
Edit
By gbn from other closed question:
Hi mrdanny,
I tried the way you suggested me. The problem is unresolved.
Error is reported : Message One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
Is there an alternative solution that i should try? I am going to redesign the database.Please save my time!
Have you a good backup?
Given it says page (0:0), then I refer you to point 1
Use emergency mode and hope for the best. Paul Randall wrote DBCC CHECKDB...
The torn page is in the log file, so rename the log file and use the sp_attch_single_file_db procedure to attach the mdf and generate a new transaction log file.

Resources