Archive for the ‘Employment’ Category

Database Size Report

Tuesday, October 4th, 2005

I needed a way to get at the information in a few of my databases to identify potential hard disk hoggers. These are files that have a large amount of space allocated, but they only take up a small fraction of it with actual data. I found a script over at the google groups for a procedure called sp_dbspaceall. It had some bugs but I quickly fixed it up. I also changed it so that I could paste the code in my query analyzer without creating a perminent stored procedure in the master database.

After I was done, I was able to paste the data into an excel document. I setup some conditional formatting with the following rules:

  1. If the total size is between 500 and 1,000 MB then set the cell to a light green background.
  2. If the total size is greater than 1,000 MB then set the cell to a dark green background.
  3. If the free space is greater than 300 MB then set the cell to a dark red background.
  4. If the free space is greater than 100 MB then set the cell to a pink background.
  5. If the percentage used is between 10 and 50% then set the cell to a pink background.
  6. If the percentage used is between 0 and 10% then set the cell to a red background.

I had a nice little report in no time that brought my attention to the databases that needed the most attention. I manage many database servers with many databases. Sometimes the simplist answer is to shrink the databases or change the recovery model.

I’ve been running into a difficult problem with some databases. It appears that the smallest file size that the database was initially setup with was very large. I can not find a way to instruct the database to take less space. The only solution that I have been able to figure out is to rebuild the database from scratch and copy the data over. This is an extream measure and time consuming. I have about 50 databases that have this problem.

For anyone who is interested, here is the handy little SQL script that I had modified from Jasper Smith’s original version. I also found another variation of the script on the Database Journal with some handy information.

1 declare @Command varchar(500)
2 declare @Database varchar(128)
3 declare @Stats table
4 (
5 [Database] sysname,
6 [TotalMB] numeric(9,2),
7 [UsedMB] numeric(9,2)
8 )
9 create table #FileStats
10 (
11 [Fileid] int,
12 [FileGroup] int,
13 [TotalExtents] int,
14 [UsedExtents] int,
15 [Name] sysname,
16 [FileName] varchar(300)
17 )
18 create table #LogSpace
19 (
20 [Database] sysname,
21 [LogSize] numeric(15,7),
22 [LogUsed] numeric(9,5),
23 [Status] int
24 )
25 declare Databases cursor local fast_forward for
26 select catalog_name
27 from information_schema.schemata
28 open Databases
29 fetch next from Databases into @Database
30 while @@fetch_status = 0
31 begin
32 set @Command = ‘use [’ + @Database + ‘] dbcc showfilestats’
33 insert #FileStats execute(@Command)
34 insert @Stats
35 select
36 @Database,
37 cast(((TotalExtents*64)/1024.00) as numeric(9,2)),
38 cast(((UsedExtents*64)/1024.00) as numeric(9,2))
39 from #FileStats
40 delete #FileStats
41 fetch next from Databases into @Database
42 end
43 close Databases
44 deallocate Databases
45 insert #LogSpace exec(‘dbcc sqlperf(logspace)’)
46 update @Stats
47 set
48 TotalMB = TotalMB + LogSize,
49 UsedMB = UsedMB + ((LogUsed/100)*LogSize)
50 from
51 @Stats s
52 inner join #LogSpace l on s.[Database] = l.[Database]
53 drop table #FileStats
54 drop table #LogSpace
55 select
56 [Database],
57 TotalMB,
58 UsedMB,
59 [TotalMB] - [UsedMB] [FreeMB],
60 [UsedMB]/[TotalMB] [Used%]
61 from
62 @Stats
63 order by
64 [Database] asc

The Rescheduled Lunch

Thursday, September 29th, 2005


A year ago, my coworker and I would have lunch together every day. It has been a long time since we last had lunch together. Lately, plans have been made only to be broken by unforeseen circumstances. Today was no different.

