SQL Server with Mr. Denny


May 19, 2009  5:24 AM

Got Pics from EMC World Day 0 posted

Denny Cherry Denny Cherry Profile: Denny Cherry

Thanks to my wife Kris reminding me that the SD card in my camera will also fit in my blackberry I’ve gotten the photo’s uploaded to flickr.

Denny

May 18, 2009  1:28 PM

EMC World Day 0 In Review

Denny Cherry Denny Cherry Profile: Denny Cherry

This morning is Day 1 of EMC World, so it’s a perfect time to review yesterday.

Day 0 is all about getting to the show, and getting checked in.  And of course the party.

The food was pretty good, as was the beer.  The band sounded ok, but the sound guy wasn’t all that great.

I’ll be posting photo’s probably when I get home, since I’m a dork and I forgot the cable for my camera.

Denny


May 16, 2009  7:16 PM

#EMCWorld 2009 is starting tomorrow, and I’m on my way

Denny Cherry Denny Cherry Profile: Denny Cherry

Well tomorrow begins my annual trek to EMC World.  This year I’m headed back to Orlando as EMC World is being held at the Orange County Convention Center.  As I’ve done the last couple of years I’ll post as often as I can during the conference both on here on my blog, as well as on Twitter.

This years EMC World event should be a blast and very educational.  They’ve got tons of sessions on VMware, and one that I’m really looking forward to on setting up Exchange under VMware using a CLARiiON for the storage.  This is something that I was hoping to get done before EMC World, but when I saw that session on the schedule I decided to hold off on our Exchange Migration until afterwords so that I could get some additional best practices first.

I’m also looking forward to the sessions that I’ve found about SQL Server on the CLARiiON.  I haven’t found all that many of these up there, something that I’ll be sure to mention in my eval this year as I would assume tha the bulk of data stored on SANs is database data, and contrary to popular believe database servers are not file servers and should not be treated as such.

If you will be at EMC World come on over and say hi.  I’ll be on twitter so shoot me a message or a DM or find me in the Web 2 lounge or the EMC returning attendees lounge, or the exhibit hall somewhere.

Don’t forget to check back here for photo’s of the event.  I can’t upload in real time as my phone doesn’t have a camera, so I have to wait until I get back to the hotel or the convention center to upload them.

Denny


May 14, 2009  11:00 AM

Outside Queue to SSB adapter

Denny Cherry Denny Cherry Profile: Denny Cherry

Something that I think that Microsoft should include with the SQL Service Broker is an adapter so that MSMQ messages (and other messaging systems as well) will flow automatically into the SQL Service Broker.  Since Microsoft hasn’t gotten around to writing one I’m going to start.

It shouldn’t be all that hard.  Setup a Windows Service which reads from a predefined MSMQ and have it take the message and send it to a SQL Service Broker queue.

Then setup a Windows application that allows you to setup the config file with the source you want to read from and the SQL Service Broker objects you want to send to.

Since I have little to know experience reading from other queues I’m putting a feeler our there for some assistance on this project.  Since I don’t know C#, the project will be written in VB.NET using Visual Studio 2008 on the .NET Framework v3.5.

I’ll be starting with MSMQ, and they other queuing systems as needed.

I’ve setup a project site on CodePlex.  There’s not much up there at the moment, just a basic framework of the project.  (Yes I know I now have two unfinished projects running, but this one will hopefully have others working on it as well.)

If you are interested in helping me out please let me know here, or on twitter, or in the discussion forum on CodePlex.

Thanks,

Denny


May 11, 2009  11:00 AM

How do I change from push to pull subscriptions in SQL Replication?

Denny Cherry Denny Cherry Profile: Denny Cherry

The official answer is to delete the subscriber and recreate it pushing a new snapshot to the subscriber.

The much quicker and easier method is as follows.

1. Stop the distribution agent on the machine that it’s currently running on.

2. Disable the SQL Agent job that runs the distribution agent.

3. Script out the SQL Agent job from the old server and create it on the new server.

4. Enable the job on the new server.

Done.  You have just changes replication from being a push to a pull (or from being a pull to a push).

If you wanted to you could even setup your distribution agent on a third computer, but it is easier to keep track of everything if it’s running on the distributor or the subscriber.

Happy replicating.

Denny


May 7, 2009  11:00 AM

Pull vs. Push Subscriptions? Which one should you use?

Denny Cherry Denny Cherry Profile: Denny Cherry

This is a “it depends” sort of question.

These are my recommendations, your mileage may vary.

Your distributor is on the same system as your publisher – Pull is probably for you

Your Subscribers are a very high transaction count – Push is probably for you

You need to manually copy the subscription over the network to the subscriber and load it up from the local drive – Pull is probably for you

Your distributor is on a separate from the publisher – Push is probably for you

The distributor is on the same server as your subscriber – Either, as the agent will be running on the distributor either way

You have a slow network link – Either, slow networks aren’t overcome with either technique

If you have specific’s you’d like to ask about, post your questions below, or in the ITKE forum.

Denny


May 4, 2009  11:00 AM

How can I remove duplicate records in my tables?

Denny Cherry Denny Cherry Profile: Denny Cherry

All to often we end up with duplicate rows in a table.  The best way to keep duplicate rows out of the database is to not let them in.  But assume that they are there.  This bit of sample code shows how to delete those duplicate rows quickly and easily in a single statement.  No temp tables required (I use a temp table to put the data into for example purposes).  This code is for SQL 2005 and up as it uses some features which were introduced in SQL Server 2005.  SQL Server 2000 would require a totally different technique.

