Categories: SQL, Useful Queries
May 1st, 2009
Apache: MaxClients of 1000 exceeds ServerLimit value of 256 servers.
Published on May 1st, 2009 @ 12:30:11 am , using 138 words, 12619 views
Our apache cluster was not able to serve all the requests so we need to raise MaxClients paramenter on each node. Unfortunatly the new value was exceeding the ServerLimit value so we had to raise it accordingly. Despite this on restart apache was again complaining that MaxClients was exceeding ServerLimit value:
# /etc/init.d/apache2 restart
* Forcing reload of web server (apache2)...
WARNING: MaxClients of 1000 exceeds ServerLimit value of 256 servers,lowering MaxClients to 256. To increase, please see the ServerLimitdirective.
These are the interesting lines in /etc/apache2/apache2.conf.
Can you see something wrong here? It was hard for me to figure out how to fix the problem!
StartServers 10 MinSpareServers 10 MaxSpareServers 20 MaxClients 1000 ServerLimit 1000 MaxRequestsPerChild 0
Here the right one.
The point is: ServerLimit must be put before MaxClients directive!
StartServers 10 MinSpareServers 10 MaxSpareServers 20 ServerLimit 1000 MaxClients 1000 MaxRequestsPerChild 0
Hope this help you!
April 16th, 2009
Load2Test by DBA InfoPower is a the best for MySQL load testing - they can record actual MySQL production traffic and replay it in staging multiple ways, like "as is", "load parallelization", "think time reduction", etc and generate performance issues root cause analysis on a spot.
I used it with number of my customers and it takes no time to do load testing and get analytics and root cause analysis back (like gathering slow-log data without any impact on a system and more), compare runs, etc
They are small startup that operates "under the radar". I got introduced to this product through the person who works there - and I really like the tool!!!
Load2Test official page - load2test.com
February 20th, 2009
SQL Server Management Studio - Null Values
Published on February 20th, 2009 @ 07:01:35 pm , using 34 words, 861 views
Enter null values
Problem: You want to enter a null value into a field using the "Open Table" view.
Solution: Press Ctrl + 0 (zero) with the field highlighted.
Works in Management Studio and Enterprise Manager.
February 20th, 2009
SQL Server 2005 - Cursor Example
Published on February 20th, 2009 @ 06:58:14 pm , using 47 words, 417 views
SQL Server 2005: Simple Cursor Example
DECLARE @id INT
DECLARE db_cursor CURSOR FOR
SELECT id From myTable
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @id
WHILE @@FETCH_STATUS = 0
BEGIN
-- do something
FETCH NEXT FROM db_cursor INTO @id
END
CLOSE db_cursor
DEALLOCATE db_cursor
February 20th, 2009
SQL Server 2005: Show Users / Disconnect Users
Published on February 20th, 2009 @ 06:53:07 pm , using 85 words, 702 views
Show Users
USE MASTER
SELECT * FROM sysprocesses WHERE dbid = DB_ID('dbname')
Disconnect Users
USE master
GO
DECLARE @dbname varchar(30), @spid varchar(10), @start datetime
SELECT @start = current_timestamp, @dbname = 'dbname'
-- Timeout after 5 mts
while(exists(Select * FROM sysprocesses WHERE dbid = db_id(@dbname)) AND
datediff(mi, @start, current_timestamp) < 5)
begin
DECLARE spids CURSOR FOR
SELECT convert(varchar, spid) FROM sysprocesses
WHERE dbid = db_id(@dbname)
OPEN spids
while(1=1)
BEGIN
FETCH spids INTO @spid
IF @@fetch_status < 0 BREAK
exec('kill ' + @spid)
END
DEALLOCATE spids
END
GO
January 27th, 2009
To find the key for your installed product perform the following steps:
1. Click Run
2. Type regedit and click enter
3. Navigate to the following, depending on your version:
CD KEY for SQL 2000.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\80\Registration
2005 comes "pre-licensed", but you might take a look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\Setup
May 21st, 2008
Oracle DB Hot Backup
Published on May 21st, 2008 @ 12:54:29 am , using 208 words, 408 views
Basic procedure for a hot backup
The following PL/SQL demonstrates how a hot backup is taken on Oracle:
for ts in tablespaces
alter tablespace $ts begin backup
for df in datafiles of $ts
cp $df $SAVE/$df
alter database datafile '$df' end backup
end
alter tablespace end backup
end
alter system switch logfile
alter database backup controlfile to trace
The second last step:
alter system switch logfile
Forces a checkpoint which in turn updates the datafile headers with a new SCN that is the same for all datafile headers.
Note: Online redo log files should never be backed up!
Differences while hot backup and normal db operation
If the database is hot backuped, the operation is different from normal db operation in only two ways:
When a database block is modified the first time since the backup started, the entire block is written to the online redo logs.
In normal operation, only the changed bytes are written.
The datafile headers are not updated with the SCN when a checkpoint is performed.
Prerequisites:
Two prerequisites must be met for hot backups to make sense:
1) The database must be in archive log mode
2) All archived redo logs since the last backup are available when a database must be recovered.
February 1st, 2008
Oracle Tablespaces in Backup Mode
Published on February 1st, 2008 @ 09:25:48 pm , using 95 words, 284 views
Small query to list Oracle tablespaces, that are in backup mode:
SELECT d.tablespace_name, b.time
FROM dba_data_files d, v$backup b
WHERE
d.file_id = b.FILE#
AND b.STATUS = 'ACTIVE';
#sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Tue May 20 05:08:20 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> connect / as sysdba
Connected.
SQL> SELECT d.tablespace_name, b.time
2 FROM dba_data_files d, v$backup b
3 WHERE
4 d.file_id = b.FILE#A
5 ND b.STATUS = 'ACTIVE';
TABLESPACE_NAME TIME
------------------------------ ---------
USERS 02-JAN-08
SYSAUX 02-JAN-08
UNDOTBS1 02-JAN-08
SYSTEM 02-JAN-08
EXAMPLE 02-JAN-08
SQL>
January 2nd, 2008
Unix Queries Helpful to DBA
Published on January 2nd, 2008 @ 12:35:21 am , using 25 words, 5042 views
List Oracle Listeners
pgrep -fl -u oracle 'tnslsnr'
List Oracle Databases
pgrep -fl -u oracle 'ora_pmon'
List Shadow Processes
pgrep -fl -u oracle 'LOCAL'
| Database Journal News |
|---|
|
September 3, 2010: Identifying and Eliminating the Dreaded Cartesian Product Cartesian Products usually don't provide useful information and often result in mistakes that can hurt your database developer career. Learn to spot Cartesian Joins and banish them from your SELECT queries forever. |
|
September 3, 2010: Top 9 SQL Server Developer Interview Questions The questions you may wish to ask or that will be asked during a SQL Server Developer interview will vary. Deanna Dicken shares the top 9 interview questions she asks when interviewing a potential SQL Server developer. |
|
September 2, 2010: Working with ADO.NET Data Service in a .NET Framework Client Application Learn how to consume and make use of the ADO.NET Data Service in a .NET Framework Client Application. This article demonstrates the process by creating a simple web application that uses an existing ADO.NET Data Service. |
|
September 2, 2010: Introduction to SQL Server Proactive Caching Arshad Ali explores Proactive Caching, available in SQL Server Analysis Services 2005 and later versions. Proactive Caching helps DBAs to better control the cube data automatic refresh frequency. Proactive Caching offers near real time data for reports, while at same time providing a query performance similar to MOLAP storage mode. |
|
September 1, 2010: Oracle Database 11g New Features for Table Partitioning Table partitioning is an option available to DBAs that can help them manage key database performance areas including i/o balancing, contention reduction, SQL statement performance improvements and even data availability. Oracle Database 11g adds some very powerful new table partitioning methods that can be implemented to help to achieve some of these goals. |
|
September 1, 2010: Microsoft Sync Framework Beefs Up Collaboration There is a growing trend to access applications that are not just confined to just the PC but also extend to the other usually connected devices such as mobile phones and Point-of-Sale terminals. Keeping data synchronized across different platforms is a difficult problem to solve and the Microsoft Sync Framework is Microsoft's solution to the problem. |
|
September 1, 2010: Top 5 Oracle Database PL/SQL Job Interview Questions It would be smart to brush up on your SQL when interviewing for a PL/SQL developer position. James Koopmann shares five questions that he has been asked when interviewing for both a DBA position and a PL/SQL developer position. |
|
August 31, 2010: Book Review: Access 2010 Programmer's Reference Back in June we evaluated four great Access 2010 books that had just been released. There's now another volume available written especially for programmers. Danny Lesandrini peeks inside to see if this book lives up to its name. |
|
August 31, 2010: Nine Steps to Troubleshooting SQL Server problems DBAs often have a need to identify why a problem has occurred, or is occurring in their SQL Server database. This article covers some of the tools you can use to look for clues, and the steps you might go through to help troubleshoot a SQL Server problem. |
|
August 30, 2010: CouchDB - The Open Source NoSQL Database CouchDB is a great example of forward-thinking technology that's worth a look even if you're not currently in need of a database solution. This article introduces you to CouchDB, showing you how to get started using this fascinating solution and even integrate it into your PHP website. |