——–restart sql
cmd /c “net stop MSSQLSERVER & sc start MSSQLSERVER”

—– Sync
TootleSyncConsole.exe 1, 56, 2, 100, 1

——–Call page aspx
Call LogEntry()

Sub LogEntry()

On Error Resume Next

Declare variables
Dim objRequest
Dim URL

Set objRequest = CreateObject(“Microsoft.XMLHTTP”)

URL = “http://www.tootleerp.com/TootleCFDLenomex/TootleCFDUIReports/Utilerias/QuerySendEmailExcelPDF.aspx?empresa=1&produccion=1”
objRequest.open “POST”, URL , false
objRequest.Send

URL = “http://www.tootleerp.com/TootleCFDLenomex/TootleCFDUIReports/Utilerias/QuerySendEmailExcelPDF.aspx?empresa=2&produccion=1”
objRequest.open “POST”, URL , false
objRequest.Send

Set objRequest = Nothing

End Sub

——–backup and zip database

@echo off
setlocal
set timehour=%time:~0,2%

REM “Respalda Base de Datos”
“C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd.exe” -S SERVER4 -t 300 -i C:\DatabaseBackup\BackUpScript.sql -o C:\DatabaseBackup\Restore.log
REM “Crea un zip en la carpeta de sincronizar”
“C:\Program Files\7-Zip\7z.exe” a “C:\Users\Administrator\Google Drive\BackupServer4%date:~-4,4%%date:~-10,2%%date:~-7,2%-%timehour: =0%%time:~3,2%.zip” C:\DatabaseBackup
REM “Eliminamos archivos comprimidos”
DEL “C:\DatabaseBackup\*.bak”
REM “Quitamos del Sync Los archivos de respaldo mayores a 7 dias”
forfiles -p “C:\Users\Administrator\Google Drive” -s -m *BackupServer4*.zip /D -7 /C “cmd /c DEL @path”

——–backup database
DECLARE @name VARCHAR(50) — database name
DECLARE @path VARCHAR(256) — path for backup files
DECLARE @fileName VARCHAR(256) — filename for backup
DECLARE @fileDate VARCHAR(30) — used for file name

SET @path = ‘C:\DatabaseBackup\’

SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) +’_’+REPLACE(CONVERT(VARCHAR(20),GETDATE(),108), ‘:’, ”)

DECLARE db_cursor CURSOR FOR

SELECT name
FROM master.dbo.sysdatabases
WHERE name  IN (‘TootleCFDEnterprise’, ‘TootleCFDAproec’, ‘TootleCFDMcKernan’, ‘TootleCFDDeplosa’, ‘TootleCFDDultam’, ‘TootleCFDRefa’, ‘TootleCFDCJRR’, ‘TootleCFDForLabs’, ‘TootleCFDIngenya’,’TootleCFDLenomex’,’TootleCFDGth’,’TootleCFDTorreAlta’,’TootleCFDODS’)
–WHERE name  IN (‘TootleCFDEnterprise’)

OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name

WHILE @@FETCH_STATUS = 0
BEGIN
SET @fileName = @path + @name + ‘_’ + @fileDate + ‘.BAK’
BACKUP DATABASE @name  TO  DISK = @fileName

FETCH NEXT FROM db_cursor INTO @name
END

CLOSE db_cursor
DEALLOCATE db_cursor

—- CANCELAR

@echo off

REM “Ejecuta Script”
“C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd.exe” -S SERVER3\MSSQLSERVER2012 -i C:\DatabaseBackup\EnergeticosCancelarFacturasSinTimbrar.sql -o C:\DatabaseBackup\RestoreE.log

 

USE TootleCFDEnergeticos
GO
BEGIN TRANSACTION
UPDATE tbFacturaEnc
SET strObservaciones1=’ESTA FACTURA FUE CANCELADA DEL SISTEMA POR QUE NO FUE TIMBRADA ANTE EL SAT (FACTURA FISCAL NO VALIDA)’,
intEstatus=9
WHERE intFacturadoCFD=0 AND intEstatus<>9 AND LEN (ISNULL(strUUID, ”))<10
AND strNombreFacturacion NOT LIKE ‘%PUBLICO%’
COMMIT TRANSACTION

 

 

 

 

 

 

 

Advertisements