powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / Create unique index aborted on duplicate key в sysstatistics.
2 сообщений из 2, страница 1 из 1
Create unique index aborted on duplicate key в sysstatistics.
    #37531983
blzz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ASE 12.5.3 после log suspend в master, дальнейшего подъема с -T699 -T3608
расширения master и dump tran with nolog заимел проблему:


Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
> update all statistics dump_report

Server Message:  Number   644 , Severity   21 
Server 'SERVNAME', Line  1 :
Index row entry for data row id ( 693 ,  0 ) is missing from index page  817  of index id  2  of table 'sysstatistics' in database 'master'. Xactid is ( 26522 , 11 ). Drop and re-create the index. 
Server Message:  Number   12807 , Severity   18 
Server 'SERVNAME', Line  1 :
cannot delete a tuple in sysstatistics 

> dbcc reindex(sysstatistics)

Checking sysstatistics: Logical pagesize is  2048  bytes 
One or more indexes are corrupt.  They will be rebuilt. 
There are  71  rows in  5  pages for object 'sysstatistics'. 
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role. 
Server Message:  Number   1505 , Severity   16 
Server 'SERVNAME', Line  1 :
Create unique index aborted on duplicate key.  Primary key is '736002622, 0, 0x08, 104, 1' 

-- удалить статистику или таблицу не отрабатывает с той же  Error 644, Severity  21
> delete statistics dump_report
> drop table dump_report 
Server Message:  Number   644 , Severity   21 
Server 'SERVNAME', Line  1 :
Index row entry for data row id ( 693 ,  0 ) is missing from index page  817  of index id  2  of table 'sysstatistics' in database 'master'. Xactid is ( 26525 , 6 ). Drop and re-create the index. 
Server Message:  Number   12807 , Severity   18 
Server 'SERVNAME', Line  1 :
cannot delete a tuple in sysstatistics 
...
Рейтинг: 0 / 0
Период между сообщениями больше года.
Create unique index aborted on duplicate key в sysstatistics.
    #38743009
spirit of blzz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
под девизом "лучше поздно чем никогда"
та же самая проблема но на пользовательской базе. уже трижды ловил на пользовательских базах.
на основе этой статьи: http://froebe.net/blog/2007/12/11/duplicate-rows-in-sysusers/
по сути сводится к ручной правке type системной таблицы в sysobjects, снятии unique констрейнта, удаления дубликатов записей, и возвращении системного каталога к состоянию "как было".

ЕСЛИ НЕ ПОНИМАЕТЕ ЧТО ПРОИСХОДИТ, НЕ ПОВТОРЯЙТЕ ЭТО НА СВОИХ СЕРВЕРАХ.
МОЖЕТ НЕ СРАБОТАТЬ, РАЗВАЛИТЬ БД и т.п.
УБЕДИТЕСЬ ЧТО ЕСТЬ АКТУАЛЬНЫЙ ДАМП БД.

Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
exec sp_configure "allow updates", 1 
go

/* сохраняем себе на память, чтобы вернуть "как было"
select sysstat,type , name from sysobjects where name = "sysstatistics" 
sysstat     type name                                                                                                                                                                                                                                                            
----------- ---- ----                                                                                                                                                                                                                                                            
         97 s    sysstatistics                                                                                                                                                                                                                                                   
*/
update ..sysobjects 
set sysstat = 115, type = "U" 
where name = "sysusers" 
go 

/**REBOOT */

use DBANAME
go
/* получаем собственно дубликаты,  */

select * into tempdb..temp_sysstatistics from sysstatistics
go

select id, indid, partitionid, statid, colidarray, formatid, sequence, cnt= count(*) 
  into tempdb..temp_pkcols
  from tempdb..temp_sysstatistics
 group by id, indid, partitionid, statid, colidarray, formatid, sequence
 having count(*) > 1
go

select s.uid, s.suid
  into tempdb..temp_fixuid 
  from tempdb..temp_sysusers s, tempdb..temp_uid t
 where s.uid = t.uid
go

create index csysstatistics2 on sysstatistics(id, indid, partitionid, statid, colidarray, formatid, sequence) 
go
drop index sysstatistics.csysstatistics
go

/* удаляются не только дубликаты, но и остальные записи для этой группы статистик. мне не жалко было*/
delete sysstatistics
from sysstatistics s, tempdb..temp_pkcols t
where s.id=t.id and s.indid=t.indid and s.partitionid=t.partitionid and s.statid=t.statid and s.colidarray=t.colidarray and s.formatid=t.formatid and s.sequence=t.sequence

create unique index csysstatistics on sysstatistics(id, indid, partitionid, statid, colidarray, formatid, sequence) on "system"
go 

/* возвращаем как было */
update sysobjects set sysstat = 97, type = "s" where name = "sysstatistics" 
go 

/* REBOOT */

USE DBNAME
go 
dbcc traceon(3604)
dbcc checktable(sysstatistics)
go 
/*
The total number of empty pages (with all deleted rows) in partition 'sysstatistics_24' (partition ID 24) is 0. 
Mismatch between the 'ncfs counter' value (75) ....

зато успешно отрабатывает sp_fixindex!
*/
Exec sp_fixindex @dbname='DBNAME', @tabname='sysstatistics'

One or more indexes are corrupt.  They will be rebuilt. 
There are 994.000000 rows in 33 pages for object 'sysstatistics'. 
Non-clustered index 'csysstatistics' (ID = 2) successfully restored for object 'sysstatistics' in 'DBNAME' database. 
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role. 
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / Create unique index aborted on duplicate key в sysstatistics.
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]