Sort Manager Errors

This section contains error messages for the Adaptive Server Sort Manager.




Error 1501

Severity

20

Message text

Sort failure

Explanation

This error occurs during index creation when Adaptive Server fails to complete a sort operation. There are a number of different states for this error, each indicating a different reason for the failure:

State

Meaning

2

When creating a high level index structure, Adaptive Server is unable to build a parent node in the ancestor list.

3

When creating a high level index structure, Adaptive Server is unable to build a parent node from the root of the tree.

4

When creating a high level index structure, Adaptive Server is unable to build a parent node from the new root of the ancestor tree.

6

The sever is adding the results of an internal sort of a special leaflet node to an external merge in progress, and a single internal merge step has a merge order greater than 8.

7

The server is adding the results of an internal leaf merge node and the previous merge step caused the merge order to be greater than 8.

8

Adaptive Server is starting a non-sort of already sorted data to create a clustered index, and it cannot find a page to an index that was supposed to have been built for the sorted data.

9

The server is unable to allocate and initialize space for managing the sort's buffers.

10

The server is building indexes and the length of a row in an overflow page is either zero or greater than the size of a page.

When this error occurs, no index is created.

The configuration parameter number of sort buffers controls how Adaptive Server uses memory during sorting. number of sort buffers controls the sort buffer size; its default value is 500. Changing the value of number of sort buffers can cause Error 1501.

Error 1501 can also be caused by an Adaptive Server problem.

Action

Take the following steps:

  1. Determine the current value of number of sort buffers:

    1> sp_configure "number of sort buffers"
    2> go
    

  2. Change the value, perhaps back to the default value of 500 (recommended except when creating indexes in parallel):

    1> sp_configure "number of sort buffers", new_value
    2> go
    

Additional information

Refer to “create index” in the Reference Manual for information about creating indexes.

Refer to “Setting Configuration Parameters” in the System Administration Guide for information about configuration parameters.

Versions in which this error is raised

All versions




Error 1505

Severity

14

Message text

Create unique index aborted on duplicate key. Primary key is '%S_KEY'. 

Explanation

This error occurs when you try to create a unique index on a column or columns containing at least two rows with the same index value. Each time a unique index is created, Adaptive Server checks for duplicate index values (if data already exists), and displays this message if it finds any.

When this error occurs, no index is created.

A command of the following type generates a 1505 error if there are duplicate values on col1, col2, and col3:

create unique index index_name 
on table_name(col1, col2, col3)

Action

Decide whether you want to allow or prevent duplicate keys in the table where the index will be created. Use one of the following procedures:

If you choose to delete duplicate keys, use the following procedure. For a brief period of time some rows from the table exist only in a temporary table. If a power failure or other interruption occurs, you could lose the temporary table and the rows in it. Therefore, before you begin this procedure, make a backup copy of the table or modify the procedure to use a table you create for this purpose instead of a temporary table.

  1. Find the rows that caused the error:

    1> select * from table_name 
    2> group by col1, col2, col3 having count(*) > 1 
    3> go
    

    The query result contains all the rows causing the 1505 error.

  2. Put one instance of each distinct row from step 1 into a temporary table:

    1> select distinct * into #temp_table_name
    2> from table_name 
    3> group by col1, col2, col3 having count(*) > 1
    4> go
    

  3. Some of the rows may contain identical values in the column or columns to be indexed and different values in other columns. Use the query below to find these rows:

    1> select * from #temp_table_name 
    2> group by col1, col2, col3 having count(*) > 1 
    3> go
    

    Examine the individual rows to decide which rows should be deleted. Delete these rows from the temporary table now. The rows you delete in this step will be deleted from the original table in step 4.

  4. Delete all the rows which caused the 1505 error from the original table:

    1> delete table_name from #temp_table_name 
    2> where table_name.col1 = #temp_table_name.col1 
    3> and table_name.col2 = #temp_table_name.col2 
    4> and table_name.col3 = #temp_table_name.col3 
    5> go
    

  5. Each row in the temporary table should have unique values for the columns in question. Add these rows back into the original table:

    1> insert into table_name 
    2> select * from #temp_table_name 
    3> go
    

  6. Now you can create the unique index on the table.

