Problem with numeric data type field in Sybase database

Source: Internet
Author: User
Tags numeric sybase sybase database

Environment: WIN2000 ADV, SYBASE12.5 Chinese version. Data processing production library, daytime work application, the evening shutdown.

Problem Description: It feels a lot slower than usual to start the server this morning and launch Sybase services.
View NT log, there is a '
The Sybase SQL Server _ Yesky service was stopped due to 13 service errors. '
Faint, last night no service on the server to shut down the service, then check the database did not find any problems.
Work, there is a process of employee response application appears: ' XX value exceeds the maximum range, please contact the Administrator '. Check the data in the corresponding table (the table has a field of numeric, set to automatically add 1, the field defined as Test1 numeric (10,0) IDENTITY,) to represent the field with a maximum value of 5028502, and it is smaller than it has the value of 28501. Delete this record with a value of 5028502, and then the maximum value is 5028503. Delete again, 5028504. No, it seems to be a problem ....

After a variety of advice, the problem has been resolved, now write the analysis of the problem and solutions, a total of reference:

This error is related to Sybase's policy for handling identity. Sybase will take out a value in memory at startup, and the identity is taken from memory, and then written back to the database when it is shut down, if the shutdown is not normal ...

Analysis Reason: The Db-server server fails or uses no wait to shut down the machine. Causes the allocation ID number block to be ' burnt ', and when the Db-server server runs again, it starts numbering the next number with the highest number of blocks previously written to the disk. Depending on how much of the assigned number is assigned to the row before the failure, the ID number can be very large.

Workaround: Add the WITH IDENTITY_GAP = number parameter on the table.
With identity_gap specifies the identity spacing for the table. This value is only replaced by the identity margin set by this table.

Executive Sp_chgattribute ' table_name ', ' identity_gap ', number
Available sp_help to view the settings of a table's Identity_gap

The value of number should not be set too low, which will degrade performance

Recommended for 50 so your data maximum data interval is 50

Results: Executive Sp_chgattribute ' table_name ', ' identity_gap ', number
Solve the problem.

Lesson: Be sure to turn off the machine properly!

In fact, this is also to help me solve, in some also express gratitude to you!
I rookie one, but I have been working hard, learning is also a process ....

The purpose of this post is to draw a message.
I hope everyone will encounter problems, even if the problem has been solved, also tidy up, posted out, for their own is a summary.
For everyone is also a learning, exchange opportunities .... Perhaps there is a better solution to the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.