Posts

Showing posts from January, 2011

SQL Server Indexes Tutorial

http://sqlserverplanet.com/indexes/sql-server-indexes-tutorial/

Installing SQL Server 2008 on a Windows Server 2008 Cluster Part 1

http://www.mssqltips.com/tip.asp?tip=1687

Automated Restore Database from Last Full Backup

In my environment, I backup to many files (for faster backups), and need to restore to a custom location. This query gets latest full backup info and restores to the path you specify. Tested on SQL 2005/2008. DECLARE @BackupFiles VARCHAR(500), @data_file_path VARCHAR(512), @log_file_path VARCHAR(512), @RestoreFileList VARCHAR(2000), @RestoreStatement VARCHAR(3000), @MoveFiles VARCHAR(2000), @DBName VARCHAR(150) DECLARE @filelist TABLE (LogicalName NVARCHAR(128) NOT NULL, PhysicalName NVARCHAR(260) NOT NULL, [Type] CHAR(1) NOT NULL, FileGroupName NVARCHAR(120) NULL, Size NUMERIC(20, 0) NOT NULL, MaxSize NUMERIC(20, 0) NOT NULL, FileID BIGINT NULL, CreateLSN NUMERIC(25,0) NULL, DropLSN NUMERIC(25,0) NULL, UniqueID UNIQUEIDENTIFIER NULL, ReadOnlyLSN NUMERIC(25,0) NULL , ReadWriteLSN NUMERIC(25,0) NULL, BackupSizeInBytes BIGINT NULL, SourceBlockSize INT NULL, FileGroupID INT NULL, LogGroupGUID UNIQUEIDENTIFIER NULL, DfferentialBaseLSN NUMERIC(25,0)NULL, DifferentialBaseGUID UNIQUEIDENTIFI...

Overview of PowerPivot features-SQL Server SSAS R2 and Excel 2010

Image
http://blogs.msdn.com/b/powerpivot/archive/2009/08/24/overview-of-gemini-features.aspx

Shrink TempDB

http://www.sqldbadiaries.com/2010/11/13/tempdb-please-allow-me-to-shrink-you/ https://sqlsunday.com/2013/08/11/shrinking-tempdb-without-restarting-sql-server/ use tempdb GO SELECT name, size FROM sys.master_files WHERE database_id = DB_ID(N’tempdb’); GO DBCC FREEPROCCACHE — clean cache DBCC DROPCLEANBUFFERS — clean buffers DBCC FREESYSTEMCACHE (‘ALL’) — clean system cache DBCC FREESESSIONCACHE — clean session cache DBCC SHRINKDATABASE(tempdb, 10); — shrink tempdb dbcc shrinkfile (‘tempdev’) — shrink default db file dbcc shrinkfile (‘tempdev2’) — shrink db file tempdev2 dbcc shrinkfile (‘tempdev3’) — shrink db file tempdev3 dbcc shrinkfile (‘tempdev4’) — shrink db file tempdev4 dbcc shrinkfile (‘templog’) — shrink log file GO — report the new file sizes SELECT name, size FROM sys.master_files WHERE database_id = DB_ID(N’tempdb’); GO sp_WhoIsActive to get to the root cause of this. It was really clear once I filtered down to the timeframe in question and sorted by the tempdb allocation c...