Update Statistics – SQL Server

To initiate stat update on whole database.

EXEC sp_updatestats;

Update Single Table.

UPDATE STATISTICS tableName ;

This will update stats on the particular table with sample size determined by query optimizer. You can specify WITH FULLSCAN option to scan the entire table, however this will take much longer than above.

Update Single Table WITH FULLSCAN.

UPDATE STATISTICS tableName WITH FULLSCAN;

Disable SQL Server Agent Job – SQL Server

Recently we had an issue with our tape backup system, we needed to quickly disable backup jobs to tape and enable backup jobs to drive. There were multiple jobs and using SSMS gui would have taken too much effort and time. To disable or enable multiple jobs update the sysjobs table in msdb.

Get list of jobs.

SELECT * FROM msdb.dbo.sysjobs

Update sysjobs table to disable job.

UPDATE msdb.dbo.sysjobs
SET enabled = 0
WHERE 1=1
AND job_id = '87D56BD2-EC90-4A6C-A00C-30A8F81133F5'

Create alias in Linux/Unix/Aix Systems

Aliases can help in issuing complex or long commands by creating short aliases for them.

Aliases can be created for the session or persistent ones by adding them to .profile or .bashrc file depending on what flavor of Unix you are using.

Example:

alias l=’l -al’#this will create alias for list command with couple of paramter
alias alert=’cd /u02/diag/rdbms/prod/prod1/trace’ #this creates alias for alert log location for oracle