Print ''
Print '-------------------------------------------------------------------------'
Print ' using Database: #DB_N#'
Print ' Table         : [Sites_tbl]'
Print ' Creation Date : 22.03.2006'
Print ' Autor         : J.Feuerstein'
Print ' '
Print '-------------------------------------------------------------------------'

use [#DB_N#]


 declare @DateTimeStart datetime
 DECLARE @ExecuteSQLstr nvarchar(max)
 DECLARE @StepCurText nvarchar(max)

 print ('')
 print ('----------------------------------------------------------------------')
 Print ('DB Compress:#DB_N#')

 set @StepCurText='Step: del all Indices #DB_N#'
 set @DateTimeStart = GetDate()
 print ('......................................................................')
 Print (@StepCurText)

 --- löschen aller indices
 execute JF_DropIndicesOfTable 'Objects_tbl'
 -- execute JF_DropIndicesOfTable 'Items_tbl'
 -- execute JF_DropIndicesOfTable 'ItemsRefileResults_tbl'
 execute JF_DropIndicesOfTable 'JobComputersItemsRefileResults_tbl'
 execute JF_DropIndicesOfTable 'JobComputers_tbl'
 execute JF_DropIndicesOfTable 'JobControl_ObjectsProcessData_tbl'
 execute JF_DropIndicesOfTable 'JobControlRules_tbl'
 execute JF_DropIndicesOfTable 'JobScript_tbl'
 execute JF_DropIndicesOfTable 'Objects_Ir_Rel_tbl'
 execute JF_DropIndicesOfTable 'ProcessGroups_tbl'
 execute JF_DropIndicesOfTable 'Sites_tbl'
 execute JF_DropIndicesOfTable 'Tasks_Objects_Rel_tbl'
 execute JF_DropIndicesOfTable 'TaskScheduler_tbl'
 execute JF_DropIndicesOfTable 'zzzzzDbMaintain_tbl'
 execute JF_DropIndicesOfTable 'zzzzzDebug_tbl'
  -- Löschen aller Indices für die Tabellen der Performance Analyse
 execute JF_DropIndicesOfTable 'tblCharTypes'
 execute JF_DropIndicesOfTable 'tblComputer'
 execute JF_DropIndicesOfTable 'tblComputerDetails'
 execute JF_DropIndicesOfTable 'tblEvents'
 execute JF_DropIndicesOfTable 'tblFilter'
 execute JF_DropIndicesOfTable 'tblImports'
 execute JF_DropIndicesOfTable 'tblImportTypes'
 execute JF_DropIndicesOfTable 'tblLineStyles'
 execute JF_DropIndicesOfTable 'tblMesswerte'
 execute JF_DropIndicesOfTable 'tblMesswerteConfig'
 execute JF_DropIndicesOfTable 'tblMessungen'
 execute JF_DropIndicesOfTable 'tblPerfMess'
 execute JF_DropIndicesOfTable 'tblPingMess'
 execute JF_DropIndicesOfTable 'tblMesslinien'
 execute JF_DropIndicesOfTable 'tblUserCount'
   
 Execute JF_ShowTimeDiffToNow @StepCurText, @DateTimeStart


 set @DateTimeStart = GetDate()
 set @StepCurText='Step: DBCC SHRINKDATABASE 5% #DB_N#'
 print ('......................................................................')
 Print (@StepCurText)
 DBCC SHRINKDATABASE(N'#DB_N#', 5)
 Execute JF_ShowTimeDiffToNow @StepCurText, @DateTimeStart

ende:

GO
