Databases

Microsoft SQL Server Backup Models

master - simple -
model - full (default)
msdb - simple (default)
resource - none
tempdb - simple
Reference: http://msdn.microsoft.com/en-us/library/ms175987(SQL.90).aspx
When to Use the Simple Recovery Model
Use the simple recovery model if the following are all true:

Point of failure recovery is unnecessary. If the database is lost or damaged, you are willing to lose all the updates between a failure and the previous backup.
You are willing to More >

MySQL Workbench

Script: Compress SQL Server Backups using 7-Zip

I often need to remotely backup my SQL backups, but being that they are a few gigabytes I needed a way to automate compressing the backups and since SQL 2005 doesn’t provide this (2008 does) I spent a few minutes and wrote the following script:
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set ZIPPATH=C:\program files\7-Zip
: Set BACKUPROOT
set BACKUPROOT=”D:\Program Files (x86)\Microsoft SQL More >

MySQL CLI Output Formatting Tips

I’m sure you’ve seen results similar to this on a standard query:

Now, if you use the \G option (Send command to mysql server, display result vertically.):

That makes reading the output from command line really nice.
One more tidbit that I’ve found I like to do is use the \p option (Print current command.) combined with \G More >

DBDesigner4 and MySQL 5.0: Together Again

If you’re struggling with “dbExpress Error:  Invalid User/Pass ID” and you are using MySQL 5.0 server (Windows or Linux) this is because of the password structure changes.
DBDesigner4 (now MySQL WorkBench (OSS/SE)) was developed to work with MySQL 3 and MySQL 4.  There is a workaround to allow you to connect to MySQL 5 servers though.
Add More >

SQL Maintenance Tips

dbcc checkdb (’databaseName’)
Verifies that Index and Data Pages are linked properly,
that Indexes are sorted, that the pointers in the database
are accurate, that the data looks OK, and that there are
proper page offsets.
Advanced checkdb Options:
NOINDEX, REPAIR_FAST, REPAIR_REBUILD, REPAIR_ALLOW_DATA_LOSS

noindex:  Checks the database but not it’s indexes.  Results in faster operation.  If there are problems, make sure to More >

SQL Server Database Maintenance

So, I’m a new kid on the block when it comes to SQL Server and I was in need of reindexing and defragmenting some tables in a database.  I ended up finding a few commands useful for this operation.
dbcc indexdefrag and dbcc dbreindex
After running
dbcc showcontig
to get a report on density/fragmentation.  I saw a lot of More >