Posted on November 11, 2010, 8:25 pm, by Rhys, under
DBA.
Just a quick one today as I’m always forgetting how to do this! I occasionally have to schedule server reboots to happen in the middle of the night. This is easily achieved by using the AT command in a command prompt window. The following example will schedule a server reboot for 3AM as a one-off [...]
Posted on November 5, 2010, 9:25 pm, by Rhys, under
DBA,
SQL Server.
I was in two minds about whether to blog about this as I’m sure many people know this already! What the hell! I’m not embarrassed to admit I don’t know everything. Even the most casual user of SSMS knows that you can drag any database, table or column from the object explorer to the editor. [...]
In a previous post I showed how you can collect information on what is held in the data cache. The data collected here was just a simple summary of how much space each database was consuming. While useful we will need more detailed information on what is inside the cache to get a proper handle [...]
I’m currently building a CMDB at work and I wanted to include a bit of performance data in the information collected. The data cache is probably the biggest consumer of memory within SQL Server so It makes sense to collect this for future analysis. As a start I’m gathering the amount of space each database [...]
Posted on September 23, 2010, 10:22 pm, by Rhys, under
DBA,
T-SQL.
I’ve noticed people before struggling using sp_rename with tables that aren’t in the default schema. Many people don’t use schemas, so there’s often confusion, when they finally do come across the need to rename a table belonging to another schema. Assuming the below ‘Suppliers’ table is in the users default schema (usually dbo) then the [...]
Posted on August 10, 2010, 8:36 pm, by Rhys, under
DBA,
MySQL.
Here’s a bash script that you can use to parse multiple MySQL Slow Query Log files, in one sweep, into something much more understandable. The script uses the handy utility mysqlsla so make sure this is in your path. mysqlsla parses, filters, analyzes and sorts MySQL slow, general, binary and microslow patched logs in order [...]
Posted on July 19, 2010, 10:24 pm, by Rhys, under
DBA,
MySQL.
I’m quite often jumping between MySQL and SQL Server so remembering the quirks and limitations of each system can be difficult. With MySQL, if you attempt to reference a temporary table more than once in the same query, you will encounter the following error; Error Code : 1137 Can’t reopen table: ‘t1’ The following provides [...]
Posted on July 14, 2010, 9:47 pm, by Rhys, under
DBA,
MySQL.
I’ve previously blogged about the limitations of MySQL Alter Procedure Syntax and I came across a thread on the MySQL forums with a possible solution. I thought it might be handy to wrap this up into a stored procedure akin to SQL Server’s sp_rename. This procedure will allow you to easily rename MySQL Stored Procedures [...]
Posted on July 12, 2010, 11:58 am, by Rhys, under
DBA,
MySQL.
From time-to-time you may need to manually purge binary logs on your MySQL slaves to free up a bit of disk space. We can achieve this by using the PURGE BINARY LOGS command from the MySQL command line client. MySQL advises the following procedure when purging these logs To safely purge binary log files, follow [...]
Posted on July 9, 2010, 1:08 pm, by Rhys, under
DBA,
MySQL.
If you encounter the following error when trying to create a partitioned table in MySQL Error Code : 1492 For RANGE partitions each partition must be defined Assuming you have defined your partitions then you probably have a syntax error. Take the following incorrect example. ?View Code MYSQLCREATE TABLE People ( PersonId INTEGER NOT NULL [...]