Saturday, March 10, 2012

Compress, move and delete old .BAK files using WinRar

Here you go.


@ECHO OFF
REM -- move to the source directory --
G:
cd \MSSQL\Backup\BakFileDir


REM -- Compress the files --
FORFILES /S /M *.bak /C "cmd /c C:\PROGRA~1\WinRAR\rar m -m3 @file.rar"


REM -- copy all the files recursively with XCOPY
XCOPY *.rar G:\MSSQL\Backup\BakFiles_compressed\ /S /RC /Y


REM -- Delete the rar file in the source folder --
FORFILES /S /M *.rar /C "cmd /c del @file"


REM -- delete rar files in target dir more than 1 day old --
CD \MSSQL\Backup\BakFiles_compressed\
FORFILES /S /D -1 /M G:\MSSQL\Backup\BakFiles_compressed\*.rar /C "cmd /c del @file"


Tuesday, January 31, 2012

How to Get Back Into SQL 2005 When Locked Out

Sometimes it's just good to see it done live, as it were.

How to Recover From Being Locked Out of a SQL Server 2005 database

This is SQLShare.com, so you have to be logged in to see the video, but it's free.
---


Saturday, January 07, 2012

SQL Live Monitor on CodePlex

Here's a nice, free SQL Monitoring tool I found while poking around on CodePlex.


Saturday, December 31, 2011

Do you suck at "PowersPointless?"

Frankly, everyone who works in tech should see these slides.


You Suck At PowerPoint! by @jessedee
View more presentations from @JESSEDEE

Saturday, December 24, 2011

SQL Down Under #48 with Roger Doherty


I listen to SQL Down Under whenever I can and this one was a particularly good show. All, or most of the stuff that's new in SQL Server 2012 is covered.

Check it out.


Show GuestDateDescriptionMP3WMATranscript
48Roger Doherty21Dec11SDU Show 48 features SQL Server program manager Roger Doherty introducing SQL Server 2012.MP3WMA 

SQL Saturday Houston -- April 21rst

So I am passing this on, as requested. If you are in Houston that weekend, you should attend. I did last year and it was GREAT!.
--------------------------------------------



SQLSaturday#107is coming up on Apr 21, 2012 and we need your help to get the word out! Email or instant message your friends, post it on your blog, tweet it on Twitter - free training is coming soon for those interested in SQL Server!Seriously, let your colleagues know that SQLSaturday is coming up on Apr 21, 2012 at YES Prep Public Schools - North Central Campus, 13703 Aldine-Westfield, Houston, TX, 77039 and we still have seats left. As we get closer to the event we'll have more information on the event logistics, but for now you can just savor the wait:-)

For more information please visit SQLSaturday.com or email us at sqlsaturday107@sqlsaturday.com.
Thanks!
Team SQLSaturday

Thursday, November 17, 2011

Quick View of All Users in All Databases

Run it in Text Mode in SSMS (CTRL+T)


/**********************************************************************

OBJECT/SCRIPT NAME:        Get All Users in All DBs.sql

PURPOSE:            Get all the users not sys user for all DBs not sys DBs.

Change History:     11/17/2011 2:26 PM - gmilner: Created 

**********************************************************************/
 


EXEC sp_MSforeachdb '

Use [?];

IF DB_NAME() NOT IN (''master'',''model'',''msdb'',''tempdb'')   
select 
  cast(DB_NAME() as NVARCHAR(62)) as DatabaseName, 
  cast(name as NVARCHAR(62)) as DBUserName, 
  createdate, 
  isntgroup, isntname,  isntuser, 
  issqluser, islogin, issqlrole
from sysusers
where islogin = 1
  and name not in (''dbo'',
                    ''guest'',
                    ''INFORMATION_SCHEMA'',
                    ''sys'')
  AND DB_NAME() NOT IN (''master'',''model'',''msdb'',''tempdb'')   
ORDER BY   isntuser DESC, isntname DESC, name                  
'