quarta-feira, 30 de janeiro de 2013

Uso do Log de Transação–Sql Server

 

Informa o percentual de uso do log de transação de todos os banco de dados.

dbcc sqlperf (logspace)

 

Database Name Log Size (MB) Log Space Used (%) Status
master 0,9921875 64,56693267822266 0
tempdb 399,9921875 60,40694046020508 0
msdb 3,9921875 37,279842376708984 0
CURSO 5999,9921875 100,00083923339844 0

4 record(s) selected [Fetch MetaData: 0/ms] [Fetch Data: 0/ms]

 

Obrigado

sexta-feira, 18 de janeiro de 2013

Tamanho do arquivo–Visual Basic 2008

 

Segue código que utilizei no SSIS para verificar o tamanho do arquivo. No meu caso precisa verificar se o arquivo gerado possuia informação, senão o mesmo deveria ser deletado.

 

Código para verificação do tamanho do arquivo:

 

' Microsoft SQL Server Integration Services Script Task

' Write scripts using Microsoft Visual Basic 2008.

' The ScriptMain is the entry point class of the script.

Imports System

Imports System.Data

Imports System.Math

Imports Microsoft.SqlServer.Dts.Runtime

Imports System.IO

<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _

<System.CLSCompliantAttribute(False)> _

Partial Public Class ScriptMain

Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

Enum ScriptResults

Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success

Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

End Enum

Public Sub Main()

Dim sReader As StreamReader

Dim strContents As String

sReader = File.OpenText(Dts.Variables("sCaminhoArquivoGerencial").Value & Dts.Variables("sNomeArquivoLote").Value)

strContents = sReader.ReadToEnd()

sReader.Close()

 

If strContents.Length <> 0 Then

    Dts.Variables("sTamanhoArquivo").Value = strContents.Length

Else

     Dts.Variables("sTamanhoArquivo").Value = 0

End If

Dts.TaskResult = ScriptResults.Success

End Sub

End Class

 

Obrigado

quinta-feira, 17 de janeiro de 2013

Como identificar o Isolation Level–Sql Server

 

Para identifcar não só o Isolation Level mas também outros comandos:

DBCC useroptions

Set Option Value
textsize 2147483640
language us_english
dateformat mdy
datefirst 7
lock_timeout -1
quoted_identifier SET
ansi_null_dflt_on SET
ansi_warnings SET
ansi_padding SET
ansi_nulls SET
concat_null_yields_null SET
isolation level read committed

Obrigado