CREATE TABLE #DuplicateRows /*Create a new table*/
(Col1 INT,
Col2 INT,
Col3 INT)

INSERT INTO #DuplicateRows /*Load up duplicate rows*/
SELECT 1,1,1
UNION ALL
SELECT 1,1,1
UNION ALL
SELECT 1,1,1
UNION ALL
SELECT 2,2,2
UNION ALL
SELECT 2,2,2
UNION ALL
SELECT 2,2,2

SELECT *
FROM #DuplicateRows; /*Check that the data is actually hosed*/

WITH Cleaning AS (SELECT ROW_NUMBER() OVER(ORDER BY Col1, Col2, Col3) as row,
Col1,
Col2,
Col3
FROM #DuplicateRows)

DELETE FROM Cleaning /*Delete the rows which are duplicates*/
WHERE Row NOT IN (SELECT row FROM  (SELECT Col1, Col2, Col3, MIN(row) row
FROM Cleaning a
GROUP BY Col1, Col2, Col3) b)

SELECT * /*Check the table to see that it is clean*/
FROM #DuplicateRows

DROP TABLE #DuplicateRows /*Clean up the table*/

Hopefully you find this code useful.

Denny


May 1, 2009  5:03 AM

Should I install an Anti-Virus software on my server?

Denny Cherry Denny Cherry Profile: Denny Cherry

Yes, for crying out loud yes.

Every server that can access the Internet or be access from the Internet, or that can be accessed from a computer that can access the Internet should have an anti-virus on it.  Preferably a corporate wide solution like Trend Micro, McAfee, Norton, etc. so that the server reports back to a central server to make it easier to find out if a machine has a problem.

Next comes what should be scanned.  I prefer to exclude the mdf, ndf, and ldf files.  I don’t like to exclude the entire folder as this creates a hiding place where a virus could stick infected files.  If possible have it exclude the mdf, ndf and ldf files from old the correct folders only.  Even if a virus scanner wanted to scan the database files it wouldn’t be able to as the files are locked open by the SQL Server so that nothing else can access them.  By not excluding the files all you are doing is throwing alerts to the monitoring server that files couldn’t be scanned.

Odds are a full scan doesn’t need to be done against the server all that often as the files on the hard drive of the server aren’t going to change all that often.  Any virus that comes in from the network should be caught by the real time engine that is running at the time.  You will want to do a full scan every once and a while (every couple of weeks or so) incase something came in over the network was saved and setup to launch at the next reboot but wasn’t yet in the virus definition file.

Denny


April 28, 2009  4:51 AM

Why should the DBA care about Network Firewalls?

Denny Cherry Denny Cherry Profile: Denny Cherry

All to often I see people online asking some sort of question about connecting to their CoLo’ed SQL Server and they connect directly over the Internet.  This is nuts people.  If you can access your SQL Server via Management Studio from anywhere on the Internet so can people who would love to break into your SQL Server and use the machine for their own uses.

SQL Servers shouldn’t every be directly accessible from the Internet.  Even if you have to use public IPs to host the machines, make sure that there is a firewall setup between that server and the public Internet so that no one has any sort of direct access to the machine from outside of the data center.

How do you manage the SQL Server in this case?  You use the router’s built in functions to setup a point to point VPN with your office router so that you can securely communicate with the servers in the CoLo without sending that data in plain text over the Internet.

For that matter while you are locking down the SQL Server, suggest that the Web Servers be locked down as well.  The only ports that they should have open are 80 and 443 unless you are running streaming servers, or known FTP servers.

If your servers have been sitting exposed on the public Internet then I highly suggest that you install an Anti-virus on them and check for Viruses, malware, etc that’s doing stuff you don’t want it to be doing.

Several years ago I was doing some work for a company that had Windows 2003 servers sitting directly on the Internet without an Anti-Virus and with no firewall.  When I got to the machines and took them off the Internet for cleaning there were over 200 viruses on the machines that they had no idea were on there.  There complaint was that the machines were running slow, and network costs kept going up.  God only knows what sort of network traffic these viruses were generating as they did what ever it was they were trying to do.

Denny


April 26, 2009  5:29 AM

SQL Server Standard Edition getting Lock Pages in Memory

Denny Cherry Denny Cherry Profile: Denny Cherry

Microsoft SQL Server 2005 and 2008 Standard edition will be getting the Lock Pages in Memory feature that SQL Server Enterprise Edition has had starting in SQL Server 2005.  This was announced by Bob Ward via the CSS Blog in his post “SQL Server, Locked Pages, and Standard SKU…“.  Per Bob’s post a CU will be released for SQL 2005 SP3 and SQL 2008 SP1 which will allow for a trace flag to be used to turn this feature on.

On behalf of the users I’d like to thank Bob and the rest of the SQL Server team for being able to get this into the product.

On behalf of the developer team, I emplore you to not turn this on for no reason.  Only use this feature once you understand what this feature does and in the correct places.

The Locked Pages flag bascially tells the SQL Server that if it is told to flush RAM to disk to ignore it.  If the setting is enabled then SQL doesn’t flush to disk.  If you find that your SQL Server is flushing to disk, don’t just enable the flag and move on.  I emplore you to contact CSS and figure out why SQL is being told to flush to disk.  This is the only way the bug will be fixed.  Once the issue has been reported to Microsoft and they have the information they need enable the flag until the bug is fixed.  Then install the patch to fix the bug, disable the flag and you’ll be fine.

Because of the fact that this is how bugs are found and fixed I hope that this is a CSS only CU which will require that users contact CSS before they can get the fix.

Denny


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: