Monday, February 23, 2009

How to Re-Create MSDB

From time to time, I've found myself in a situation where I've needed to re-create MSDB. Unfortunately, most of the guides on how to do it give just basic overviews, leaving the unlucky admin muddling around.

Here is a real step-by-step for SQL Server 2005.

1. Shut down SQL Server.
2. CD to the SQL installation directory, such as %ProgramFiles%\Microsoft SQL Server\MSSQL.1\MSSQL\Binn and run start sqlservr.exe -c -T3608 or go into the Services applet, select the SQL Server service, and enter -c -T3608 in the parameters text area, and click Start.
3. Open SQL Management Studio.
4. Expand Database > System Databases, right-click Master and select New Query.
5. Type sp_detatch_db 'msdb' and press F5 to run.
6. Locate the MSDB files (usually msdbdata.mdf and msdblog.ldf) on your server; typically in %ProgramFiles%\Microsoft SQL Server\MSSQL.1\MSSQL\Data. Move/rename them.
7. Navigate to %ProgramFiles%\Microsoft SQL Server\MSSQL.1\MSSQL\Install and run instmdb.sql by double-clicking it.
8. Shut down SQL server service and restart it normally.

Monday, February 16, 2009

The Ever-Helpful Microsoft Office Project 2007

Microsoft Office Project 2007 is a relatively complex application. There have been a lot of improvements over the years, but one spot for which improvement is sorely needed is in problem identification. Most applications, when you have a syntax or property problem, will tell you on which line the problem occurs or will highlight the affected region.

If only.

In this example, I was working on a relatively complex Project and had made start-date type dependencies on some tasks (Task B can't be started until Task A is finished). I moved a section of tasks from one spot to another several weeks ago, and recently was attempting to update it. Unfortunately, I had set some task dependencies and could not figure out where to go (in a 500+ task project, it can get quite cumbersome). When trying to change a dependency, I was greeted with this oh-so-helpful dialog box:


I eventually found it, after reviewing my project line by line. It could have been so much easier if the conflict had just been highlighted. The program obviously knows what lines are affected, since it detected the dependency as circular.

Thursday, February 12, 2009

Creating a Windows 2003 TFTP Server

If you read my previous post on configuring Windows Server 2003 DHCP to serve PXE clients, you probably noticed option 066 for Boot Server Host Name.

What is a Boot Server, you may ask?

In simple terms, a boot server runs a TFTP (Trivial File Transfer Protocol) instance that is used to transfer small amounts of data. TFTP is unauthenticated, making it an easy choice for automating remote-boot tasks such as jumpstart and kickstart. For more general information on TFTP, check out Wikipedia.

Windows 2003 has a little-known TFTP daemon. Microsoft stopped advertising some time ago, but it still remained as part of the OS load through 2003 (it is no longer present in 2008) because of its usefulness.

Configuring the Native Windows Server 2003 TFTP Daemon
1. Copy the tftpd.exe file from %windir%\system32\dllcache to %windir%\system32.
>> copy %windir%\system32\dllcache\tftpd.exe %windir%\system32

2. Register tftpd as a service.
>> sc create tftpdsvc binPath= C:\Windows\System32\tftpd.exe DisplayName= "TFTP Server" start= demand

3. Set the Directory parameter to the location where your TFTP boot image files will be stored.
>> REG ADD HKLM\SYSTEM\CurrentControlSet\Services\tftpdsvc\Parameters /v Directory /t REG_SZ /d C:\tftpd

Here's a screen capture of the whole process:

Start the TFTP Server inside the Services MMC (or type net start tftpdsvc from the command prompt). You may get an error if the directory you specified in step 3 doesn't exist, so make sure it does. Also, if you have problems accessing files (you shouldn't, since in this configuration tftpdsvc is running as LocalSystem), you may need to grant "Everyone" or "ANONYMOUS LOGON" access to the boot file directory.

Configuring Windows 2003 DHCP for PXE Clients

Today, I was lending a hand to one of our Linux admins who was trying to get his servers Kickstarted. For the unitiated, Kickstart is the Linux equivalent to Windows RIS.

PXE stands for Pre-boot eXecution Environment. PXE clients (commonly known as "diskless workstations") rely on DHCP to tell them where to go for their boot configuration and software. Windows 2003 can handle these requests, with a little bit of work.

Supporting PXE clients requires the following options:

003 Router (potentially, if resources you need are on a different subnet)
013 Boot File Size
043 Vendor Specific Info
060 ClassID
066 Boot Server Host Name
067 Bootfile Name

So, off you go to configure it. But wait, Windows 2003 DHCP doesn't have option 060! What now?

Relax. Fortunately, there's a way to configure the DHCP service to have this option.

On your DHCP server, open up a command prompt and launch netsh.

As you can see, the commands are:

netsh dhcp>server \\test
netsh dhcp server>add optiondef 60 ClassID String 0
netsh dhcp server>set optionvalue 60 STRING PXEClient

You can actually add any of the RFC options for DHCP through this context. Microsoft ships the basic ones, but with netsh, you can customize the DHCP service.

Then, restart the DHCP service. If you have the service and management console running while you do this, you'll see "Unknown Option" when you look under server options.

Launch the DHCP Admin Conosole, and navigate to your scope (or server) options, depending on where you want to set your PXE boot options.

Right-click "Scope Options" (or "Server Options," as appropriate) and select Configure Options.

Select option 013 Boot File Size, and enter the boot file size in 512 octet blocks. For example, if your boot file is 32KB, convert it to bytes (1024*32, which is 32768), and then divide that number by 512 (32768/512). Put the result (64) in the data field.

Select option 043 Vendor Specific Info and enter the following binay value:
01 04 00 00 00 00 ff

Select option 066 Boot Server Host Name and enter the IP address of the TFTP server hosting your boot image in the data field.

Select option 067 Bootfile Name and enter the name of the boot image that you wish to use.

