DaveHope.co.uk

Compacting all MSSQL databases

Now that my hangover has just about worn off from a rough night out, I thought i’d post something useful. Below is a quick and (very) dirty way of clearing down the log and shrinking MSSQL datbases. Something useful for people who want to keep their Windows systems/networks tidy.
-- DECLARE STUFF.
DECLARE @rowCount int
DECLARE @rowCurrent int
DECLARE @rowData table (dbID int IDENTITY (1, 1), dbName varchar(50))
DECLARE @dbName varchar(50)
SET @rowCurrent = 0
-- Populate @rowData with list of databases on server.
INSERT INTO @rowData(dbName) SELECT name FROM sysdatabases
-- Number of rows in @rowData.
SELECT @rowCount = COUNT(*) FROM @rowData
-- Itherate through rows.
WHILE @rowCurrent < @rowCount
BEGIN
SELECT @dbName = dbName FROM @rowData WHERE dbID = @rowCurrent
PRINT @dbName
BACKUP LOG @dbName WITH NO_LOG
DBCC SHRINKDATABASE (@dbName)
SET @rowCurrent = @rowCurrent + 1
END

If anyone has some suggestions, feel free to let me know.

The Technology Specialist MCTS certifications help IT professionals to obtain the knowledge of specific technologies. MCTS is the 2nd most important Microsoft’s certification. The candidates are required to pass the mcts 70-529 Microsoft .NET Framework 2.0, mcts 70-620 Windows Vista, Configuring, mcts 70-630 Microsoft Office SharePoint Server 2007,mcts 70-640 Windows Server 2008 AD and Microsoft mcts 70-642 exam.
 

TFS SP1 Problems

Had to upgrade our Team Foundation to SP1 today, part of which required “KB919156”. What fun I had. The error I was getting was the following:
The application pool identity required by Team Foundation Server (TFSWSS) for the content virtual server is not using the Team Foundation Server service account. To proceed, you must exit setup, set the application pool identity (TFSWSS) to use the Team Foundation Server service account, and then run setup again.

That translates to “DDSetStatus:The content app pool must be configured to use the TFS service account” in the MSI log file if you enable logging.

After an hour of battling with it and googling with no real results other than “reinstall” (not an option) I solved my problems by doing the following:

Ensure all Sts* and TFS* app pools run under the account you want TFS to run under (e.g. NWTRADERS.MSFT\TeamServer) and ensure the MsiProperty.INI (located in C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Microsoft Visual Studio 2005 Team Foundation Server – ENU) has the correct values for VSTF_RS_USERID and VSTF_DOMAIN. E.g.:VSTF_RS_USERID=TeamServer
VSTF_DOMAIN=NWTRADERS.MSFT

In dedicated hosting the user gets the full control over the web hosting. If you have a big organization this is the cheap web hosting for you. You can have as many domain name registration as you wish. Our web design tools are the best to build the seo related websites.

This occurred in our setup because we’d intially used local SAM accounts to run the services for TFS and later migrated to AD ones. Even if you run the TFSAdminUtil MsiProperty.INI doesn’t get updated. Neat, eh?