Log Maintenance (SQL SERVER)

Posted by John
on Wednesday, 19 November 2008

Over time your SQL Server transaction log will fill up and if you don't watch it it'll consume all your server's disk space.

So to cure that problem it's best adding a weekly job to SQL Agent with these commands

Truncate log...

USE [databasename]
GO
BACKUP LOG databasename WITH TRUNCATE_ONLY
GO

Shrink database...

USE [databasename]
GO
DBCC SHRINKDATABASE(N'databasename' )
GO

(truncating only clears the logfile, to reclaim that space you have to shrink the database)

Important!

Do remember to schedule a full database backup before this so you don't lose any important transactions; critical in a live environment.

no such file to load -- sqlite3/database

Posted by John
on Sunday, 20 July 2008

had a similar problem to these guys

fixed with...

cd /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2
sudo find . -perm 0662 -exec chmod 664 {} \;

Installing MySQL on Vista

Posted by John
on Sunday, 30 March 2008

Easy it aint, kept getting this...

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail.

But here's how to fix it,

Get MySQL

First download MySQL

Install MySQL

Now unzip the executable and install it, when it's finished and asking you if you want to run the configuration tool, don't; we'll deal with this in a minute.

Install Resource Hacker

Now to fix the MySQL Instance Configuration Tool, so it will install the MySQL service in Vista, download Resource Hacker...

Unzip it and open it's folder, then Right-Click on ResourceHacker and Run as Administrator.

Edit Resources

Now using Resource Hacker open the file...

  • C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQLInstanceConfig.exe

Navigate to 24 / 1 / 1033 and look at the config on the left. On line 6 you should see asAdministrator, change this to requireAdministrator then click Compile Script; then finally Save the file.

Run MySQL Instance Config

Finally run the MySQL Instance Configuration tool from within...

  • C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQLInstanceConfig.exe

This should now be able to create the system service and finally give you MySQL running on Windows Vista.

Convert InnoDB > MyISAM and Back Again...

Posted by John
on Friday, 28 December 2007

Convert Typo InnoDB > MyISAM

Simple script to convert your Typo database tables from InnoDB to MyISAM format.

use mytypo_production;
ALTER TABLE articles_tags ENGINE = MyISAM;
ALTER TABLE blacklist_patterns ENGINE = MyISAM;
ALTER TABLE blogs ENGINE = MyISAM;
ALTER TABLE categories ENGINE = MyISAM;
ALTER TABLE categorizations ENGINE = MyISAM;
ALTER TABLE contents ENGINE = MyISAM;
ALTER TABLE feedback ENGINE = MyISAM;
ALTER TABLE notifications ENGINE = MyISAM;
ALTER TABLE page_caches ENGINE = MyISAM;
ALTER TABLE pings ENGINE = MyISAM;
ALTER TABLE redirects ENGINE = MyISAM;
ALTER TABLE resources ENGINE = MyISAM;
ALTER TABLE schema_info ENGINE = MyISAM;
ALTER TABLE sessions ENGINE = MyISAM;
ALTER TABLE sidebars ENGINE = MyISAM;
ALTER TABLE sitealizer ENGINE = MyISAM;
ALTER TABLE tags ENGINE = MyISAM;
ALTER TABLE text_filters ENGINE = MyISAM;
ALTER TABLE triggers ENGINE = MyISAM;
ALTER TABLE users ENGINE = MyISAM;

Now What?

Change mytypo_production to your Typo database's name.

Save it as convert.sql

Run it via,

mysql -u root
source convert.sql

You will get a load of check messages and hopefully no errors or warnings. If all goes ok you should now be over to MyISAM.

Convert Typo MyISAM > InnoDB

use mytypo_production;
ALTER TABLE articles_tags ENGINE = INNODB;
ALTER TABLE blacklist_patterns ENGINE = INNODB;
ALTER TABLE blogs ENGINE = INNODB;
ALTER TABLE categories ENGINE = INNODB;
ALTER TABLE categorizations ENGINE = INNODB;
ALTER TABLE contents ENGINE = INNODB;
ALTER TABLE feedback ENGINE = INNODB;
ALTER TABLE notifications ENGINE = INNODB;
ALTER TABLE page_caches ENGINE = INNODB;
ALTER TABLE pings ENGINE = INNODB;
ALTER TABLE redirects ENGINE = INNODB;
ALTER TABLE resources ENGINE = INNODB;
ALTER TABLE schema_info ENGINE = INNODB;
ALTER TABLE sessions ENGINE = INNODB;
ALTER TABLE sidebars ENGINE = INNODB;
ALTER TABLE sitealizer ENGINE = INNODB;
ALTER TABLE tags ENGINE = INNODB;
ALTER TABLE text_filters ENGINE = INNODB;
ALTER TABLE triggers ENGINE = INNODB;
ALTER TABLE users ENGINE = INNODB;

Also...

Also make sure you Tune your MySQL Install...

And optimize the Tables,

Optimize Typo Tables

Posted by John
on Thursday, 27 December 2007

Quick article on Optimizing your Typo MySQL database, does take a bit and only works on MyISAM and BDB Tables.

mysql -u root
use mytypo_db;
show tables;

Now the beef;

optimize table articles_tags, blacklist_patterns, blogs, categories, categorizations, contents, feedback, notifications, page_caches, pings, redirects, resources, schema_info, sessions, sidebars, sitealizer, tags, text_filters, triggers, users;

Does take a while but should clean up your Typo 4.1.1 Database Tables.