by Katherine Villyard | Jun 2, 2016 | scripting, sql
I set this up to be modular and reusable, because I like reusing things. This doesn’t actually move your system databases. It just outputs a change script and a revert script. You still have to run the generated script, then log on to your server and restart...
by Katherine Villyard | Feb 16, 2016 | scripting
So, I have a drive full of files. Sometimes, I get a new one–okay, sometimes I get over 1000 new ones–and want to keep the latest and pitch the duplicates without throwing away old files that don’t have a duplicate. These files are of the form...
by Katherine Villyard | Feb 9, 2016 | scripting, sql
What files do I need to restore this database to a point in time? You might know this off the top of your head, especially if you set up the backups or if you don’t have a lot of backups, but just in case you’re panicking, ask MSDB. MSDB knows all…...
by Katherine Villyard | Feb 2, 2016 | scripting, sql
Google informs me that my post on Windows Internal Database Maintenance is popular. It’s not what I’m currently using, however. I’ve switched over to Ola Hallengren’s scripts. If you download and run the installer script, it creates a series...
by Katherine Villyard | Nov 21, 2014 | powershell, scripting
I was given the task of renaming a bunch of databases named something like “name,” “name_1,” “name_2,” etc., to “nameold,” “nameold_1,” “nameold_2,” etc. Our convention is for the database name...
by Katherine Villyard | Nov 14, 2013 | scripting
This assumes a convention where databases are named after the responsible party with an underscore and a version number or description. It also assumes that running this script is faster than remoting to the server and looking at the directory. 😉 declare @dbname...
by Katherine Villyard | Oct 20, 2013 | scripting
I needed to SFTP a bunch of files ranging in size from 40 meg to 130 gig. The default behavior of “mput *” is to copy the files in alphabetical order, but what happens then is that all the smaller files pile up behind the large ones. This is bad because...
by Katherine Villyard | Jun 22, 2013 | scripting
I stripped out a piece of company-specific logic, but… List the databases you want to move in a file named “control.txt.” (To migrate the entire server, paste the output of “select name from sys.databases where name not in...
by Katherine Villyard | May 17, 2013 | scripting
Virtual Log Files. Your database’s log file is made up of one or more virtual log files. Our databases have too many. Basically, our LDFs are fragmented. What to do about this? Well, Dave Levy has a script to reduce the number of VLFs, but it’s to run...
by Katherine Villyard | Mar 12, 2013 | geekiness, powershell, scripting
I went to the Atlanta PowerShell Users Group tonight. The topic was tips and tricks. My trick was this script, which task scheduler reads to me in the morning. Assuming you use Hiveminder–and you should, because it’s awesome–you only have to edit...