--Archive Database: with maximum allowed runtime and a set number of records
declare @EndDate datetime, @Recs INT, @maxrunTimeInMinutes INT
SET @maxrunTimeInMinutes = 60
SET @Records = 20000
set @EndDate = dateadd(dd,1,cast(convert(char(10),(select min(logdate) FROM KIMCONNECT.dbo.au_commontable),121) as datetime))
execute [dbo].[pOrccArchive] @maxrunTimeInMinutes = @maxrunTimeInMinutes, @Records = @Records, @EndDate = @EndDate

--Shrink Database:
EXEC pShrinkDatabase 1, 'KIMCONNECT'