<p>I am a developer.  An architect on good days.  Somehow I find myself also being the DBA for my small company.  My background is fair in the DB arts but I have never been a full fledged DBA.  My question is what do I have to do to ensure a realiable and reasonably functional database environment with as little actual effort as possible?</p>

<p>I am sure that I need to make sure that backups are being performed and that is being done.  That is an easy one.  What else should I be doing on a consistant basis?  </p>

[{'answer_id': 35367, 'author': 'tbreffni', 'author_id': 637, 'author_profile': 'https://Stackoverflow.com/users/637', 'pm_score': 2, 'selected': False, 'text': '<p>I would suggest:</p>\n\n<ul>\n<li>A script to quickly restore the latest backup of a database, in case it gets corrupted</li>\n<li>What kind of backups are you doing?  Full backups each day, or incremental every hour, etc?</li>\n<li>Some scripts to create new users and grant them basic access.</li>\n</ul>\n\n<p>However, the number one suggestion is to limit as much as possible the power other users have, this will greatly reduce the chance of stuff getting badly messed up.  Servers that have everyone as an sa tend to get screwed up quicker than servers that are locked down.</p>\n'}, {'answer_id': 35394, 'author': 'Joe Barone', 'author_id': 3452, 'author_profile': 'https://Stackoverflow.com/users/3452', 'pm_score': 3, 'selected': False, 'text': "<p>I've been there.  I used to have a job where I wrote code, did all the infrastructure stuff, wore the DBA hat, did user support, fixed the electric stapler when it jammed, and whatever else came up that might be remotely associated with IT.  It was great!  I learned a little about everything.</p>\n\n<p>As far as the care and feeding of your database box, I'd recommend that you do the following:</p>\n\n<ul>\n<li><p>Perform regular full backups. </p></li>\n<li><p>Perform regular transaction log backups.  </p></li>\n<li><p>Monitor your backup jobs. There's a bunch of utilities  out on the market that are relatively cheap that can automate this for you.  In a small shop you're often too busy\nto remember to check on them daily.</p></li>\n<li><p>Test your backups.  Do a drill.  Restore an old copy of your most important databases.  Prove to yourself that your backups are working and that you know how to restore them properly.  You'd be suprised how many people only think about this during their first real disaster.  </p></li>\n<li><p>Store backups off-site.  With all the online backup providers out there today, there's not much excuse for not having an offsite backup. </p></li>\n<li><p>Limit sa access to your boxes. </p></li>\n<li><p>If your database platform supports it, use only role based security.  Resist the temptation to have one-off user specific security.</p></li>\n</ul>\n\n<p>The basic idea here is that if you restrict who has access to the box, you'll have fewer problems.  Secondly, if your backups are solid, there are few things that come up that you won't be able to deal with effectively.</p>\n"}, {'answer_id': 35408, 'author': 'Unsliced', 'author_id': 2902, 'author_profile': 'https://Stackoverflow.com/users/2902', 'pm_score': 4, 'selected': True, 'text': "<p>Who else is involved in the database? Are you the only person making schema changes (creating new objects, releasing new stored procedures, permissioning new users)? </p>\n\n<ul>\n<li>Make sure that the number of users doing anything that could impact performance is reduced to as close to zero as possible, ideally including you. </li>\n<li>Make sure that you're testing your backups - ideally run a DEV box that is recreating the production environment periodically, 1. a DEV box is a good idea, 2. a backup is only useful if you can restore from it. </li>\n<li>Create groups for the various apps that connect to your database, so when a new user comes along you don't guess what permissions they need, just add them to the group, meanwhile permission the database objects to only the groups that need them </li>\n<li>Use indices, primary keys, foreign keys, constraints, stats and whatever other tools your database supports. Normalise. </li>\n<li>Optimise the most common code against your box - bad stored procedures/data access code will kill you. </li>\n</ul>\n"}]
['https://Stackoverflow.com/questions/35357', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2894/']