SCRIPT BEGIN DECLARE CatalogCursor SENSITIVE CURSOR FOR CatalogStatement; DECLARE DBPath VARCHAR DEFAULT ''; DECLARE TableName VARCHAR DEFAULT ''; DECLARE CurrentTable INTEGER DEFAULT 1; PREPARE CatalogStatement FROM 'SELECT * FROM Configuration.Databases WHERE Name=?'; OPEN CatalogCursor USING CURRENT_DATABASE(); FETCH FIRST FROM CatalogCursor ('Path') INTO DBPath; EXECUTE IMMEDIATE 'CREATE STORE __RepairTextIndexes AS LOCAL PATH '+QUOTEDSTR(DBPath); BEGIN PREPARE CatalogStatement FROM 'SELECT DISTINCT(TableName) FROM Information.Indexes WHERE Type=? ORDER BY TableName'; OPEN CatalogCursor USING 'Text Index'; SET PROGRESS TO 0; SET LOG MESSAGE TO '*** Repair of text indexes in database '+CURRENT_DATABASE()+ ' started on '+CAST(CURRENT_TIMESTAMP() AS VARCHAR); FETCH FIRST FROM CatalogCursor ('TableName') INTO TableName; WHILE NOT EOF(CatalogCursor) AND NOT ABORTED() DO SET STATUS MESSAGE TO 'Repairing text indexes for table '+TableName; EXECUTE IMMEDIATE 'DELETE FILE '+QUOTEDSTR(TableName+'.EDBIdx','"')+' FROM STORE __RepairTextIndexes'; EXECUTE IMMEDIATE 'REPAIR TABLE '+QUOTEDSTR(TableName,'"'); FETCH NEXT FROM CatalogCursor ('TableName') INTO TableName; SET PROGRESS TO TRUNC((CurrentTable/ROWCOUNT(CatalogCursor))*100); SET CurrentTable=CurrentTable+1; END WHILE; FINALLY EXECUTE IMMEDIATE 'DROP STORE __RepairTextIndexes KEEP CONTENTS'; END; SET LOG MESSAGE TO '*** Repair of text indexes in database '+CURRENT_DATABASE()+ ' completed on '+CAST(CURRENT_TIMESTAMP() AS VARCHAR); END
Tags: ElevateDB, New Releases | Permanent Link |
Comments (1) | You must be logged in to comment |
GReg said... | Reply |
Backup and restore whole databases won't be enough to fix the problem?
|
This web page was last updated on Friday, May 3, 2024 at 10:28 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |