Category: Blog

  • The Annual SQL Saturday in Baton Rouge

    I’ve been to quite a few of the SQL Saturday Baton Rouge events. There have been 10 with the 11th coming in a couple weeks. The crew down there has done a great job over the years, and I’ve met lots of friends there: Patrick LeBlanc, William Assaf, Kenny Neal, and more. Too many to list, but this has been one of my favorite events.

    This year, SQL Saturday Baron Rouge 2024 is on July 27, and it’s once again at LSU. You can register today and join me for a fun day of learning inside, away from the heat. There is a packed schedule of all kinds of data related sessions. Learn about performance topics, Power BI, app dev, cloud, Data Ops, and more.

    I used to fly to New Orleans each year and drive up. It’s an easy drive, and I even went to the Saints training camp one year. This year I’m going to Baton Rouge direct (well, I change planes) because I’ll be visiting a customer the day before.

    However, if you don’t have plans Friday, there are two precons:

    These are great ways to get some fairly inexpensive training. Ping your boss and ask him to send you to one.

    Register for SQL Saturday Baton Rouge and join me next week. Hope to see you there.

  • 25 Years of Redgate

    Redgate Logos_RGB_AllinOneI’m in Austin today, ready for the Redgate Software 25th Birthday celebration. The company started in 1999 and this is their 25th birthday. All of our offices are celebrating, with most of us in the US coming to Austin for a party last night. My wife (and many partners) are here as well, emphasizing that we care about our people and recognize that partners support our employees.

    I haven’t known Redgate for 25 years, but I have known one of the founders for 22 years. I first met Simon Galbraith in 2002 at the PASS Summit in Seattle. They were our first advertising customer at SQL Server Central in 2001 and the relationship continues through today. Redgate purchased SQL Server Central in 2006 and I’ve been working for them ever since.

    In that time, it’s been interesting how my job has changed and evolved. I remember the early days of SQL Monitor being released and me demoing it from horseback.

    There was the DBA in Space promotion, which I was only lightly a part of, but it was fun.

    We had the
    SQL in the City events, which included a tour around the US.

    I still remember the first one in London at the Royal Society of Medicine in London. That was a treat.

    and SELECT Star beer.

    We ran that series for a long time, with quite a few live and virtual events. It was a fun time for my coworkers to get together in various places in the world. One of our last live events was in Cambridge at the Redgate office, with our 4 advocates.

    2024-07-15 11_37_41-Window

    Now we’ve evolved to the Redgate Summits, one of which is coming to New York next month.

    I’ve watched Redgate grow to include Flyway (I’ve got a tips series), SQL Provision, and now Test Data Manager. I’ve done so many blogs and promos, the latest of which is TDM in 10 minutes. One of my favorites was a photo shoot in Cambridge, where they got me on another horse.

    dbateam8

    It’s been a great time for me and I’ve enjoyed my job with Redgate. I continue to do so today and look forward to the future. I truly hope this is the last job I have.

  • Fixing DBCC CloneDatabase Dup Key error in sys.sysschobjs

    This was an interesting error, and I was able to duplicate it, so I decided to write a post on how to find the problem and fix it. The error after running DBCC CLONEDATABASE is:

    NO_STATISTICS and NO_QUERYSTORE options turned ON as part of VERIFY_CLONE.
    Database cloning for 'atest' has started with target as 'aSmallTest'.
    Msg 2601, Level 14, State 1, Line 11
    Cannot insert duplicate key row in object 'sys.sysschobjs' with unique index 'clst'. The duplicate key value is (885578193).

    The final key value (885578193) for you might be different, but the error is the same.

    Note: In SQL Server 2022 RTM + GDR, this error occurs with system objects collisions. Upgrading to CU12 fixed this. Possibly earlier CUs fix it, but that’s all I’ve tested.

    The Scenario

    I connected to a SQL Server instance and ran this:

    DBCC CLONEDATABASE(aTest, aSmallTest) WITH VERIFY_CLONEDB;

    I was just trying to copy a database to do some testing against a copy. The command too quite a few seconds (11 for me) to run before returning the error above. You can see the screenshot below.

    2024-07-02 10_50_07-SQLQuery3.sql - ARISTOTLE.atest (ARISTOTLE_Steve (79))_ - Microsoft SQL Server M

    Strange. Why would a copy of a database cause an error here? I’ve run DBCC CLONEDATABASE on this instance before and it worked.

    I’m not sure of the exact problem, and my searches note that

    The Fix

    I found a post that describes a similar issue, but certainly isn’t the case here. Another post from Pinal shows how to query sys.sysschoobhs, which isn’t reachable with a DAC connection. I finally found in the docs that SQL Server doesn’t support cloning with objects in the model database.

    So, I need to delete objects in the model database. In my case, I took this query (from the first link above) and ran it from the source database. That’s important. Running from anywhere else doesn’t work.

    SELECT m.id, m.name, c.name, c.id, m.type
    FROM model.sys.sysobjects m
    FULL OUTER JOIN sys.sysobjects c
    ON m.id = c.id
    JOIN sys.objects o
    ON c.id = o.object_id
    WHERE --o.is_ms_shipped <> 1
    m.name <> c.name
    AND m.id IS NOT NULL;

    As you can see below, this returns two objects.

    2024-07-02 11_00_31-SQLQuery3.sql - ARISTOTLE.atest (ARISTOTLE_Steve (79))_ - Microsoft SQL Server M

    If I look in model, I see these, one if you just look at tables, but the PK is attached.

    2024-07-02 11_01_56-SQLQuery3.sql - ARISTOTLE.atest (ARISTOTLE_Steve (79))_ - Microsoft SQL Server M

    If I delete these two objects, then DBCC CLONEDATABASE works.

    Summary

    This is a strange error, and I’m not sure why it appears, but the documentation notes that running dbcc clonedatabase with objects in model is not supported. I suspect this is a change across one of the CUs, as I know this used to work.

    In any case, the fix is remove the objects in model. If you really need these, then I’d create a script to remove and add those objects back, with a call to dbcc clonedatabase in the middle.

  • Taking My Wife on a Date Out of Town

    This isn’t data related, but I had some fun, so I decided to make a quick post. I’m on holiday today, actually yesterday and today, in San Francisco/ Oakland.

    The reason: a date.

    My wife is a fan of Dwele and she’s often said that since he lives in Washington D.C. and is sometimes in clubs there, we should plan a trip sometime. I’ve periodically searched for concert dates and never seen any. While I was traveling this spring, I happened to see a couple dates at Yoshis, a jazz club in Oakland. I bought tickets and surprised her. I then booked a short holiday this week for us to fly out and see the concert.

    Tonight is the show and we’re excited for the adventure.

    Life is short. Work hard, but remember to enjoy yourself when you can. Especially with those you love. Look for opportunities to bring them joy and take them when you can.