SQL ERROR 5172 : PAGEAUDIT PROPERTY IS INCORRECT - sql-server

I am try to execute below query through ADO.NET i.e. ExecuteNoQuery from Windows Application:
CREATE DATABASE TESTDATABASE ON (NAME=TESTDATABASE, FILENAME='C:\Test\TEST.mdf', SIZE=4MB, FILEGROWTH=4MB) COLLATE Latin1_General_CS_AS;
In Production, most of the times it works, but rarely fails with below error and we are not able to reproduce:
ERROR: "The header for file 'C:\Test\TEST.mdf' is not a valid database
file header. The PageAudit property is incorrect"
Any insights on this issue are highly appreciated.
Checked information about 5172 from below urls here and here.
Above all talks about fixing the solution.
Is there any way we can prevent this error?
Is 5172 can be caused due to RACE Conditions?

Related

Play framework evolution script error line number

I'm using evolution scripts, via Slick, using the Play Framework to update the schema for a Microsoft SQL Server database.
This largely works great, except that when something goes wrong, I just get a terse error message, with no indication which line of the script caused the error, and—for large scripts—that makes identifying the error time-consuming and challenging.
For example, consider this error:
An evolution has not been applied properly. Please check the problem and resolve it manually before marking it as resolved. -
We got the following error: , while trying to run this SQL script:
That's it.
Is there a way to get the full error message (through a log file, a configuration setting, etc.) that includes the line number and context, etc. with the evolution failure?
It took me a while, but I finally figured this out.
I edited the conf/logback.xml file to include the following:
<logger name="play.api.db.evolutions" level="DEBUG" />
Each statement in the Ups script is then written to logs/application.log as it is executed, together with its result, including detailed error messages.

How to deal Large Dataset using Eloquent?

In my table there are more than 5.600.000 records. When I try to get records using PAGINATE(15), after a very long processing server response Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, contact#example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.". Please help, Thanks in Advance.
It's probably caused by php.ini configuration.
You can check your error logs for more info (php error logs or laravel /storage/logs).
It can be memory_limit, max_execution_time or some other setting in php.ini
Its the problem with paginate(). paginate() retrieves all the rows in a table and counts the total rows to determine the total no of pages required. Since you have 5600,000 rows in the table, it is taking a long time to retrieve the results which eventually might be reaching max_execution_time or memory_limit.
I suggest the best way is to use simplePaginate()

Possible causes for SQL Server error "Reason: Unable to determine the initial language and date format."

Today I started seeing SQL connection issues with the following details:
Description: Login failed for user 'xxxx'. Reason: Unable to determine
the initial language and date format.
Doing searches on google, bing, and here did not show any relevant information and I was wondering if anyone knows what could cause this to start happening? (There were a few of these errors but things seem to be running 'properly' since seeing the errors.)

SSIS error due to "Protection level" value "encryptsensitivewithuserkey", can a pacakge have nothing sensitive?

I have today ended up supporting a brand new (for me :)) package which threw below error.
"Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
"
I got that package has been deployed with "Protection level" value "encryptsensitivewithuserkey" so ssis engine was looking for Developers user key (Windows profile) which it did not got on production machine.
As pacakge was not design fail on this error it went ahead and ended up doing it's job perfectly.
Now I am a bit confuse, the way I understand SSIS engine on production would not have been able to able to read some sensitive information which should have stopped him doing it's job.
I am not sure what properties are Sensitive (I thinks that is decided by TASK/Component author).
Just to give idea of package I have given image below.
Is there nothing Sensitive which required User Key of devloper?
I just want to clear my concept of how this works.

SQLException Obtaining more information

Currently working with converting SQLException error messages into messages that are more useful for the end user. My largest issue has been finding the information I'm looking for.
For instance, error code 8114 is
"Error converting data type [Type1] to [Type2]"
And error code 8152 is
"String or binary data would be truncated"
Using ADO.NET in VB.NET with SQLServer, is there a simple way to figure out which columns are affected by these errors?
The problem is that the error from SQL Server does not give that information so the only way to identify which field is causing the issue is to break apart your SQL statement to run it for the separate fields individually. That sounds like a lot of work for something the developer should be testing to make sure that it does not happen to begin with. There are errors that are not the developer's fault, but the two you listed here are things the developer should be keeping from happening and should be part of the unit tests for the process.
Some of the errors I can think of that are not a developer error, are ones to do with connection errors with SQL Server or corruption errors with the database.
I actually like the fact that my user's can't always figure out what is causing the problem because it tends to force them to tell me there is a problem with my program. If they figure out how to get around an error that I should have fixed, they tend to not tell me there is a problem and sometimes it has been years before I found out there was an issue.

Resources