You are on page 1of 2
[Ly SAP Knowledge Base Article 3108327 - Database defragmentation and reindexing improves performance Component: SBO-BC-PER (Performance), Version: 3, Released On: 17.10.2023 | Symptom Increased execution time for transactions and reports, leading to overall performance degradation in SAP Business One, version for Microsoft SQL Server | Environment SAP Business One | Cause During operation, databases of SAP Business One can become fragmented due to data insertions, updates, and deletions. Fragmentation occurs when index pages have a logical ordering, based on the key value, that does not match the physical ordering within the data file. Heavily fragmented indexes can lead to performance degradation, | Resolution To rebuild the indexes in the affected database, execute the following seript from Microsoft SQL. Server Management Studio. This process can take hours to complete in larger databases, so we recommend running it outside of office hours to minimize the impact on connected users. rp Reindex procedure. Will execute dbee dbreindex on each table in db ” DECLARE @tableName as sysname DECLARE @strExee as varchar(1000) ~ Cursor declaration DECLARE tableNameCursor CURSOR READ_ONLY FAST_FORWARD FOR Take all user table SELECT [name] FROM sysobjects WHERE xtype = 'U" OPEN tableNameCursor 1H NEXT FROM tableNameCursor INTO @tableName WHILE @@FETCH_STATUS = 0 BEGIN Create the statement SET @strExec = ‘bce dbreindex ("+ @tableName +","",0 J ~ Execute the procedure exec (@strExec) FETCH NEXT FROM tableNameCursor INTO @tableName END CLOSE tableNameCursor DEALLOCATE tableNameCursor | See Also Refer to Micrasoft SQL Server documentation for more details on this topic. | Keywords hang, freeze, slow | Attributes Key Value Other Components SBO-BC-DB-SQIL (Microsoft SQLServer) | Products Products ‘SAP Business One all versions | This document refers to SAP Note/KBA. ‘Component Title

You might also like