Ensure your devices have PXE-enabled NICs (if you're using newer servers, nearly all of them do) and boot. If you need help on setting up a TFTP Server on Windows 2003, look no further.

Sunday, February 8, 2009

Optimizing Exchange Disk Performance with Diskpart

Since a lot of folks (myself included) are still running a lot of Exchange 2003 in the enterprise, I though I would post a bit about setting the track alignment properly in various kinds of storage.

According to Microsoft, when creating disk partitions, the "Disk Management" MMC snap-in mis-aligns the partition with the underlying physical disk. On disks where there are 64 sectors per track, for example, the Disk Management MMC starts the partrition at the 64th sector instead of the 65th sector. It may not sound like a big deal, but in Exchange-land (and really any high-performance database), I/O that overlaps two tracks can degrade your performance by as much as 20%.

On Windows 2003, you use Diskpart.exe to set the starting offset for partitions. You can look in the Disk Management MMC snap-in to determine which disks you want to manipulate. Note the disk numbers on the left-hand side. You will reference these numbers inside Diskpart.

In this example, the disk that I want to manipulate is Disk 24.

Click Start > Run and type diskpart.

Diskpart is a command-line utility. Never fear, the syntax is pretty simple. You can type help for a list of commands. Commands have context sensitive help, so typing create partition ? will return a list of modifiers you can use.

In this example, I'm using a Pillar Axiom 600, and the vendor has recommended using an offset of 128. Armed with that knowledge, I will select disk 24 and perform the partition creation command.

From there, you can go back into the Disk Management MMC, assign a drive letter or mount point and format the volume. It's now ready for databases.

I'll update this post periodically with recommended offsets for various types of storage. As an info-byte, Diskpar (Windows 2003) creates partition offsets in KB while Diskpar (Windows 2000) creates them in sectors or blocks.

Storage SystemRecommended Diskpart Alignment
EMC Symmetrix DMX64
HP StorageWorks EVA64
Pillar Axiom128

Use these settings to optimize your Exchange storage. For more interesting and informative articles on disk alignment, check out these links:

Optimizing Storage for Exchange Server 2003 - (Microsoft Technet)

Why should you use Diskpar (Diskpart in W2003 SP1)? - (MSExchange Team Blog)

Disk Sector Alignment - (Christian Bolton's SQL Server Blog)

Disk Partition Alignment (Sector Alignment) for SQL Server: Part 1: Slide Deck - (Jimmy May, Aspiring Geek)

Friday, February 6, 2009

Classic Margarita

Strip away all the bells and whistles. Want a margarita you can make from scratch in a few minutes? Look no further.

Classic Margarita
1 1/2 oz silver or reposado tequila
1 oz Grand Marnier orange liqueur
3/4 oz fresh squeezed Mexican lime juice
Splash of orange juice

Shake all ingredients with ice. Strain into a salt-rimmed cocktail glass and serve with a lime wedge.

If you don't use Mexican limes, add a tsp or so of sugar.

Times Is Hard

On the way home from work the other night, I heard a very folksy/Dylan-esque song by Loudon Wainwright III called "Times Is Hard." I've dropped the lyrics here (without permission). To hear the song, head on over to NPR.

Times Is Hard

Times is hard. Times is tough.
Nothin's easy. It's all rough.
There's not much right; so much gone wrong.
All I can do is play this song.

You're watchin' the news. It all looks bad.
The worst half-hour you ever had.
What in God's name is goin' on?
All I can do is play this song.

You're losin' your job, your house and your car.
Hittin' rock bottom don't feel that far.
Nothin' good is gonna come along.
All I can do is play this song.

Folks are scared watchin' that news.
Folks feel bad. They're gettin' the blues.
My poor stomach, it ain't that strong.
All I can do is play this song.

Times is rough. Times is hard.
Take a pair of scissors to your credit card.
Circuit City just said, 'So long.'
All I can do is play this song.

Who's at fault? Who gets the blame?
Let's string up Bernie what's-his-name.
And ask Alan Greenspan to come along.
All I can do is play this song.

They want your gold, and they'll pay cash.
The only silver lining is the price of gas.
Money's short and the odds are long.
All I can do is play this song.

The factory's closed. The bank is bust.
On the money it says, 'In God We Trust.'
So pray for all your stocks and bonds.
All I can do is play this song.

Outta luck. Outta hope.
I'm wonderin' why I even cast that vote.
I took that sign offa my front lawn.
All I can do is play this song.

There's a new man down there in D.C.
They say he's gonna help you and me.
They sure know how to bang the gong.
All I can do is play this song.

Last man in D.C., he had eight years.
Now the whole damn country is in arrears.
We got two, three, four wars goin' on.
All I can do is play this song.

Times is hard. Times is rough.
I guess you folks need some cheerin' up.
Well it ain't me babe. You got that wrong.
All I can do is play this song.

You heard it here. I sang it first.
Don't feel so bad; things are gonna get worse.
Consider yourselves all strung along.
All I can do is play this song.

All I can do is ...

Tuesday, February 3, 2009

Project 2007 Dialog Box

I'm a sucker for funny dialog boxes. This one happened to me tonight while I was cutting/pasting a coule of task items around in Microsoft Project 2007:

Actual values, eh? Not made up ones?

Monday, February 2, 2009

Outlook and 0x80004005

This afternoon, while troubleshooting a user's NDR problem, I ran into a problem of my own:

Your message did not reach some or all of the intended recipients.

Subject: RE: Service Desk Ticket 00173590
Sent: 2/2/2009 4:28 PM

The following recipient(s) cannot be reached:

Lastname, Firstname on 2/2/2009 4:28 PM
This message could not be sent. Try sending the message again later, or contact your network administrator. Error is [0x80004005-00000000-00000000].

Like many admins when troubleshooting end-user problems (missing/deleted messages, screwy appointments, etc.), I grant a dedicated account service-level permissions on the problem mailbox and begin testing by creating a new profile and logging into the problem mailbox. Tonight, after the troubleshooting session was resolved, I went to log in to my own mailbox profile and all seemed well. A few minutes later, I sent a message, and immediately got the above NDR. Having done this hundreds of times, I was pretty perplexed.

Starting to troubleshoot my own mailbox like I have hundreds of others, I went to verify that there was nothing wrong with my account by hitting my back-end mailbox server.

Logged off, logged back in, and retried sending a message. Same NDR.

I've usually experienced 80004005 (in relationship to Outlook) being a security or permissions problem of sorts. I was able to track the issue down to the way I had configured the temporary I was using for troubleshooting. After entering the server name and mailbox name, you are presented with a dialog box for credentials. I entered the credentials for which I had granted service account permissions, and had inadvertantly selected the "Save Password" button.

In whatever crazy universe I'm operating in, that seemed to be somehow affecting my logons with other profiles. To rectify the situation, I went to Control Panel > Mail > E-Mail Accounts > Change E-Mail Account > More Settings > Security and selected the "Always Prompt for Logon Credentials" checkbox. OK all the way out, launch Outlook, put in my new credentials, and then try to send/receive.

Problem solved.