The lunch planned yesterday was rescheduled to today. Yesterdays plans were thwarted since the whole office was going to a Thai Restaurant. Today our plans were foiled again as it was someone’s birthday. The party was supposed to start at noon, but the guest of honor didn’t show up until a little later. It was a surprise party after all.

The party only involved a cake. After a half hour, I sneaked out. I had only a half hour before a meeting so I grabbed some lunch from the deli in our building. There really wasn’t enough time to go out on our lunch break. We shall see what tomorrow brings.

Tags: , , , , , , ,

Left Behind

Wednesday, September 28th, 2005


Yesterday, my co-worker and I agreed to have lunch today. Later in the day another coworker reminded me that I had agreed (last week?) to eat at a Thai restaurant with the rest of the office. I canceled plans with the first coworker and confirmed with the second that I would be eating at the Thai restaurant.

So today I notice it is 11:30 and I didn’t know what time everyone would leave for lunch. I go in search for her and other individuals and discover that just about everyone has gone missing. I have no idea where this Thai Restaurant is.

I sent a message to the first coworker that I initially agreed to have lunch with saying “I think they forgot me”. She came out of her office and gave me the bad news that she was already in the middle of her lunch since she had thought I was going to the restaurant.

Oh so sad.

Tags: , , , , ,

Promotional T-Shirts and Reporting

Wednesday, September 21st, 2005


Another Hat
My coworker invited me into her office today and presented me with a few t-shirts and a cap that she got from the Microsoft Professional Developer Conference 2005 (a.k.a. PDC). I still need to catch up on some PDC blogs about what went on this year.

Angel took a look at the shirts when I got home and took to the Intel 64 sports sweater. There was another shirt advertising Automated QA and one for the PDC conference itself. I love wearing these shirts around the house. I can get messy and not have to worry about ruining the shirt since it’s just a promotional item.

Today I’ve done a lot of mucking around in Crystal Reports. I dealt with exporting as Word and Excel files and emailing them as attachments. I also got the html version to print without our sites template when the end-user prints it out. As always, there were tons of formatting issues and troubleshooting with the report. I’m just glad that it isn’t like the old days where I would spend days hunting down dll’s, hot fixes, and patches on the Crystal Reports website. It’s been a few years, but I’m doing ok with them.

Tags: , , , , , , , , ,

Doing the impossible

Monday, September 12th, 2005


So last Thursday a problem presented itself at work within the last two hours that I couldn’t solve. It was a very important problem that needed to be fixed and Friday was already booked to be my day off. I couldn’t solve the problem, but I was able to stay late and duplicate it by the end of the day.

My mind had been racing at different parts of the weekend trying to hash out the answer. The task seemed impossible and I was terrified that I wouldn’t be able to solve it at all. It was very hard just to grasp what the problem actually was, let alone solve it. I was fearing the worst.

I arrived at the office today and began my daily tasks. For a time, I eagerly tried many approaches to solving this puzzle. Like stars revealing themselves slowly in the early night, I started getting little bits and pieces to start showing me the answer. Not sure if I would be able to fully solve the predicament at hand, I continued on. I felt like I might be wasting my time and should be directing my energy onto an entirely different strategy.

After all the hard work, I figured it out. It wasn’t perfect, but it was the answer I was looking for. The basis of my work ensued and finally I worked out all of the other peculiar workings that needed to be fixed along the way. The answer was complete, simple, and yet complex.

Why do these things worry me so? I always seem to be able to come up with the answer when all seems to be lost. The complexity overwhelms me, but yet I still prevail. Why am I always so quick to misjudge myself?

Tags: , , ,

My first interview

Thursday, September 1st, 2005


Ok, today wasn’t really my first interview. Today was the first day that I sat on the other end of the table. I’ve been a little worried about it for a week. Many questions are buzzing in my head. Will I make a good impression? Will I know what to ask? My wife thought that I was crazy as I got ready this morning. “Usually it’s the person being interviewed that is like this”, she would say.

I guess I’m making a big thing out of nothing. I just feel so out of place. I read over the resume a few more times and jotted down a list of categories that I wanted to cover.

I went on into one of the conference rooms and did my thing. Looked at the clothes, the stature, did the handshake … Of course, that isn’t the interview. I talked with the guy about the wide range of technical things that I wanted to find out from him.

After we had finished talking I went over to get my coworker to talk to him. She was surprised that I had completed my task so quickly. I was a little shocked. I was wondering what more that I may have done wrong. I had gathered enough information to get a feel for his technical knowledge and form an opinion.

Tags: , , ,

Telecommuting Dreams

Sunday, August 28th, 2005


One day, I would like to travel around the country in an RV and telecommute to work. The road calls to me to go and see the sites around me. A trip to niagra falls would be great. To walk near by and feel the mist comming off of the falls would be breathtaking. I’d love to go to see the grand canyon, yellowstone park, a few cival war memorials, parks, dams, and the like. There is just so much out there.

Until then, I can only dream. Of course, I try to keep my dreams within reason. You can’t have everything.



Tags: , , , ,

Sleepy Head

Thursday, August 25th, 2005


So last night, I got home and made some dinner. After I was done, I went strait to bed. I don’t remember waking up, but apparently I shut off my alarm this morning. I woke up this afternoon a little confused why it was after 12 and shocked that I didn’t make it to work.

Life has just been very tireing lately. Most of the week I have gone into work, come home, sleep, and then wake up for an hour or two. I go back to sleep and wake up in time to leave for work.

I set on my bed, convincing myself that I need to go to work. There are so many reasons why I am needed to be there. All the more reason why I was shocked when I woke up today. The many things going through my head.

I feel almost like a zombie at work. I still get work done, but I just long for the trip back home so I can go back to bed.

The really weird thing is that there is nothing to be depressed about. Maybe I forgot what I was depressed about. It is just really hard to shake off.

Tags: , , , , , , , ,

A long day at work

Thursday, August 18th, 2005



So this is what the end of a long day at work looks like. No one else is parked in the garage but me. This happends often. Fortunately we have security cameras and if I’m paranoid enough, I can ask the security officer to walk me to my car.

I usually decline to ask for an escort. After all, I’m a guy. Unless the statistics of rape predators have changed, there isn’t much that I need to worry about except a robbery or death. I prefer the robbery.

I’ve been working on a few projects at work, but there is one that I’m really trying to get the ball rolling on. I’m doing database work, business logic, and some stuff on the front end.

Many things are going on while I’m helping out two co-workers who are depending on me to get things done quickly. As soon as I get parts done, they can get there parts done. It is a lot of stuff to get done all at once. To help speed things up, I stay later so I can get more work done.

Well, it is already way past my bed time so I’m going to go ahead and take a quick nap.

Tags: , , , , , , , , , , , , ,

Renewing my identity

Wednesday, August 17th, 2005



I work with software on websites that request client certificates. The reason for this is to promote the single-sign-on ability of our software over secure connections. It works out really well too, I might add.

After I had setup a database on a demonstration laptop, I tried to test the software to verify the installation was successful. I kept getting complaints that my certificate was either invalid or expired. I went ahead and setup the software to trust the issuing authority of my certificate and I still had the same message.

Has it been a year already? Well, I paid a visit to thawte and sure enough my personal certificate had expired 3 days ago. I tried exporting some of the internal certificates I had been assigned, but I didn’t have the option to do so. Also, it was kinda late and the person who responsible for issuing internal certificates was not available.

I made a request for my certificate to be renewd. I saw the status of pending and got a little worried that I wouldn’t be able to get it tonight. After five minutes, it was available and I was happy. I installed it, exported it, and imported it to the laptop. I tested our software and it worked! Oh, the little joys of life …

Tags: , , , , , , , , ,