Determine number of active connections to each database in SQL Server

by Xavier Comments: 0

So I am taking databases offline and I need to find out which ones have active connections to them. People usually do a

sp_who

However that brings a lot of info that I don’t need. I prefer to use this query so I see the DBs with number of connections!

SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
;

Brilliant query!

Change owner of a Microsoft SQL Server database

by Xavier Comments: 0

We had a spaghetti of database owners so I decided to get this straightened out. How to do it? Simple!

– Open New Query in SQL Server Management Studio in the database that you want to change the owner
– Run EXEC sp_changedbowner ‘domain\owner’
– Wait for Command(s) completed successfully.

As simple as that!

Finding out who is using my SQL Server 2008 database!

by Xavier Comments: 0

My last post was about taking databases offline, which if in use can be very problematic.

So before doing anything that can be interrupted if there is an open connection just run this:

CREATE TABLE #sp_who2 (SPID INT,Status VARCHAR(255),
Login VARCHAR(255),HostName VARCHAR(255),
BlkBy VARCHAR(255),DBName VARCHAR(255),
Command VARCHAR(255),CPUTime INT,
DiskIO INT,LastBatch VARCHAR(255),
ProgramName VARCHAR(255),SPID2 INT,
REQUESTID INT)
INSERT INTO #sp_who2 EXEC sp_who2
SELECT *
FROM #sp_who2
-- Add any filtering of the results here :
WHERE DBName <> 'master'
-- Add any sorting of the results here :
ORDER BY DBName ASC

DROP TABLE #sp_who2

Please note that sp_who2 is undocumented by Microsoft so it might change

Taking a database offline in SQL Server 2008 and avoid transition error message

by Xavier Comments: 0

Taking a database offline is a very simple task. Right click on it and select ‘Take offline’. However, if the database is being used at the moment the action will fail and your database may remain in limbo for a (sometimes long) while.

Msg 952, Level 16, State 1, Procedure sp_who, Line 79
Database ‘UATdb’ is in transition. Try the statement later.

Try this instead:
ALTER DATABASE UATdb SET OFFLINE WITH ROLLBACK IMMEDIATE

Why I will never buy a HP computer… and the reason they are firing 27k people

by Xavier Comments: 0

Update 07 03, what I included in their customer service survey
It is very simple:
– The machine is great and for a great price
– Your HP store is highly unusable. Spend 10 minutes in the apple store and learn how it should be done
– Customer service was great, but I am sure it costs more for you to have a human being taking calls
– Delivery time not too good, not delayed but too slow
– Sell worldwide, not only US. There is more than just US

———————-
Update 07/01/2012: I was able to buy it by talking to customer service. The laptop is really nice, especially for the price. Shipping time was about 3 weeks so that was not too good. Also, had to “format c:” and do a clean install of Windows as it simply just has way too many programs installed, most of them garbage. However, my initial impression still stands. Their shopping.hp.com site is just way too complicated and in general not a nice experience.

————

I am not going to get into too many details or financial discussions. It is not needed. If you just go to shopping.hp.com you will understand in less than 2 seconds why HP is such a bad company and is getting even worse:
– I tried to buy one of their computers, which seem to good to be true to be honest, a nice Pavilion
– But their whole site is CLOSE to unusable. A very dumb group of people (who individually I am pretty sure are very smart) designed this site to be just confusing and impossible to find what you want. You need to memorize the names of the processors or NVidia thingies to know what you want.
– There are way too many options, that really confuses the whole thing a lot more
– Customization steps are sort of decent, but again not for regular human beings. Only for geeks. “Should I buy a 32 GB ssd ram mega gigabyte or not?….”
– Then I try to buy. I reckon I am not in the US, but I tried to buy with both my us paypal account and bank of america card. Both rejected, and then they tell me “you can buy from other retailers”. Yes, I am going with Dell!
Usability gets a -100000. Steve Krug (author of don’t make me think would probably shed a tear if he went into this site)

It was a nice equipment though… it is a shame. If they made a bit of an effort, with the nice specs of those machines they would be able to sell a bit more.

So yes, the second part of my title basically means “if they did things right instead of everything so complex and confusing, they would thrive and grow but when you see an organization that can’t do things easy for their customer, they are bound to run into problems”

Things are relative

by Xavier Comments: 0

I found this on a site and found it very funny. Sadly, it is reality!

My hourly rates should be:
$35 per hour.
$45 per hour if you want to watch.
$65 per hour if you want to help.
$95 per hour if you tried to fix it, and failed.

Helping like on the one laptop per child… or at least one tablet per child

by Xavier Comments: 0

I was reading today this great article, Can you hear Apple’s iPad competitors sobbing?, and just thought to myself that instead of making a huge pile of Android devices – why don’t all these companies that built IPad look alikes and failed miserable – instead of just throwing them away they give them away for free to children in third world countries.

It is not exactly a one laptop per child, but it is a one internet-enabled-device-that-children-can-use-to-learn that could make a difference in the upbringing of many underprivileged financially minds that can also have potential for a better life.

It all makes sense to me, maybe not Nicholas Negroponte’s dream, but still it is a great way of helping the poor and not throwing a way those devices. Some of these companies might even get some good PR… you know… help the children… third world… which as we all know some big corporations would never give something away without a tax break or good PR in return. But who cares! What I care is about giving opportunity to those that don’t have one.

Am I being just too naive?

The real reason (IMHO) why Microsoft bought Skype

by Xavier Comments: 0

A while ago I wrote a quick review of what I thought about Skype, and as time has gone by I’ve grown even more fond of Skype. It is a great tool, the “communication lifeline” for a great deal of us. It really doesn’t bother me how many hundreds of dollars I’ve spent on it, because it has saved me a bundle plus made my life a lot simpler.

