You are currently browsing the Blog weblog archives for March, 2008.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Feb | Apr » | |||||
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | |||||
- IIS (1)
- Open Source (1)
- Performance (4)
- Personal (3)
- Powershell (1)
- SQL (1)
- SQL Server (21)
- T-SQL (15)
- Uncategorized (6)
- Utilities (5)
- Windows OS (14)
- 14. April 2011: Deduplicating files with LogParser and SQL Server
- 25. February 2011: The final voyage of the USNS H. H. Hess
- 16. February 2011: Free SQL Server training videos
- 23. August 2010: Alert for long-running SQL datbase backups
- 7. April 2010: Learning SMO & Powershell
- 25. February 2010: SQL Generators for moving database files
- 28. January 2010: Index to Filegroup mapping
- 20. January 2010: PowerShell Script to Clean Up Old Files Based on Age
- 7. January 2010: Quick & Dirty way to identify orphan files
- 29. July 2009: Trigger Mass Enable / Disable
- April 2011
- February 2011
- August 2010
- April 2010
- February 2010
- January 2010
- July 2009
- June 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- August 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- October 2007
- September 2007
- May 2007
- April 2007
- February 2007
Archive for March 2008
Using Diskpart to Align a Windows Disk Partition
31. March 2008 by Bennett.
There is an EMC whitepaper titled Using diskpar and diskpart to align partitions on Windows Basic and Dynamic Disks. This paper describes how legacy Windows issues cause a single disk I/O to span multiple tracks. This puts an unnecessary load on the SAN and reduces performance. The fix is to align the partition. Below is a sample session using the DISKPART utility. Comments are in red.
Invoke Diskpart
C:\>diskpart
Microsoft DiskPart version 5.2.3790.3959
Copyright (C) 1999-2001 Microsoft Corporation.
On computer: MYTESTBOX
You must select the disk to act on
DISKPART> select disk 5
Disk 5 is now the selected disk.
Create a partition using the EMC-recommended alignment offset
DISKPART> create partition primary align=64
DiskPart succeeded in creating the specified partition.
Select the partition / volume that you just created
DISKPART> select volume=0
Volume 0 is the selected volume.
Assign a drive letter
DISKPART> assign letter=o
DiskPart successfully assigned the drive letter or mount point.
Exit Diskpart
DISKPART> exit
Leaving DiskPart…
C:\>
You can now use the disk management MMC to format the partition
Posted in Windows OS, Performance | Print | 6 Comments »
MD5 Hash Utilities
30. March 2008 by Bennett.
FCIV.EXE is a handy little utility to snap a MD5 hash of a single file or multiple files. Optionally it can recurse directories and produce XML output. http://support.microsoft.com/kb/841290
MD5SUM.EXE is a more commonly used utility that runs on a number of different platforms. A good Wikipedia article with links can be found here and a Win32 binary can be found here.
Posted in Utilities | Print | No Comments »
Simple SQL Server Log Filter / Review Script
28. March 2008 by Bennett.
Here’s a very basic log filtering /review script that you can run on a daily basis to review your SQL Server logs. It shows the last two days of log entries filtering out logon and backup entries.
– daily log review script
SET nocount ON
CREATE TABLE #Errors
(
LogDate DateTime,
ProcessInfo NVARCHAR(40),
ErrorText NVARCHAR(2048)
)
INSERT INTO #Errors
EXEC master..sp_readerrorlog -1
SELECT * FROM #Errors
WHERE DATEDIFF(DAY, LogDate, GETDATE())<2
AND ProcessInfo <> ‘Logon’
AND ProcessInfo <> ‘Backup’
DROP TABLE #Errors
I’m currently cooking up some VBScript to filter and e-mail log entries on a daily basis. I’ll publish that soon.
Posted in T-SQL | Print | No Comments »
Basic Database Inventory Script
4. March 2008 by admin.
CREATE TABLE #tempresults2
(
database_name NVARCHAR(128),
backup_start_date DATETIME
)
INSERT INTO #tempresults2
SELECT database_name, backup_start_date
FROM msdb.dbo.backupset AS b1
WHERE backup_start_date =
(
SELECT MAX(backup_start_date)
FROM msdb.dbo.backupset AS b2
WHERE b1.database_name = b2.database_name
AND TYPE IN (‘D’, ‘I’)
);
WITH TBL_CTE(name, Size_MB, create_date, compatibility_level, [state], recovery_model, page_verify_option) AS
(
SELECT D.name, CONVERT(DECIMAL(12,2),ROUND(SUM(f.[size])/128.000,2)) AS Size_MB, d.create_date, d.compatibility_level, d.state_desc, d.recovery_model_desc, d.page_verify_option_desc
FROM SYS.DATABASES D
INNER JOIN SYS.MASTER_FILES F
ON F.database_id = D.database_id
GROUP BY D.name, d.create_date, d.compatibility_level, d.state_desc, d.recovery_model_desc, d.page_verify_option_desc
)
SELECT name, Size_MB, create_date, compatibility_level, [state], recovery_model, page_verify_option,
tr2.backup_start_date AS last_backup, GETDATE() AS inventory_date
FROM TBL_CTE D
LEFT OUTER JOIN #tempresults2 tr2
ON D.name = tr2.database_name;
DROP TABLE #tempresults2
Posted in SQL Server | Print | No Comments »
Starting Windows Performance Logging at boot time
3. March 2008 by Bennett.
Performance logging will not start on its own at boot time. Here’s how to get around that problem.
-
Applies to: W2k3, XP
- Using the Performance MMC, create a set of counter logs.
- Use a specific name to save the settings, e.g., SQLPERF.
- At the command prompt, try starting and stopping performance logging using the logman.exe utility:
- logman start sqlperf
- logman stop sqlperf
- Set the Windows registry to automatically start performance counters at system startup
- Open the Registry Editor, regedit.exe.
- Navigate to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
- Add a string value. A good name would be logman.
- Set the value equal to logman start sqlperf (or the command in step 4.a. that successfully started performance logging).
References:
Posted in Windows OS, Performance | Print | No Comments »