The Remapping Script
/*
* This is remap_all_script.
*
*
*
*/
set nocount on
go
/*
* Fill in your database name for database_name throughout this script
*/
use database_name
go
print 'use database_name'
print 'go'
go
print 'dump transaction database_name
with truncate_only'
print 'go'
go
declare prep_remp_csr cursor for
select convert(varchar(30), id) from sysobjects
where type = 'V' or type = 'P' or type = 'R'
or type = 'D' or type = 'TR'
go
declare @pid varchar(30)
declare @cnt int
select @cnt = 0
open prep_remp_csr
fetch prep_remp_csr into @pid
while(@@sqlstatus = 0)
begin
print "dbcc remap ( %1!, database_name,
1)" , @pid
print "go"
if (@cnt < 3)
begin
select @cnt = @cnt + 1
end
else
begin
select @cnt = 0
print "dump transaction
database_name with truncate_only"
print "go"
end
fetch prep_remp_csr into @pid
end
close prep_remp_csr
deallocate cursor prep_remp_csr
go