Additional information

Refer to “create index” in the Reference Manual for information about indexes.

Versions in which this error is raised

All versions




Error 1508

Severity

14

Message text

Create index aborted on duplicate rows. Primary key is 'S_KEY'.

Explanation

This error occurs when you try to create a clustered index on a table that contains duplicate rows.

Action

Decide whether you want to allow or prevent duplicate rows in the table where the clustered index will be created. Use one of the following procedures.


Allow Duplicate Rows

Create the index with the allow_dup_row option:

1> create clustered index index_name on table_name 
2> with allow_dup_row
3> go

Subsequent update and insert commands can create duplicate rows after the allow_dup_row option is set.


Prevent Duplicate Rows

Create the index with the ignore_dup_row option:

1> create clustered index index_name on table_name 
2> with ignore_dup_row
3> go

Existing duplicate rows will be deleted from the table as the index is created. Subsequent attempts to enter a duplicate row with insert or update are ignored and the insert or update is cancelled with an informational message. If the insert or update is part of a larger transaction, the rest of the transaction will continue as usual.

Noteignore_dup_row and allow_dup_row are mutually exclusive. Using them together in the same create index statement causes Error 1916 .

Versions in which this error is raised

All versions




Error 1509

Severity

20

Message text

Row compare failure

Explanation

This error occurs when Adaptive Server compares two rows during a sort and the compare fails because a row was being compared against itself.

Error 1509 can occur during normal processing or when you try to create an index on a table and the operation fails because of data corruption or an Adaptive Server problem.

This is a serious error as it indicates possible corruption.

Action

  1. Run dbcc checktable and dbcc tablealloc on the table being accessed at the time of the error to check for corruption.

  2. If there is no corruption, call Sybase Technical Support.

  3. If there is corruption, refer to the writeups in this manual for other error messages that appear. Run dbcc checktable and dbcc tablealloc again to determine whether the corruption has been cleared.

  4. If corruption still exists after eliminating all error messages you can resolve, copy your data out and back in using the procedure in “How to Rescue Data from a Corrupted Table” or restore your database from clean backups using the procedure below.

    WARNING! Some data might be lost on this page if you recover your table using bcp or select into (that is, the corrupted row and rows following it might be truncated and contain the wrong keys). Compare the two tables (old and new) row by row (by joining them on a primary key, for example) to determine which rows are different (corrupted).

If you choose to restore your database from clean backups, do the following:

  1. Drop the database. If the drop fails, follow the instructions in “How to Drop a Database When drop database Fails” in the Encyclopedia of Tasks chapter.

  2. Create a database for load. Make sure the database you create has sizes as least as large as those in sysusages for the original database (and that all other sysusages values match the original values). For more information about creating a database for load, refer to “create database” in the Reference Manual.

  3. Load the database from backup. Refer to “load database” in the Reference Manual.

  4. Run the online database command to make the database available for use.

Additional information

If you need to call Sybase Technical Support, have the following documentation ready:

Versions in which this error is raised

All versions




Error 1510

Severity

17

Message text

Sort failed: Out of space in database '%.*s'

Explanation

Adaptive Server uses a clustered index to sort rows so that their physical order is the same as their logical (indexed) order. When creating a clustered index, Adaptive Server needs a considerable amount of space, 120 to 150  percent of the size of the table, because it needs to sort the data in the table first and then create the clustered index on the sorted data. This space should be available in the database or on the segment where you want to create your index.

Error 1510 occurs when you try to create an index and one of the following is true:

Unfortunately, there is no straightforward way to identify which problem caused the error.

Action

Select the appropriate action from the sections below.


Not Enough Space in the Database

Use either of the following two strategies to correct this error:


No More Locks Available

If the 1510 error occurs because Adaptive Server has no more locks available, use sp_configure to increase the number of locks:

1> sp_configure "number of locks", new_value
2> go

Shut down and restart Adaptive Server to initialize the new configuration parameter value.

Refer to the Performance and Tuning Guide and “Setting Configuration Parameters” and “Configuring Memory” in the System Administration Guide for information about configuration parameters and about how Adaptive Server memory is allocated.

Additional information

Refer to “create index” in the Reference Manual.

Versions in which this error is raised

All versions




Error 1514

Severity

21

Message text

Page allocated to sort found to be busy. Page number %ld.  %S_BUF.

Explanation

During index creation, Adaptive Server allocates and uncaches pages to sort the table's rows. The sort routine double checks whether a page allocated for the sort is in the data cache. If it is in the cache, the page cannot be used, the sort operation fails and Error 1514 is raised.

Failure to sort means that the index creation fails; consequently 4313 errors often accompany Error 1514.

Action

If Error 1514 is raised in an isolated case during index creation on a specific table, run dbcc checktable on the table. If errors are reported, try to fix them using the sections in this manual that describe those errors. Next use one of these options to recover from the 1514 problem:

If the problem persists, or is not isolated to one table, contact Sybase Technical Support for assistance.

Versions in which this error is raised

All versions




Error 1530

Severity

16

Message text

Create index with sorted_data was aborted because of row out of order. Primary key of first out of order row is '%S_KEY'

Explanation

The sorted_data option speeds creation of an index when the data in the table is already in sorted order. The speed increase becomes significant on tables larger than 1GB.

Error 1530 occurs when you try to create an index with the sorted_data option on a column or columns containing data that is not in sorted order.

When this error occurs, no index is created.

NoteThe sorted_data option speeds index creation only for clustered indexes or unique nonclustered indexes. Creating a nonunique, nonclustered index with the sorted_data option may succeed, but there is no improvement in performance.

Action

To create an index after getting a 1530 error, do one of the following:

Additional information

Refer to “create index” in the Reference Manual for information about indexes.

Versions in which this error is raised

All versions




Error 1531

Severity

16

Message text

The sorted_data option cannot be used for a nonclustered index if the keys are not unique within the table. Create index was aborted because of duplicate keys. Primary key is '%S_KEY'.

Explanation

This error occurs when you try to create a nonunique, nonclustered index with the sorted_data option on a column or columns containing rows with the same index value. If this situation exists, a statement of the following type will fail:

1> create index index_name
2> on table_name(col1, col2, col3)
3> with_sorted_data
4> go

When Error 1531 occurs, no index is created.

Action

To avoid the 1531 error, do one of the following:


Delete Rows With Duplicate Index Values

If you decide to delete rows with duplicate index values, use the following procedure.

NoteFor a brief period of time, some rows from the table will exist only in a temporary table, and if a power failure or other interruption occurs, you could lose the temporary table and the rows in it. To protect yourself against data loss, you can make a backup copy of the table before you begin the procedure. Alternatively, you can modify the procedure to use a specific table instead of a temporary table.

  1. Find the rows that caused the 1531 error:

    1> select * from table_name
    2> group by col1, col2, col3
    3> having count (*) > 1 
    4> go
    

  2. Put one instance of each distinct row from step 1 into a temporary table:

    1> select distinct * into #temp_table_name 
    2> from table_name 
    3> group by col1, col2, col3 having count(*) > 1 
    4> go
    

  3. Some of the rows may contain identical values in the column or columns to be indexed and different values in other columns. Use the following query to find these rows:

    1> select * from #temp_table_name 
    2> group by col1, col2, col3 having count(*) > 1 
    3> go
    

  4. Examine the individual rows to decide which rows should be deleted. Delete these rows from the temporary table now. The rows you delete in this step will be deleted from the original table in step 5.

  5. Delete all the rows which caused the 1531 error from the original table:

    1> delete table_name from #temp_table_name 
    2> where table_name.col1 = #temp_table_name.col1 
    3> and table_name.col2 = #temp_table_name.col2 
    4> and table_name.col3 = #temp_table_name.col3 
    5> go
    

  6. Now each row in the temporary table should have unique values for the columns in question. Add these rows back into the original table:

    1> insert into table_name 
    2> select * from #temp_table_name 
    3> go
    

  7. Create the index with the sorted_data option.

Additional information

Refer to “create index” in the Reference Manual for information about indexes.

Versions in which this error is raised

All versions