2015-05-13 2 views
0

Я работаю над базой данных DB2. Когда я бегу просто выбрать на столе, я получаю эту ошибку:Ошибка при выполнении выбора во всех таблицах в DB2

DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016, SQLERRMC=1;My_Table, DRIVER=4.18.60 

Я посмотрел в Интернете, и некоторые говорят, что выполнение этой команды может решить эту проблему:

CALL SYSPROC.ADMIN_CMD('REORG TABLE My_Table') 

Когда я исполняю предыдущий SQL я получаю эту ошибку:

[Error Code: -2216, SQL State: 01H52] DB2 SQL Error: SQLCODE=-2216, SQLSTATE=01H52, SQLERRMC=-668, DRIVER=4.18.60 

Как я могу решить эту проблему?

Большое спасибо.

ответ

2

Я начну с конца. Ваша вторая ошибка говорит вам, что вы столкнулись с той же ошибкой при попытке запустить REORG. Если вы посмотрите на the documentation for -2216, вы увидите следующее:

SQL2216N

SQL error sqlcode occurred while reorganizing a database table or its indexes.

Explanation

An error occurred during the reorganization of a database table or its indexes.

The utility stops processing.

User response

Look at the SQLCODE (message number) in the message for more information. Make changes and resubmit the command.

Итак, давайте оглянемся на свою вторую ошибке. Если вы заметите в документации, то sqlcode выделено курсивом, что означает, что оно будет отображаться в сообщениях, содержащихся в SQLERRMC. Глядя на это, это еще один номер -668.

Если вы посмотрите на the documentation for -668, вы найдете ответ. Опять же, глядя на SQLERRMC, то код причины для ошибки 1, поэтому мы смотрим на то, чтобы сделать для кода причины 1, и мы получаем следующее:

SQL0668N

Operation not allowed for reason code reason-code on table table-name.

Explanation

Access to table table-name is restricted. The cause is based on the following reason codes

reason-code:

1

The table is in the Set Integrity Pending No Access state. The integrity of the table is not enforced and the content of the table may be invalid. An operation on a parent table or an underlying table that is not in the Set Integrity Pending No Access state may also receive this error if a dependent table is in the Set Integrity Pending No Access state.

....

User response

1

Execute the SET INTEGRITY statement with the IMMEDIATE CHECKED option on table table-name to bring the table out of the Set Integrity Pending No Access state. For a user maintained materialized query table, execute the statement with the IMMEDIATE UNCHECKED option instead of the IMMEDIATE CHECKED option.

0

ВЫЗОВА SYSPROC.ADMIN_CMD (» REORG TABLE My_Table ')

этот код Не работает для меня. Поэтому я пытаюсь получить другое решение.

SET INTEGRITY ДЛЯ table_name СРОЧНО ПРОВЕРЕНА

Смежные вопросы