How did you accumulate and where do you keep your administration scripts (or other scripts for that matter)

  • I have a question for the more experienced DBA's out there. im starting to develop queries and scripts that make administering the sql server instances i have (not many but its good experience for when i may start to look for my first "real" dba job). the question becomes where do you keep your script files (thumbdrive, drop box, 5.25 floppy?) and how did you accumulate them (writing them your self, other people you work with, or out on the net?).

    Im now getting more into the administration of the servers instead of just fixing the jobs. (now im doing backup and restores helping in disaster planing and more)


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • capnhector (11/30/2012)


    I have a question for the more experienced DBA's out there. im starting to develop queries and scripts that make administering the sql server instances i have (not many but its good experience for when i may start to look for my first "real" dba job). the question becomes where do you keep your script files (thumbdrive, drop box, 5.25 floppy?) and how did you accumulate them (writing them your self, other people you work with, or out on the net?).

    Im now getting more into the administration of the servers instead of just fixing the jobs. (now im doing backup and restores helping in disaster planing and more)

    Disclaimer: I do NOT work for Red Gate. But I do use their Scripts Manager tool to store many of my favorite scripts. I've linked it to a local folder that points to my SkyDrive so I have access to the raw files from anywhere.

    http://www.red-gate.com/supportcenter/Product?p=SQL%20Scripts%20Manager

    Most of the scripts I've accumulated over the years have been a combination of things I've written, code from trusted and reliable sources on the internet and from peers and others I've worked with.

  • I do work for Red Gate, but was doing this before I got the job.

    I keep my personal scripts in the Snippets Manager within SQL Prompt. You can add a quick key to make them pop up on the screen. For shared or institutional scripts, I make sure they go into source control at the organization so that everyone has access to them.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • I keep copies of any script I might need again in SkyDrive.

    DropBox, so far as I know, requires an application to be installed locally before you can access your files. SkyDrive allows access directly in the browser. I've worked in plenty of environments where, when I needed a script, I had internet access, but not the ability/desire to install software on the server or on the computer I was using.

    Google Docs would probably work as well, but I've been using SkyDrive since before Google Docs existed.

    The RedGate tools are great, right up to the point where you have to use a web-based VPN connection from a hotel's "business center" to do something on a server you're responsible for, while you're on vacation and don't have access to your usual workstation or even your home copy of Dev Edition, et al. You'll want your scripts "in the cloud" at that point.

    I've also had scripts I built at prior jobs come in handy in later jobs. Again, since I have them in the cloud (SkyDrive in this case), I can simply download, edit, and use. If I had them stored in a script library on a workstation at a company that's out of business, they would be lost.

    So, use local script management for convenience when you're at work, but make sure to copy them to some online storage solution. One that allows browser access.

    As for where I get them: Many I wrote myself. Some I got from others - on this site or other sites. Some I got from others, then edited for my own use.

    What I have in them is a mix of things I find I universally need (like a script for managing index fragmentation and maintenance), things I don't need often but which were a pain to put together in the first place (some CLR objects that are really useful in limited circumstances, but where Google and Bing failed me in finding what I needed), and some things that took a lot of research and trial and error to build (lots of XQuery examples).

    Basically, there's no need to keep a script I can reconstruct from scratch with a minute's typing. My usual DBCC CHECKDB script doesn't need to be stored anywhere. It's too simple to just rewrite when I need it. But if it would be in any way an effort to reconstruct, I save it.

    For example, I recently had to do a fairly complex XML shred. The documentation on XQuery sucks, and it took hours to figure out how to write the query. Writing it took about 2 minutes, but figuring out what to write, then debugging (largely trial and error), took half a day. Inline comments get added, the file gets a very clear name, and it goes in my online library. I may never use anything like it again, but if I do, I have documentation and sample code now, in a format that is crystal clear to me (since I wrote it). Doing that kind of thing has saved me days, maybe weeks, of work, in many cases. "I know I did this before, but I don't remember how," stops being a significant barrier.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thanks for the information. i use drop box and they do have a nice web interface just like sky drive. The application lets me keep multiple computers in sync rather easily. (may have to look into Microsoft sky drive though)

    GSquared, i like the explanation of what you keep and what you just rewrite when you need it.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • If you're happy with DropBox, use that. SkyDrive is just another option for it.

    Main reason I use SkyDrive is because I've been using it (and hotmail) since before most of these other services existed. Haven't seen a need to change, so haven't bothered. In other words, it's not a serious preference, one way or the other.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thought of one other place where I store a lot of my scripts. My blog. I put more stuff up there than anywhere else, and it's always online when I need it (so far, knock wood).

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • GSquared (12/3/2012)


    If you're happy with DropBox, use that. SkyDrive is just another option for it.

    Main reason I use SkyDrive is because I've been using it (and hotmail) since before most of these other services existed. Haven't seen a need to change, so haven't bothered. In other words, it's not a serious preference, one way or the other.

    i was looking at sky drive and have one from my xbox live (one of the few benifits of playing the 360) and i was liking the office integration for some school work i was working on, that alone may cause to switch.

    I to am only using drop box for the same reason, been using it for a while. with the desktop sync software it will be easy (although take some time) to just swap every thing over.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply