How to export content from Select Command?
http://stackoverflow.com/questions/4168398/how-to-export-query-result-to-csv-in-oracle-sql-developer
Technology Innovation - Blog para Programadores Esta é uma ideia que surgiu para divulgar as possíveis soluções que possam facilitar a vida aos programadores
sexta-feira, novembro 29, 2013
segunda-feira, agosto 26, 2013
SQL Server - Como evitar que um query fique registado no "Transaction Log"
Quando se executam comandos em BD a 1ª linha aqui a bold consegue evitar que o transaction log seja afetado:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT * FROM Table1
WHERE colName1 LIKE '%AA%'
ORDER BY colName2 ASC
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT * FROM Table1
WHERE colName1 LIKE '%AA%'
ORDER BY colName2 ASC
terça-feira, agosto 06, 2013
Route Table Add and Delete Commands
Para adicionar rotas de encaminhamento de trafego em servidores com várias nics deverão utilizar o seguinte comando:
==> Adicionar Rota
route -p add 10.10.17.55 mask 255.255.255.255 10.10.17.1 metric 10 if 1
==> Adicionar Rota sem definição da métrica (ordem) e sem interface (Windows escolhe a melhor):
route -p add 10.10.17.55 mask 255.255.255.255 10.10.17.1
==> Se for preciso remover
route -p delete 10.10.17.55
Nota: o -p faz a rota ser persistente em caso de reboot do servidor e deve ser colocar no comando add ou delete caso seja uma das rotas persistentes
Para testar:
C:\Windows\system32>tracert 212.18.177.55
Tracing route to 212.18.177.55 over a maximum of 30 hops
1 <1 ms <1 ms <1 ms 10.10.17.1
2 * *
Deverá estar a contatar o gatway que definiram, senão, usem route print 10.* e verifiquem se está alguma rota que o influenci primeiro na metrica.
Help da Microsoft:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/route.mspx?mfr=true
Subnet Calculator:
http://portal.monitis.com/free-tools/ip-subnet
Exemplos:
http://www.itino.net/add-and-remove-persistent-static-routes-in-microsoft-windows/
Video explicativo:
http://www.youtube.com/watch?v=uOqBollh_x4
==> Adicionar Rota
route -p add 10.10.17.55 mask 255.255.255.255 10.10.17.1 metric 10 if 1
==> Adicionar Rota sem definição da métrica (ordem) e sem interface (Windows escolhe a melhor):
route -p add 10.10.17.55 mask 255.255.255.255 10.10.17.1
==> Se for preciso remover
route -p delete 10.10.17.55
Nota: o -p faz a rota ser persistente em caso de reboot do servidor e deve ser colocar no comando add ou delete caso seja uma das rotas persistentes
Para testar:
C:\Windows\system32>tracert 212.18.177.55
Tracing route to 212.18.177.55 over a maximum of 30 hops
1 <1 ms <1 ms <1 ms 10.10.17.1
2 * *
Deverá estar a contatar o gatway que definiram, senão, usem route print 10.* e verifiquem se está alguma rota que o influenci primeiro na metrica.
Help da Microsoft:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/route.mspx?mfr=true
Subnet Calculator:
http://portal.monitis.com/free-tools/ip-subnet
Exemplos:
http://www.itino.net/add-and-remove-persistent-static-routes-in-microsoft-windows/
Video explicativo:
http://www.youtube.com/watch?v=uOqBollh_x4
quinta-feira, julho 11, 2013
How to format date with getdate() function result
How to format date with getdate() function result:
SELECT replace(convert(varchar, getdate(), 111), '/', '-') + ' 00:00:00' AS EndDate, replace(convert(varchar, getdate()-1, 111), '/', '-') + ' 00:00:00' AS StartDate
http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/
SELECT replace(convert(varchar, getdate(), 111), '/', '-') + ' 00:00:00' AS EndDate, replace(convert(varchar, getdate()-1, 111), '/', '-') + ' 00:00:00' AS StartDate
http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/
terça-feira, julho 09, 2013
SCOM Reporting - How To get Performance counters by Day instead of Hour
To get Performance counters by Day instead of Hour:
SELECT FullName, InstanceName, DateTime, AverageValue, MaxValue, MinValue
FROM OperationsManagerDW.dbo.vManagedEntity,
OperationsManagerDW.dbo.vPerformanceRule,
OperationsManagerDW.dbo.vPerformanceRuleInstance,
OperationsManagerDW.Perf.vPerfDaily
WHERE vPerfDaily.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId
AND vPerfDaily.PerformanceRuleInstanceRowId = vPerformanceRuleInstance.PerformanceRuleInstanceRowId
AND vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
AND vPerformanceRule.ObjectName = 'Processor'
AND vPerformanceRule.CounterName = '% Processor Time'
AND DateTime > '2013-06-01'
AND DateTime < '2013-07-01'
ORDER BY FullName, InstanceName, DateTime
sexta-feira, julho 05, 2013
SCOM Reporting - How to get Performance Counter
http://capacitas.wordpress.com/2012/12/05/retrieving-data-from-the-scom-database/
You can now construct a query to get back, for instance, CPU data for every server between two dates (knocked together quickly to show how it all links up, you could probably write one more elegantly):
You can now construct a query to get back, for instance, CPU data for every server between two dates (knocked together quickly to show how it all links up, you could probably write one more elegantly):
SELECT FullName, InstanceName, DateTime, AverageValue
FROM OperationsManagerDW.dbo.vManagedEntity,
OperationsManagerDW.dbo.vPerformanceRule,
OperationsManagerDW.dbo.vPerformanceRuleInstance,
OperationsManagerDW.Perf.vPerfHourly
WHERE vPerfHourly.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId
AND vPerfHourly.PerformanceRuleInstanceRowId = vPerformanceRuleInstance.PerformanceRuleInstanceRowId
AND vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
AND vPerformanceRule.ObjectName = ‘Processor’
AND vPerformanceRule.CounterName = ‘% Processor Time’
AND DateTime > ’2012-11-01′
AND DateTime < ’2012-11-08′
ORDER BY FullName, InstanceName, DateTime
FROM OperationsManagerDW.dbo.vManagedEntity,
OperationsManagerDW.dbo.vPerformanceRule,
OperationsManagerDW.dbo.vPerformanceRuleInstance,
OperationsManagerDW.Perf.vPerfHourly
WHERE vPerfHourly.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId
AND vPerfHourly.PerformanceRuleInstanceRowId = vPerformanceRuleInstance.PerformanceRuleInstanceRowId
AND vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
AND vPerformanceRule.ObjectName = ‘Processor’
AND vPerformanceRule.CounterName = ‘% Processor Time’
AND DateTime > ’2012-11-01′
AND DateTime < ’2012-11-08′
ORDER BY FullName, InstanceName, DateTime
quarta-feira, julho 03, 2013
APPFabric - A nova tecnologia de Caching
Cache Administration with Windows PowerShell (Windows Server AppFabric Caching)
Commands
http://msdn.microsoft.com/en-us/library/ff718177(v=azure.10).aspxHow to know if the caching is healthy
http://msdn.microsoft.com/en-us/library/ff921010(v=azure.10).aspx
Throttling Troubleshooting (Windows Server AppFabric Caching)
http://msdn.microsoft.com/en-us/library/ff921030(v=azure.10).aspx
segunda-feira, junho 24, 2013
How to get Username by Serial
To get the Username by Serial you show use this command:
by user
wmic useraccount get name,sid
by group
wmic usergroup get name,sid
Works fine :)
by user
wmic useraccount get name,sid
by group
wmic usergroup get name,sid
Works fine :)
quarta-feira, maio 22, 2013
segunda-feira, abril 29, 2013
Novabase em Moçambique
Ver "Lançamento Novabase Moçambique | Novabase Mozambique Launch" no YouTube
Mais um País para ser reconquistado pela excelência do nosso trabalho
domingo, abril 21, 2013
Event ID 2289 — IIS Worker Process Tracing
À uns dias num projeto que tenho, estava a analisar erros de SCOM relacionados com IIS's e tive de pesquisar e acabei por encontrar este link abaixo.
Dei grants conforme indicado e deixou de ocorrer.
Event ID 2289 — IIS Worker Process Tracing
http://technet.microsoft.com/en-us/library/cc735142(v=ws.10).aspx
Applies To: Windows Server 2008
In Internet Information Services (IIS) 7.0, worker processes can trace request activity. Of the requests that reach the worker process, you can log successful requests, failed requests, or all requests. In order to log this information, the worker process identity must have permissions to create directories and subdirectories, and to write files to the directory configured for the site.
Dei grants conforme indicado e deixou de ocorrer.
Event ID 2289 — IIS Worker Process Tracing
http://technet.microsoft.com/en-us/library/cc735142(v=ws.10).aspx
Event ID 2289 — IIS Worker Process Tracing
This topic has not yet been rated - Rate this topic
Updated: January 20, 2010Applies To: Windows Server 2008
Event Details
| Product: | Internet Information Services |
| ID: | 2289 |
| Source: | Microsoft-Windows-IIS-W3SVC-WP |
| Version: | 7.0 |
| Symbolic Name: | W3_EVENT_FAILED_TO_DELETE_FREB_FILE |
| Message: | FailedRequestTracing Module failed to delete at least one log file from the directory '%3'. The problem happened at least %1 times in the last %2 minutes. The data is the error. |
sábado, abril 20, 2013
How to use Robocopy in a controlled way
Este script permite iniciar num CMD uma cópia de ficheiros com o Robocopy, escreve logs e ainda escreve no event viewer da máquina.
@REM COPY SYSFileStore
cls
eventcreate /ID 100 /L APPLICATION /T INFORMATION /SO SYSBackupFileStore /D "SYSBackupFileStore Starting Process"
set TodayStr=%date:~6,4%-%date:~3,2%-%date:~0,2% %time:~0,2%^:%time:~3,2%^:%time:~6,2%
set TodayFile=copySYSfilestore_robocopy_status_%date:~6,4%-%date:~3,2%-%date:~0,2%.log
set ActualRobocopyFile=copySYSfilestore_robocopy.log
set PATH1=C:\DIR1
set PATH2=C:\DIR2
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| ********************************************* >> %TodayFile%
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| SYSFileStore started >> %TodayFile%
IF NOT EXIST %PATH2% (
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| This node is not the active node >> %TodayFile%
) ELSE (
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| Starting Robocopy : Must see the last robocopy file log >> %TodayFile%
Robocopy %PATH1% %PATH2% /MIR /FFT /Z /XA:H /W:1 /NFL /R:1 /LOG:%ActualRobocopyFile% & taskkill /F /IM robocopy.exe)
)
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| SYSFileStore ended >> %TodayFile%
eventcreate /ID 999 /L APPLICATION /T INFORMATION /SO SYSBackupFileStore /D "SYSBackupFileStore Ended Process"
:END
exit /b %ERRORLEVEL%
@REM COPY SYSFileStore
cls
eventcreate /ID 100 /L APPLICATION /T INFORMATION /SO SYSBackupFileStore /D "SYSBackupFileStore Starting Process"
set TodayStr=%date:~6,4%-%date:~3,2%-%date:~0,2% %time:~0,2%^:%time:~3,2%^:%time:~6,2%
set TodayFile=copySYSfilestore_robocopy_status_%date:~6,4%-%date:~3,2%-%date:~0,2%.log
set ActualRobocopyFile=copySYSfilestore_robocopy.log
set PATH1=C:\DIR1
set PATH2=C:\DIR2
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| ********************************************* >> %TodayFile%
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| SYSFileStore started >> %TodayFile%
IF NOT EXIST %PATH2% (
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| This node is not the active node >> %TodayFile%
) ELSE (
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| Starting Robocopy : Must see the last robocopy file log >> %TodayFile%
Robocopy %PATH1% %PATH2% /MIR /FFT /Z /XA:H /W:1 /NFL /R:1 /LOG:%ActualRobocopyFile% & taskkill /F /IM robocopy.exe)
)
echo %TodayStr% ^| DEBUG ^| ^| ^| ^| SYSFileStore ended >> %TodayFile%
eventcreate /ID 999 /L APPLICATION /T INFORMATION /SO SYSBackupFileStore /D "SYSBackupFileStore Ended Process"
:END
exit /b %ERRORLEVEL%
How to write in EventViewer from command line
Subscrever:
Mensagens (Atom)

