Author: way0utwest

  • How SQL Server Full Backups Work

    I’m writing this in support of a few talks I give that talk about backups. This is how I see things and it’s based on things I’ve learned over time. Some of this comes from a great explanation on Technet from Paul Randal, but there are misc other sources that I can’t be sure of which ones I’ve used. Long story short: I learned most of this from others and docs. It’s not all me.

    There are two parts to a full backup in SQL Server:

    • data reading
    • log writing

    Technically both sections read and write, but this is how I think of things. I’ll describe there:

    Data reading – The backup process goes through all extents allocated and reads a page, sends it to a buffer and that gets written to the backup file. This happens as fast as SQL can do it, just going through the pages, but it takes most of the backup time.

    Log writing – all of the log records that are written while the data reading portion of the backup is running are appended to the backup file, after the data pages.

    Let’s say that the entire time of the backup, from the File Created to the File Last Modified timestamps on the backup file is represented by t. The data reading portion of the backup takes time d. The log writing portion of the backup takes time l.

    This gives us:

    t = d + l

    My database is transactionally consistent at backup start time + d, not + t. When is that? I’m not sure, but usually it’s fairly close to the timestamp at the and of t.

    Make sure that your backups are transactionally consistent. Don’t export, don’t use open file managers, don’t use anything that doesn’t respect transactions. The native SQL Server backup process does this. If you want a few other features, my employer makes SQL Backup Pro, which also respects transactions.

  • Cyberwar

    There are no shortage of books about cyberattacks and hackers. Some of these fictional stories even postulate that countries will build armies and engage in digital war with other countries. Some of this has come true, with the US and Israel attacking Iranian targets, suspected Chinese hackers targeting the US, and the announcement that Britain is building their own cyber army.

    While there are certainly no shortage of attacks made on corporations every day, how long before countries make determined efforts to disrupt their enemies’ economies with digital war? It’s a scary thought, and given the poor security habits of so many developers, it’s possible that many companies might find themselves struggling to conduct businesses while under attack. It might not be any different than if conventional weapons were being used near our facilities.

    The state of coding by so many “developers” today is somewhat scary. It’s not even old applications that are vulnerable to SQL Injection, but even new systems that have poor security practices being used that are vulnerable.

    I think that secure coding practices like these should be implemented by anyone writing software. I think examples, frameworks, and presentations about coding shouldn’t use simple passwords and bypass checks. Yes, it’s a pain for those that teach, but it also means that shoddy coding practices aren’t proliferated as people borrow your code and alter your examples.

    Security is a problem, but I think a lot of the issues would be minimized if we, as an industry and professionals, learned to write more secure code as a matter of habit, not as an additional feature to be added later.

    Steve Jones

    Video and Audio versions

    Today’s podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

    Follow Steve Jones on Twitter to find links and database related items and announcements.
    Steve Jones Windows Media Video ( 17.0MB) feed

    MP4 iPod Video ( 19.9MB) feed

    MP3 Audio ( 4.1MB) feed

    Feeds are available at iTunes and Mevio

    To submit an article, rant or editorial,
    log in to the Contribution Center

  • What Do You Want to Learn?

    This is a busy time of year for me. Between September and October, I’ve attended 11 events in 7 cities and given 23 talks on 8 topics. It’s been a hectic time and I’m looking forward to snow falling in the Colorado mountains and taking some time off to relax and enjoy life away from work.

    It seems that every year I’m working on and delivering 3 or 4 new sessions on a variety of topics. I find the challenge of learning more about a technology or feature of SQL Server to be exciting, and it seems there’s no shortage of new things I’d like to learn. As I watch different presentations, I find myself itching to work with the topic and learn how it might be useful for me. I often end up taking some area of SQL Server that interests me, and I think will interest other, and building a talk.

    However I rarely hear from the rest of the community about the topics they’d like to learn about. This week I’d like you to think about the topics that you wish someone would present at your next user group, SQL Saturday, or conference:

    What do you want to learn?

    Let me know this week. I don’t know that I’ll tackle many of the ideas, but I’m sure there are speakers out there that will examine your opinions and consider building a presentation that might be in demand.

    Steve Jones

    Video and Audio versions

    Today’s podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

    Follow Steve Jones on Twitter to find links and database related items and announcements.
    Steve Jones Windows Media Video ( 13.4MB) feed

    MP4 iPod Video ( 15.7MB) feed

    MP3 Audio ( 3.3MB) feed

    Feeds are available at iTunes and Mevio

    To submit an article, rant or editorial,
    log in to the Contribution Center

  • Effectiveness

    I saw a great quote recently on an internal email at Red Gate. We had deployed a new feature to a website, the application seemed to be working, but someone questioned the architecture of the implementation. The person that was in charge of the project sent this back at the end of an explanation:

    “It’s a little clunky, but we decided it was better to get it done than make it perfect.”

    That’s a great quote. In fact, that’s what I’ve aimed for in most of my career. Move things forward, get them done in an effective manner. That’s what I’ve tried to do as long as I’ve been in technology. Examine a problem, consider various solutions, and then choose one to move forward with. At the end of the day, as has been said by many people, “shipping is a feature“.

    This doesn’t mean giving up on quality or accepting anything, but it does mean that you continue to move forward. You may make compromises on code quality, but small compromises. Your code has to still solve the problem. Your database still has to handle the load. You still need quality work, but a solution you can get done quickly that performs 10% worse may be better than a faster solution that takes twice as long to develop.

    Lots of code lives in systems for years. We want this code to be “good” in that it needs to work, handle the load, and contain few bugs. However lots of code also gets refactored over time. We should minimize bad code as much as possible, but less than perfect code isn’t bad. Sometimes it’s just a little clunky, but it gets the job done.

    Steve Jones

    Video and Audio versions

    Today’s podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

    Follow Steve Jones on Twitter to find links and database related items and announcements.
    Steve Jones Windows Media Video ( 14.7MB) feed

    MP4 iPod Video ( 17.2MB) feed

    MP3 Audio ( 3.6MB) feed

    Feeds are available at iTunes and Mevio

    To submit an article, rant or editorial,
    log in to the Contribution Center