A few months ago Microsoft decided to acquire Skype, making a lot of people very nervous. With a price tag of 8.5 billion (which apparently B is the new currency… just think of Dropbox 6.5B or Twitter/Facebook which soon will probably cost bazillions of dollars – don’t forget the most valuable company in the world, Apple at 345B). Why nervous? A lot of people are wondering if MS is going to kill it or change it in a way so that it is not as useful anymore.

I’ve thought long and hard at why are they doing this if they already have MSN, Live Messenger, Lync which can do pretty much the same and maybe even Lync is actually better.

For me the reason is very simple, so I am going to cut this blog post short:

Skype has my credit card on file, same as millions of others around. We trust Skype even further with autorecharge. How many of you have your credit card on file with Microsoft?

Microsoft did not buy a technology, they bought millions of credit cards on file so that they can be linked directly to XBox for people to buy directly from MS.

Apple has done a great job on this too, they have my card on the Apple Store. Why hasn’t Microsoft been able to do the same?

Also, given they haven’t been able to, this is how much money they are losing in their online business -> http://www.businessinsider.com/chart-of-the-day-microsoft-online-operating-income-2011-1.

IMHO it was so simple… What do you think?

Errors when installing a SharePoint 2010 Farm with FAST a.k.a. RTM

by Xavier Comments: 1

A fellow SharePointer was having many strange errors when installing SharePoint 2010. He suffered, reached out for help all around and at the end it turned out to be something pretty simple. The problem was that the communication between the Fast Admin server and the query server worker node was not working.

After running the command get-fastsearchsecurityworkernode from the Fast Admin server, you get this:

dead net.tcp://fastservername.com:13279/

Also when he did the installation of Fast for SharePoint he was able to crawl just fine but when doing a search he got this:

“The search request was unable to connect to the Search Service.”

Oh FAST for SharePoint….

Solution: The firewall needs to be turned ON during installation

You can read the full installation requirements here:
http://technet.microsoft.com/en-us/library/ff381239.aspx#BKMK_WindowsFirewallMustBeConfiguredOnAllServers

Seagate GoFlexHome 2 TB Hard Drive Review and Complaints

by Xavier Comments: 0

So one of my hard drives started to fail, and I NEED to have enough storage for all my stuff. I guess 3.5 TB overall wasn’t enough, so I just got another 2TB more. Yes…. Just let me be clear, those 5 TB are distributed among my many computers and external hard drives.

Anyway, I have multiple Western Digitals but decided to be bold, so I got a Seagate Home GoFlex 2 TB with wireless printing and I don’t remember what more promises I got from Amazon’s description.

Bottom line: genius idea all around, EXTREMELY CRAPPY EXECUTION

Being honest: it gets the job done, 2 TB accessible without being attached to a computer. Connects directly to the router, speed is “decent”, around 10 MBPS with two 500GB WD pounding on it at the same time. Not quite what I expected, but I can live with it.

Why is it bad execution of a great idea:
– Setup is not fit for a regular human being. The “out of the box, one disc, easy set up” did not work. I tried on the work network and then directly plugged in to my router at home. I had to log in to my router, find the ip address from the MAC address list and then slash slash my way to the drive.
I am quite geek and it was not pleasant at all

– When installing, it installs all kind of stupid applications that are supposed to help. Again, a horrible user experience IMHO. How easy would it be to have a folder in your computer, where everything would be synchronized with the hard drive, just like dropbox.com did to beat the crap out of Microsoft’s skydrive. Simplicity beats features IMHO. Or just a picasa folder selector style where you chose what to back up. Again, common sense did not get into the design of this product.

– It then installs a control panel that has all kind of stupid options too. It also has a web access, so why do you want to install a “Seagate Dashboard” that would only confuse end users?

– Moving forward, I tried to add another user. It hung, but cancel worked. So I try again and to my surprise the textboxes are disabled. Some crappy programmer forgot to do “MyTextbox.Enabled = true;” on cancel. Something as simple as that worries me about what else is inside this code.

– Here comes one of my favorites, you CAN’T change the name!!!!!! That means that you can only have ONE in your network.

Oh well, I think Seagate knows how crappy the user experience is with their software that they don’t expect anybody to buy a second one. A for effort on this one, but F for execution

My personal recommendation is stick to what works, go for a Western Digital that you simply plug into your USB port.

Seagate: c’mon… you can do better than this… And in case you are wondering, yes I can do it better. It just takes some good ol’common sense.

What would’ve I’ve done differently
– Add a little led that would display the ip address, that way when I connect it I can see “10.10.20.123”
– So I can go to http://10.10.20.123, log in as admin admin and create users. Don’t make the user install a dashboard, give web access which even my mom would be familiar with.
– If you have different areas like backup/personal and others, use different ips for those. I am pretty sure that is possible with one ethernet, not a full requirement but nice to have
– Now have a VERY SIMPLE application to install in the computers you wan’t to back up. Allow either “backup everything inside MyStuff(i.e.) folder” or the Picasa style folder selector
– Let the user change the name, so he can personalize his HD (who knows, this might be possible but all forums say it isn’t). More importantly, that allows people that LIKE this HD (if the previous steps are done) to buy additional ones
– Have a simpler way of explaining to users what the pro version does. Very simple, just have a “Do you want to access this drive from outside your home/network? Just pay $20 a year and we give you a way”. If you go geeky tech and explain, you are getting your users scared and can’t convince them no matter what.
For me, this simple steps would make a big difference on this product.

Ohh… don’t get me started on the printer!