Old Friends

Occasionally we run out of hard drive space on our test servers. When the C:> drive has 0 GB available, bad things happen.

So:

  1. look for old database backups I can delete
  2. look for temp files I delete
  3. look in the Users (or Documents and Settings) folder for profiles that I can delete and notice some names of people that haven’t been with the company in almost a year and hey do you remember that one time when we were out to lunch and…

Another good place to find old friends is an office-wide and company-wide distribution lists.

SC.EXE

This weekend we are doing a conversion for an existing site, migrating their data from their existing EMR into the new platform. One of the tasks I was responsible for was stopping the windows service that runs the lab interface and e-prescribe messaging.

So I created a .bat file with these two lines:

sc stop servicename
sc config servicename start= disabled

I created a scheduled task on the server to run this .bat file at 7:01pm, when the data conversion was expected to begin. The site would be closed by then and the database would have been taken offline as well. And I didn’t have to login and work on a Friday night.

I can’t wait until our new platform is off of Windows 2003 and we move forward to Windows 2008 R2. I’m eager to start using PowerShell.

run commands

The production Citrix servers are locked down with some The Citrix servers for my production environment are fairly tightly locked down with group policy and I can’t get to the Start Menu and can’t view any of the server’s local drives in Windows Explorer. I can’t pull up the Run dialog. I can’t Search. So I created a shortcut in my home folder for the Command Prompt and launch from there, but you have to know the right run commands. Here are my go to commands:

  • Computer Management: compmgmt.msc
  • Control Panel: control
  • Microsoft Paint: mspaint
  • Notepad: notepad
  • Registry Editor: regedit
  • Task Manager: taskmgr

Here’s a big list: http://mypchell.com/guides/34-guides/69-156-useful-run-commands

TSQL OBJECT_DEFINITION

I recently did a rollout in production of a new version of the EHR split over several deployments. The EHR uses a several shared databases for lookup values of CPT codes or drug names so that an update to those can be done once per server and not risk affecting patient data. Since we have all of our production databases on the same SQL cluster, and the structure of one of these tables was changing, we created a workaround. We created a copy of it, appended the version number to the name, then ran an update script on all databases to recreate all views and stored procedures that reference the shared databases to point to our new one. As they are upgraded to the new version, these views and stored procedures get recreated with the default database name.

Now that everyone is on the new version, querying the database I’ve found that not all these objects we changed got touched in the upgrade. I was using sp_helptext to display database objects to me, but it was limiting because it wasn’t searchable.

SELECT name, create_date, modify_date, type, type_desc
FROM SYS.OBJECTS
WHERE OBJECT_DEFINITION(object_id) LIKE '%ver323%' ORDER BY Name

This returned 153 records. 153 out of 158 were untouched in the upgrade. The column created_date in the query showed the date of the previous upgrade, so I’m deleting from update script the 5 objects that were updated, doing a Find Replace to delete “ver323″ from the script so these get recreated with the default database name. I’ve put this out in QA. I’ll put this in production once I’m convinced it won’t break anything.