USE[Master]
-- select spid from master..SysProcesses WHERE DB_NAME(DBId)='telus'
GO
DECLARE @KillCommandSQL VARCHAR(max)
SELECT @KillCommandSQL = COALESCE(@KillCommandSQL,'') + ' KILL '+convert(VARCHAR(10),spid)+ ';'
FROM
	master..SysProcesses
	WHERE DB_NAME(DBId)='telus' or DB_NAME(DBId)='telus_procesos' or DB_NAME(DBId)='bancos' or DB_NAME(DBId)='telus_auditoria'  or DB_NAME(DBId)='db_olympo_web'

PRINT @KillCommandSQL
EXEC (@KillCommandSQL)

print 'Fecha Hora Inicio'
print getdate()


RESTORE DATABASE [db_olympo_web] FROM  DISK = N'C:\BaseMantaGIS\db_olympo_web.bak' WITH  FILE = 1,  NOUNLOAD, REPLACE, STATS = 10
GO
/*
RESTORE DATABASE [telus_procesos] FROM  DISK = N'C:\BaseMantaGIS\telus_procesos.bak' WITH  FILE = 1,  NOUNLOAD, REPLACE, STATS = 10
GO

RESTORE DATABASE [bancos] FROM  DISK = N'C:\BaseMantaGIS\bancos.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO
RESTORE DATABASE [telus_auditoria] FROM  DISK = N'C:\BaseMantaGIS\telus_auditoria.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO
*/
RESTORE DATABASE [telus] FROM  DISK = N'C:\BaseMantaGIS\telus.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO

--RESTORE DATABASE [registros_ciudadanos] FROM  DISK = N'C:\BaseMantaGIS\registros_ciudadanos.bak' WITH  FILE = 1,  NOUNLOAD, REPLACE, STATS = 10
--GO

print 'Fecha Hora Fin'
print getdate()


/*

USE tempdb;
EXEC sp_spaceused;

DBCC OPENTRAN('tempdb');

USE tempdb;
DBCC SHRINKFILE(templog, 1);
*/