<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Grab A Meat  (Learning Day by Day)</title>
	<atom:link href="http://grabameat.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://grabameat.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 18 Nov 2009 06:43:24 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='grabameat.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0216177140c5283fa51047f3fcddc375?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Grab A Meat  (Learning Day by Day)</title>
		<link>http://grabameat.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://grabameat.wordpress.com/osd.xml" title="Grab A Meat  (Learning Day by Day)" />
		<item>
		<title>MASTER Master Replication Tutorial</title>
		<link>http://grabameat.wordpress.com/2009/11/18/master-master-replication-tutorial/</link>
		<comments>http://grabameat.wordpress.com/2009/11/18/master-master-replication-tutorial/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 06:34:42 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[MYSQL DBA]]></category>
		<category><![CDATA[mysql master master replication]]></category>
		<category><![CDATA[mysql master replication]]></category>
		<category><![CDATA[Mysql Replication]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=176</guid>
		<description><![CDATA[from http://www.howtoforge.com/mysql_master_master_replication<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=176&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Slave_IO_State: Waiting for master to send event<br />
Master_Host: 192.168.16.4<br />
Master_User: replica<br />
Master_Port: 3306<br />
Connect_Retry: 60<br />
Master_Log_File: MASTERMYSQL01-bin.000009<br />
Read_Master_Log_Pos: 4</p>
<address> Relay_Log_File: MASTERMYSQL02-relay-bin.000015</address>
<p>Relay_Log_Pos: 3630<br />
Relay_Master_Log_File: MASTERMYSQL01-bin.000009<br />
Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes<br />
Replicate_Do_DB:<br />
Replicate_Ignore_DB:<br />
Replicate_Do_Table:<br />
Replicate_Ignore_Table:<br />
Replicate_Wild_Do_Table:<br />
Replicate_Wild_Ignore_Table:<br />
Last_Errno: 0<br />
Last_Error:<br />
Skip_Counter: 0<br />
Exec_Master_Log_Pos: 4<br />
Relay_Log_Space: 3630<br />
Until_Condition: None<br />
Until_Log_File:<br />
Until_Log_Pos: 0<br />
Master_SSL_Allowed: No<br />
Master_SSL_CA_File:<br />
Master_SSL_CA_Path:<br />
Master_SSL_Cert:<br />
Master_SSL_Cipher:<br />
Master_SSL_Key:<br />
Seconds_Behind_Master: 1519187</p>
<p>1 row in set (0.00 sec)</p>
<p>Above highlighted rows must be indicate related log files and  Slave_IO_Running and   Slave_SQL_Running: must be to YES.</p>
<h3>Step 6:</h3>
<p>On master 1:</p>
<p>mysql&gt; show master status;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| File                   | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|MysqlMYSQL01-bin.000008 |      410 | adam         |                  |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>The above scenario is for master-slave, now we will create a slave master scenario for the same systems and it will work as master master.</p>
<h3>Step 7:</h3>
<p>On Master2/Slave 1, edit my.cnf and master entries into it:</p>
<p>[mysqld]<br />
datadir=/var/lib/mysql<br />
socket=/var/lib/mysql/mysql.sock<br />
# Default to using old password format for compatibility with mysql 3.x<br />
# clients (those using the mysqlclient10 compatibility package).<br />
old_passwords=1<br />
server-id=2</p>
<p>master-host = 192.168.16.4<br />
master-user = replication<br />
master-password = slave<br />
master-port = 3306</p>
<p>log-bin                     #information for becoming master added<br />
binlog-do-db=adam</p>
<p>[mysql.server]<br />
user=mysql<br />
basedir=/var/lib</p>
<p>[mysqld_safe]<br />
err-log=/var/log/mysqld.log<br />
pid-file=/var/run/mysqld/mysqld.pid</p>
<h3>Step 8:</h3>
<p><strong></strong>Create a replication slave account on master2 for master1:</p>
<p>mysql&gt; grant replication slave on *.* to &#8216;<a href="mailto:replication%27@192.168.16.4" target="_blank">replication&#8217;@192.168.16.4</a> identified by &#8217;slave2&#8242;;</p>
<h3>Step 9:</h3>
<p><strong></strong>Edit my.cnf on master1 for information of its master.</p>
<p>[mysqld]<br />
datadir=/var/lib/mysql<br />
socket=/var/lib/mysql/mysql.sock</p>
<p># Default to using old password format for compatibility with mysql 3.x<br />
# clients (those using the mysqlclient10 compatibility package).<br />
old_passwords=1</p>
<p>log-bin<br />
binlog-do-db=adam<br />
binlog-ignore-db=mysql<br />
binlog-ignore-db=test</p>
<p>server-id=1<br />
#information for becoming slave.<br />
master-host = 192.168.16.5<br />
master-user = replication<br />
master-password = slave2<br />
master-port = 3306</p>
<p>[mysql.server]user=mysqlbasedir=/var/lib</p>
<p>[mysqld_safe]<br />
err-log=/var/log/mysqld.log<br />
pid-file=/var/run/mysqld/mysqld.pid</p>
<h3>Step 10:</h3>
<p>Restart both mysql master1 and master2.</p>
<p>On mysql master1:</p>
<p>mysql&gt; start slave;</p>
<p>On mysql master2:</p>
<p>mysql &gt; show master status;</p>
<p>On mysql master 1:</p>
<p>mysql&gt; show slave status\G;<br />
*************************** 1. row ***************************<br />
Slave_IO_State: Waiting for master to send event<br />
Master_Host: 192.168.16.5<br />
Master_User: replica<br />
Master_Port: 3306<br />
Connect_Retry: 60<br />
Master_Log_File: Mysql1MYSQL02-bin.000008<br />
Read_Master_Log_Pos: 410<br />
Relay_Log_File: Mysql1MYSQL01-relay-bin.000008<br />
Relay_Log_Pos: 445<br />
Relay_Master_Log_File: Mysql1MYSQL02-bin.000008<br />
Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes<br />
Replicate_Do_DB:<br />
Replicate_Ignore_DB:<br />
Replicate_Do_Table:<br />
Replicate_Ignore_Table:<br />
Replicate_Wild_Do_Table:<br />
Replicate_Wild_Ignore_Table:<br />
Last_Errno: 0<br />
Last_Error:<br />
Skip_Counter: 0<br />
Exec_Master_Log_Pos: 410<br />
Relay_Log_Space: 445<br />
Until_Condition: None<br />
Until_Log_File:<br />
Until_Log_Pos: 0<br />
Master_SSL_Allowed: No<br />
Master_SSL_CA_File:<br />
Master_SSL_CA_Path:<br />
Master_SSL_Cert:<br />
Master_SSL_Cipher:<br />
Master_SSL_Key:<br />
Seconds_Behind_Master: 103799<br />
1 row in set (0.00 sec)</p>
<p>ERROR:<br />
No query specified</p>
<p>Check for the hightlighted rows, make sure its running. Now you can create tables in the database and you will see changes in slave. <strong>Enjoy!!</strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/176/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=176&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/18/master-master-replication-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Best INNODB Configuration (my.cnf) file</title>
		<link>http://grabameat.wordpress.com/2009/11/11/best-innodb-configuration-my-cnf-file/</link>
		<comments>http://grabameat.wordpress.com/2009/11/11/best-innodb-configuration-my-cnf-file/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 19:22:26 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[innodb config]]></category>
		<category><![CDATA[innodb configuration]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[my.cnf configuration]]></category>
		<category><![CDATA[MySql Configuration]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=162</guid>
		<description><![CDATA[
[client]


port		= 3306
socket		= /var/run/mysqld/mysqld.sock


[mysqld_safe]


socket		= /var/run/mysqld/mysqld.sock
nice		= 0


[mysqld]


user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
language	= /usr/share/mysql/english
skip-external-locking
bind-address		= 192.168.2.200
key_buffer		= 16M
max_allowed_packet	= 16000M
thread_stack		= 128K
thread_cache_size	= 8
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
query_cache_limit       = 1M
query_cache_size  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=162&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre>
<h2>[client]</h2>

<span style="color:#ff0000;">
<h2>port		= 3306</h2>
<h2>socket		= /var/run/mysqld/mysqld.sock</h2>

</span>
<h2>[mysqld_safe]</h2>

<span style="color:#0000ff;">
<h2>socket		= /var/run/mysqld/mysqld.sock</h2>
<h2>nice		= 0</h2>

</span>
<h2>[mysqld]</h2>

<span style="color:#0000ff;">
<h2>user		= mysql</h2>
<h2>pid-file	= /var/run/mysqld/mysqld.pid</h2>
<h2>socket		= /var/run/mysqld/mysqld.sock</h2>
<h2>port		= 3306</h2>
<h2>basedir		= /usr</h2>
<h2>datadir		= /var/lib/mysql</h2>
<h2>tmpdir		= /tmp</h2>
<h2>language	= /usr/share/mysql/english</h2>
<h2>skip-external-locking</h2>
<h2>bind-address		= 192.168.2.200</h2>
<h2>key_buffer		= 16M</h2>
<h2>max_allowed_packet	= 16000M</h2>
<h2>thread_stack		= 128K</h2>
<h2>thread_cache_size	= 8</h2>
<h2>#max_connections        = 100</h2>
<h2>#table_cache            = 64</h2>
<h2>#thread_concurrency     = 10</h2>
<h2>query_cache_limit       = 1M</h2>
<h2>query_cache_size        = 1024M</h2>
<h2>innodb_buffer_pool_size=2048M</h2>
<h2>innodb_additional_mem_pool_size=400M</h2>
<h2>innodb_log_file_size=25M</h2>
<h2>innodb_log_buffer_size=80M</h2>
<h2>sort_buffer=512M</h2>
<h2>thread_concurrency=32</h2>
<h2>record_buffer=128M</h2>
<h2>query_cache_type=2</h2>
<h2>tmp_table_size=1G</h2>
<h2>#log		= /var/log/mysql/mysql.log</h2>
<h2>#log_slow_queries	= /var/log/mysql/mysql-slow.log</h2>
<h2>#long_query_time = 2</h2>
<h2>#log-queries-not-using-indexes</h2>
<h2>#server-id		= 1</h2>
<h2>#log_bin			= /var/log/mysql/mysql-bin.log</h2>
<h2>expire_logs_days	= 10</h2>
<h2>max_binlog_size         = 100M</h2>
<h2>#binlog_do_db		= include_database_name</h2>
<h2>#binlog_ignore_db	= include_database_name</h2>
<h2>#skip-innodb</h2>
<h2># chroot = /var/lib/mysql/</h2>
<h2>[mysqldump]</h2>
<h2>quick</h2>
<h2>quote-names</h2>
<h2>max_allowed_packet	= 16M</h2>

</span>
<h2>[mysql]</h2>

<span style="color:#0000ff;">
<h2>#no-auto-rehash	# faster start of mysql but no tab completition</h2>

</span>
<h2>[isamchk]</h2>

<span style="color:#0000ff;">
<h2>key_buffer		= 16M</h2>

</span><span style="color:#0000ff;">
<h2>* Turn off HyperThreading -- it tends to slow things down.</h2>

<span style="color:#ff0000;">
<h2>* key_buffer = 16M -- very small if you use any MyISAM. In which case, set it to 3000M. (It must not be bigger than 4G.) Since you are not using any MyISAM, leave it at 16M.</h2>
<h2>* query_cache_size = 1024M -- The bigger it is, the slower it runs. Suggest 200M.</h2>
<h2>* innodb_buffer_pool_size=2048M -- You have 16GB of RAM. Is it 'all' available to MySQL? If so, and you are using InnoDB exclusively, suggest 13G.</h2>
<h2>* If mixture of MyISAM and Innodb, adjust proportionally.</h2>
<h2>* InnoDB database with 1,7 GiB of data? Wasted your money on so much RAM.</h2>
<h2>* #log_slow_queries	= /var/log/mysql/mysql-slow.log</h2>
<h2>#long_query_time = 2</h2>
<h2>Do you have any control over the schema or queries? Perhaps not if you are using a canned product. If you did have control, I would recommend turning on the slowlog and using it to help tune things.</h2>
<h2>* #max_connections = 100 -- I don't know what the default is; keep an eye on max_used_connections. If you run out of connections set max_connections appropriately.</h2>
<h2>* #table_cache = 64 -- You can probably set this to something, then watch open_tables to see whether it needs to be bigger.</h2>
<h2>Executive summary: Your current settings are close to the best available.</h2>

</span></span></pre>
<h2>This is one of the Best Configuration file from MYSQL</h2>
<h2>ADMINISTRATION BIBLE BOOK.</h2>
<pre><span style="color:#0000ff;">
<h2>The configuration file supports options for multiple programs. Each program has its own directive,</h2>
<h2>which is a keyword in square brackets, such as [mysqld] or [client]. Here is a sample</h2>
<h2>configuration file from a production system:</h2>
<h2># The following options will be passed to all MySQL clients</h2>
<h2>[client]</h2>
<h2>port = 3306</h2>
<h2>socket = /var/lib/mysql/mysql.sock</h2>
<h2>[mysqld]</h2>
<h2>#this will prevent mysql from starting</h2>
<h2>port = 3306</h2>
<h2>socket = /var/lib/mysql/mysql.sock</h2>
<h2>datadir =/var/lib/mysql</h2>
<h2>log_slow_queries = /var/log/mysql/mysqld_slow-queries.log</h2>
<h2>long_query_time = 4</h2>
<h2>max_connections=200</h2>
<h2>max_connect_errors = 400</h2>
<h2>wait_timeout=7200</h2>
<h2>connect_timeout=10</h2>
<h2>key_buffer = 512M</h2>
<h2>tmp_table_size = 32M</h2>
<h2>max_heap_table_size = 32M</h2>
<h2>max_allowed_packet = 32M</h2>
<h2>table_cache = 1800</h2>
<h2>join_buffer_size = 8M</h2>
<h2>sort_buffer_size = 16M</h2>
<h2>read_buffer_size = 8M</h2>
<h2>read_rnd_buffer_size = 524288</h2>
<h2>myisam_sort_buffer_size = 256M</h2>
<h2>thread_cache_size = 384</h2>
<h2>bulk_insert_buffer_size = 8M</h2>
<h2>query_cache_limit = 4M</h2>
<h2>query_cache_size = 128M</h2>
<h2>query_cache_type = 1</h2>
<h2>362</h2>
<h2>MySQL Server Tuning 10</h2>
<h2>query_prealloc_size = 65536</h2>
<h2>query_alloc_block_size = 131072</h2>
<h2># Try number of CPU’s*2 for thread_concurrency</h2>
<h2>thread_concurrency = 4</h2>
<h2>#innodb configuration</h2>
<h2>innodb_data_home_dir = /mysql/data</h2>
<h2>innodb_data_file_path=ibdata1:200M:autoextend</h2>
<h2>innodb_log_group_home_dir = /mysql/data/data</h2>
<h2>innodb_log_arch_dir = /mysql/data/data</h2>
<h2>innodb_buffer_pool_size = 24576M</h2>
<h2>innodb_additional_mem_pool_size = 32M</h2>
<h2>innodb_log_file_size = 1024M</h2>
<h2>innodb_log_files_in_group = 2</h2>
<h2>innodb_log_buffer_size = 16M</h2>
<h2>innodb_flush_log_at_trx_commit = 1</h2>
<h2>innodb_lock_wait_timeout = 120</h2>
<h2>sync-binlog = 1</h2>
<h2>innodb_support_xa = 0</h2>
<h2>innodb_thread_concurrency = 128</h2>
<h2>innodb_file_per_table</h2>
<h2># binary logging is required for replication</h2>
<h2>log-bin=mysql-bin</h2>
<h2>max_binlog_size = 1024M</h2>
<h2>server-id = 4</h2>
<h2>slave-skip-errors = 1062</h2>
<h2>expire-logs-days = 7</h2>
<h2>[mysqldump]</h2>
<h2>quick</h2>
<h2>max_allowed_packet = 16M</h2>
<h2>[mysql.server]</h2>
<h2>user=mysql</h2>
<h2>group=mysql</h2>
<h2>basedir=/var/lib</h2>
<h2>[mysqld_safe]</h2>
<h2>nice = -5</h2>
<h2>open_files_limit = 8192</h2>
<h2>log-error=/var/log/mysql/mysqld.log</h2>
<h2>pid-file=/var/run/mysqld/mysqld.pid</h2>
<h2>The configuration file supports options for multiple programs. Each program has its own directive,which is a keyword in square brackets, such as [mysqld] or [client]. Here is a sampleconfiguration file from a production system:# The following options will be passed to all MySQL clients[client]port = 3306socket = /var/lib/mysql/mysql.sock[mysqld]#this will prevent mysql from startingport = 3306socket = /var/lib/mysql/mysql.sockdatadir =/var/lib/mysqllog_slow_queries = /var/log/mysql/mysqld_slow-queries.loglong_query_time = 4max_connections=200max_connect_errors = 400wait_timeout=7200connect_timeout=10key_buffer = 512Mtmp_table_size = 32Mmax_heap_table_size = 32Mmax_allowed_packet = 32Mtable_cache = 1800join_buffer_size = 8Msort_buffer_size = 16Mread_buffer_size = 8Mread_rnd_buffer_size = 524288myisam_sort_buffer_size = 256Mthread_cache_size = 384bulk_insert_buffer_size = 8Mquery_cache_limit = 4Mquery_cache_size = 128Mquery_cache_type = 1362MySQL Server Tuning 10query_prealloc_size = 65536query_alloc_block_size = 131072# Try number of CPU’s*2 for thread_concurrencythread_concurrency = 4#innodb configurationinnodb_data_home_dir = /mysql/datainnodb_data_file_path=ibdata1:200M:autoextendinnodb_log_group_home_dir = /mysql/data/datainnodb_log_arch_dir = /mysql/data/datainnodb_buffer_pool_size = 24576Minnodb_additional_mem_pool_size = 32Minnodb_log_file_size = 1024Minnodb_log_files_in_group = 2innodb_log_buffer_size = 16Minnodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 120sync-binlog = 1innodb_support_xa = 0innodb_thread_concurrency = 128innodb_file_per_table# binary logging is required for replicationlog-bin=mysql-binmax_binlog_size = 1024Mserver-id = 4slave-skip-errors = 1062expire-logs-days = 7[mysqldump]quickmax_allowed_packet = 16M[mysql.server]user=mysqlgroup=mysqlbasedir=/var/lib[mysqld_safe]nice = -5open_files_limit = 8192log-error=/var/log/mysql/mysqld.logpid-file=/var/run/mysqld/mysqld.pid</h2>

</span><span style="color:#0000ff;"><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="line-height:19px;white-space:normal;">
</span></span></span></pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=162&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/11/best-innodb-configuration-my-cnf-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>What to do when MySQL says skip-innodb is defined</title>
		<link>http://grabameat.wordpress.com/2009/11/10/what-to-do-when-mysql-says-skip-innodb-is-defined/</link>
		<comments>http://grabameat.wordpress.com/2009/11/10/what-to-do-when-mysql-says-skip-innodb-is-defined/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 23:03:39 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[MYSQL DBA]]></category>
		<category><![CDATA[mysql innodb]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=159</guid>
		<description><![CDATA[Are you seeing a MySQL error that says InnoDB support isn’t enabled, even though it is? This article explains why it happens and how to fix it.
The symptom
Suppose you call SHOW INNODB STATUS or another InnoDB-specific command and MySQL reports the following error:
“ERROR 1235 (42000): Cannot call SHOW INNODB STATUS because skip-innodb is defined”
Yet you search [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=159&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Are you seeing a MySQL error that says InnoDB support isn’t enabled, even though it is? This article explains why it happens and how to fix it.</p>
<h3>The symptom</h3>
<p>Suppose you call <code>SHOW INNODB STATUS</code> or another InnoDB-specific command and MySQL reports the following error:</p>
<p>“ERROR 1235 (42000): Cannot call SHOW INNODB STATUS because skip-innodb is defined”</p>
<p>Yet you search the MySQL configuration files and find that’s not true. And you know you have InnoDB tables, too. What’s going on?</p>
<p>As it turns out, the error message is a bit misleading. Many problems will cause this error message.</p>
<h3>Dig deeper</h3>
<p>If InnoDB says it’s disabled, it probably is. Look at a couple other things. Does <code>SHOW ENGINES</code> report InnoDB is disabled? How about <code>SHOW VARIABLES LIKE 'have_innodb'</code>? Try <code>SHOW TABLE STATUS</code> on an InnoDB table — are most columns <code>NULL</code>?</p>
<p>If so, you most likely have an InnoDB configuration error. Not that you’ve disabled it with <code>skip-innodb</code>, but there’s something wrong. If so, MySQL will still start, but the InnoDB storage engine, and tables that use it, will be disabled.</p>
<h3>One possible solution</h3>
<p>When this happened to me, it was a config file upgrade that I didn’t check carefully. The old directive for the InnoDB data file was as follows:</p>
<pre>innodb_data_file_path           = ibdata1:10M:autoextend</pre>
<p>When I upgraded the file, I changed it to</p>
<pre>innodb_data_file_path = ibdata1:10M:autoextend:max:128M</pre>
<p>That wouldn’t have been a problem, except the file was already larger than 128MB. This is a slightly hard error to catch sometimes, because it may not show up in your MySQL error log (it doesn’t on my Ubuntu laptop when I deliberately force the error to happen).</p>
<h3>A note of general caution</h3>
<p>For those of you who are new to InnoDB configuration and administration, be careful. InnoDB has to be told exactly what to do. If you do anything wrong, such as set the permissions wrong on InnoDB’s log or data files or directories, change the file sizes, or any of a bunch of other mistakes, it will be very unforgiving. It may even wipe your existing log and data files and replace them with new ones full of zeroes (yes, this will delete all your data).</p>
<p>The MySQL error log is your friend, but in many cases InnoDB doesn’t flush any output to it for a long time, so you might for example start MySQL and see “MySQL NOT started.” It might just be that InnoDB wasn’t shut down nicely and has to roll back transactions to get to a consistent state. If so, that information will show up in the log files, but it might take a Very Long Time.</p>
<h3>If you need help</h3>
<p>You can get help on the #mysql IRC channel, mailing lists, or just read the <a href="http://dev.mysql.com/doc/refman/5.0/en/index.html">MySQL manual</a>. I like the IRC channel best myself. It’s friendly and there are a lot of smart people there to answer your questions.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/159/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=159&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/10/what-to-do-when-mysql-says-skip-innodb-is-defined/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>My.CNF MYISAM Configuration File (Best Used One)</title>
		<link>http://grabameat.wordpress.com/2009/11/10/my-cnf-configuration-file-best-used-one/</link>
		<comments>http://grabameat.wordpress.com/2009/11/10/my-cnf-configuration-file-best-used-one/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 22:10:59 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[MySql Configuration]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=153</guid>
		<description><![CDATA[[mysqld]
 
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-innodb    # (if you don&#8217;t want to use INNODB Tables)
max_connections = 500
key_buffer = 16M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1024
thread_cache_size = 64
wait_timeout = 1800
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 32M
query_cache_type = 1

[mysqld_safe]
err-log=/var/log/mysqld.log
open_files_limit = 8192
[mysqldump]
 
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 64M
 
sort_buffer = 64M
read_buffer = 16M
write_buffer = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=153&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2><strong>[mysqld]</strong></h2>
<h2><strong> </strong><br />
<span style="color:#333399;"><span style="color:#0000ff;">datadir=/var/lib/mysql<br />
socket=/var/lib/mysql/mysql.sock<br />
skip-innodb    # <span style="color:#ff0000;">(if you don&#8217;t want to use INNODB Tables)</span><br />
max_connections = 500<br />
key_buffer = 16M<br />
myisam_sort_buffer_size = 64M<br />
join_buffer_size = 1M<br />
read_buffer_size = 1M<br />
sort_buffer_size = 2M<br />
table_cache = 1024<br />
thread_cache_size = 64<br />
wait_timeout = 1800<br />
connect_timeout = 10<br />
max_allowed_packet = 16M<br />
max_connect_errors = 10<br />
query_cache_limit = 1M<br />
query_cache_size = 32M<br />
query_cache_type = 1</span><br />
</span><br />
<strong>[mysqld_safe]</strong></h2>
<h2><span style="color:#800000;">err-log=/var/log/mysqld.log<br />
open_files_limit = 8192</span></h2>
<p><strong>[mysqldump]</strong><br />
<span style="color:#008000;"><strong> </strong></span></p>
<p><span style="color:#008000;"><strong>quick<br />
max_allowed_packet = 16M</strong></span></p>
<h2><strong>[myisamchk]</strong></h2>
<h2>key_buffer = 64M</h2>
<p><span style="color:#ff0000;"> </span></p>
<h2>sort_buffer = 64M</h2>
<h2>read_buffer = 16M</h2>
<h2>write_buffer = 16M</h2>
<h2>[mysql.server]</h2>
<h2>user=mysql</h2>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=153&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/10/my-cnf-configuration-file-best-used-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Asynchronous Query Executed</title>
		<link>http://grabameat.wordpress.com/2009/11/10/asynchronous-query-executed/</link>
		<comments>http://grabameat.wordpress.com/2009/11/10/asynchronous-query-executed/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 06:04:31 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[MYSQL DBA]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=148</guid>
		<description><![CDATA[       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=148&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div id="attachment_147" class="wp-caption alignnone" style="width: 831px"><a href="http://mysqldba.blogspot.com/"><img class="size-full wp-image-147" title="asynchronous query" src="http://grabameat.files.wordpress.com/2009/11/4090681457_d8a10f21ec_o.png?w=821&#038;h=593" alt="How is the asynchronous query executed? Lets take a look at the figure below." width="821" height="593" /></a><p class="wp-caption-text">How is the asynchronous query executed? Lets take a look at the figure below.</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=148&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/10/asynchronous-query-executed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>

		<media:content url="http://grabameat.files.wordpress.com/2009/11/4090681457_d8a10f21ec_o.png" medium="image">
			<media:title type="html">asynchronous query</media:title>
		</media:content>
	</item>
		<item>
		<title>MySql Database Replication</title>
		<link>http://grabameat.wordpress.com/2009/11/09/mysql-database-replication/</link>
		<comments>http://grabameat.wordpress.com/2009/11/09/mysql-database-replication/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 18:36:14 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Security]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[MYSQL DBA]]></category>
		<category><![CDATA[Mysql Replication]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=145</guid>
		<description><![CDATA[How To Set Up Database Replication In MySQL
Version 1.1
Author: Falko Timme &#60;ft [at] falkotimme [dot] com&#62;
Last edited: 01/14/2006
This tutorial describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=145&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:small;"><strong>How To Set Up Database Replication In MySQL</strong></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Version 1.1</span><br />
<span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Author: Falko Timme &lt;ft [at] falkotimme [dot] com&gt;</span><br />
<span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Last edited: 01/14/2006</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">This tutorial describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases are in sync. This is not a backup policy because an accidentally issued DELETE command will also be carried out on the slave; but replication can help protect against hardware failures though.</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">In this tutorial I will show how to replicate the database <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> from the master with the IP address <span style="font-family:'Courier New', Courier, mono;"><em>192.168.0.100</em></span> to a slave. Both systems (master and slave) are running <strong>Debian Sarge</strong>; however, the configuration should apply to almost all distributions with little or no modification.</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Both systems have MySQL installed, and the database <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> with tables and data is already existing on the master, but not on the slave.</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!</span></p>
<p>&nbsp;</p>
<h4><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:small;">1 Configure The Master</span></h4>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">First we have to edit <span style="font-family:'Courier New', Courier, mono;"><em>/etc/mysql/my.cnf</em></span>. We have to enable networking for MySQL, and MySQL should listen on all IP addresses, therefore we comment out these lines (if existant):</span></p>
<table border="1" cellspacing="0" cellpadding="2" width="90%" align="center" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>#skip-networking
#bind-address            = 127.0.0.1</pre>
</td>
</tr>
</tbody>
</table>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Furthermore we have to tell MySQL for which database it should write logs (these logs are used by the slave to see what has changed on the master), which log file it should use, and we have to specify that this MySQL server is the master. We want to replicate the database <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span>, so we put the following lines into <span style="font-family:'Courier New', Courier, mono;"><em>/etc/mysql/my.cnf</em></span>:</span></p>
<table border="1" cellspacing="0" cellpadding="2" width="90%" align="center" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>log-bin = /var/log/mysql/mysql-bin.log
binlog-do-db=exampledb
server-id=1</pre>
</td>
</tr>
</tbody>
</table>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Then we restart MySQL:</span></p>
<p>&nbsp;</p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">/etc/init.d/mysql restart</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Then we log into the MySQL database as <span style="font-family:'Courier New', Courier, mono;"><em>root</em></span> and create a user with replication privileges:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">mysql -u root -p<br />
Enter password:</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Now we are on the MySQL shell.</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">GRANT REPLICATION SLAVE ON *.* TO &#8217;slave_user&#8217;@'%&#8217; IDENTIFIED BY &#8216;&lt;some_password&gt;&#8217;; </span></em><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">(Replace <span style="font-family:'Courier New', Courier, mono;"><em>&lt;some_password&gt;</em></span> with a real password!)</span><span style="font-size:x-small;"><em><br />
FLUSH PRIVILEGES;</em></span></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Next (still on the MySQL shell) do this:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">USE exampledb;<br />
FLUSH TABLES WITH READ LOCK;<br />
SHOW MASTER STATUS;</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">The last command will show something like this:</span></p>
<table border="1" cellspacing="0" cellpadding="2" width="90%" align="center" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>+---------------+----------+--------------+------------------+
| File          | Position | Binlog_do_db | Binlog_ignore_db |
+---------------+----------+--------------+------------------+
| mysql-bin.006 | 183      | exampledb    |                  |
+---------------+----------+--------------+------------------+
1 row in set (0.00 sec)</pre>
</td>
</tr>
</tbody>
</table>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Write down this information, we will need it later on the slave!</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Then leave the MySQL shell:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;font-size:x-small;"><em>quit;</em></span></p>
<hr /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">There are two possibilities to get the existing tables and data from <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> from the master to the slave. The first one is to make a database dump, the second one is to use the</span> <span style="font-family:'Courier New', Courier, mono;font-size:x-small;"><em>LOAD DATA FROM MASTER;</em></span> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">command on the slave. The latter has the disadvantage the the database on the master will be <strong>locked</strong> during this operation, so if you have a large database on a high-traffic production system, this is not what you want, and I recommend to follow the first method in this case. However, the latter method is very fast, so I will describe both here.</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">If you want to follow the first method, then do this:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">mysqldump -u root -p&lt;password&gt; &#8211;opt exampledb &gt; exampledb.sql </span></em><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">(Replace <span style="font-family:'Courier New', Courier, mono;"><em>&lt;password&gt;</em></span> with the real password for the MySQL user <span style="font-family:'Courier New', Courier, mono;"><em>root</em></span>! <strong>Important:</strong> There is <strong>no</strong>space between <span style="font-family:'Courier New', Courier, mono;"><em>-p</em></span> and <span style="font-family:'Courier New', Courier, mono;"><em>&lt;password&gt;</em></span>!)</span></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">This will create an SQL dump of <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> in the file <span style="font-family:'Courier New', Courier, mono;"><em>exampledb.sql</em></span>. Transfer this file to your slave server!</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">If you want to go the <span style="font-family:'Courier New', Courier, mono;"><em>LOAD DATA FROM MASTER;</em></span> way then there is nothing you must do right now.</span></p>
<hr /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Finally we have to unlock the tables in <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span>:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">mysql -u root -p<br />
Enter password:<br />
UNLOCK TABLES;<br />
quit;</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Now the configuration on the master is finished. On to the slave&#8230;</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:small;"><strong>2 Configure The Slave</strong></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">On the slave we first have to create the database <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span>:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">mysql -u root -p<br />
Enter password:<br />
CREATE DATABASE exampledb;<br />
quit;</span></em></span></p>
<hr /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">If you have made an SQL dump of <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> on the master and have transferred it to the slave, then it is time now to import the SQL dump into our newly created <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> on the slave:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">mysql -u root -p&lt;password&gt; exampledb &lt; /path/to/exampledb.sql </span></em><span style="font-family:'Courier New', Courier, mono;"><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">(Replace <span style="font-family:'Courier New', Courier, mono;"><em>&lt;password&gt;</em></span> with the real password for the MySQL user <span style="font-family:'Courier New', Courier, mono;">root</span>! <strong>Important:</strong> There is <strong>no</strong> space between <em><span style="font-family:'Courier New', Courier, mono;">-p</span></em> and <span style="font-family:'Courier New', Courier, mono;"><em>&lt;password&gt;</em></span>!)</span></span></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">If you want to go the <span style="font-family:'Courier New', Courier, mono;"><em>LOAD DATA FROM MASTER;</em></span> way then there is nothing you must do right now.</span></p>
<hr /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Now we have to tell MySQL on the slave that it is the slave, that the master is <span style="font-family:'Courier New', Courier, mono;"><em>192.168.0.100</em></span>, and that the master database to watch is <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span>. Therefore we add the following lines to <span style="font-family:'Courier New', Courier, mono;"><em>/etc/mysql/my.cnf</em></span>:</span></p>
<table border="1" cellspacing="0" cellpadding="2" width="90%" align="center" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>server-id=2
master-host=192.168.0.100
master-user=slave_user
master-password=secret
master-connect-retry=60
replicate-do-db=exampledb</pre>
</td>
</tr>
</tbody>
</table>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Then we restart MySQL:</span></p>
<p><span style="font-size:x-small;"><em><span style="font-family:'Courier New', Courier, mono;">/etc/init.d/mysql restart</span></em></span></p>
<hr /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">If you have not imported the master <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> with the help of an SQL dump, but want to go the <span style="font-family:'Courier New', Courier, mono;"><em>LOAD DATA FROM MASTER;</em></span> way, then it is time for you now to get the data from the master <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span>:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">mysql -u root -p<br />
Enter password:<br />
LOAD DATA FROM MASTER;<br />
quit;</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">If you have <a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a> installed on the slave you can now check if all tables/data from the master <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> is also available on the slave <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span>.</span></p>
<hr /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Finally, we must do this:</span></p>
<p><span style="font-size:x-small;"><em><span style="font-family:'Courier New', Courier, mono;">mysql -u root -p<br />
Enter password:<br />
SLAVE STOP;</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">In the next command (still on the MySQL shell) you have to replace the values appropriately:</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">CHANGE MASTER TO MASTER_HOST=&#8217;192.168.0.100&#8242;, MASTER_USER=&#8217;slave_user&#8217;, MASTER_PASSWORD=&#8217;</span><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">&lt;some_password&gt;</span></em></span><span style="font-size:x-small;">&#8216;, MASTER_LOG_FILE=&#8217;mysql-bin.006&#8242;, MASTER_LOG_POS=183;</span></em></span></p>
<p>&nbsp;</p>
<ul>
<li><em><span style="font-family:'Courier New', Courier, mono;font-size:x-small;">MASTER_HOST</span></em> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">is the IP address or hostname of the master (in this example it is</span> <span style="font-family:'Courier New', Courier, mono;font-size:x-small;"><em>192.168.0.100</em></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">).</span></li>
<li><em><span style="font-family:'Courier New', Courier, mono;font-size:x-small;">MASTER_USER</span></em><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;"> is the user we granted replication privileges on the master.</span></li>
<li><em><span style="font-family:'Courier New', Courier, mono;font-size:x-small;">MASTER_PASSWORD</span></em> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">is the password of</span> <span style="font-family:'Courier New', Courier, mono;font-size:x-small;"><em>MASTER_USER</em></span> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">on the master.</span></li>
<li><em><span style="font-family:'Courier New', Courier, mono;font-size:x-small;">MASTER_LOG_FILE</span></em> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">is the file MySQL gave back when you ran</span> <span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">SHOW MASTER STATUS;</span></em></span> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">on the master.</span></li>
<li><em><span style="font-family:'Courier New', Courier, mono;font-size:x-small;">MASTER_LOG_POS</span></em> <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">is the position MySQL gave back when you ran</span> <span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">SHOW MASTER STATUS;</span></em></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;"> on the master.</span></li>
</ul>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">Now all that is left to do is start the slave. Still on the MySQL shell we run</span></p>
<p><span style="font-family:'Courier New', Courier, mono;"><em><span style="font-size:x-small;">START SLAVE;<br />
quit;</span></em></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:x-small;">That&#8217;s it! Now whenever <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> is updated on the master, all changes will be replicated to <span style="font-family:'Courier New', Courier, mono;"><em>exampledb</em></span> on the slave. Test it!</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=145&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/09/mysql-database-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Ramblings on MYSQL Administration</title>
		<link>http://grabameat.wordpress.com/2009/11/06/ramblings-on-mysql-administration/</link>
		<comments>http://grabameat.wordpress.com/2009/11/06/ramblings-on-mysql-administration/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 17:14:08 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[MYSQL DBA]]></category>
		<category><![CDATA[mysql performance]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=129</guid>
		<description><![CDATA[MY.CNF Configuration file
The configuration file supports options for multiple programs. Each program has its own directive, which is a keyword in square brackets, such as [mysqld] or [client]. Here is a sample configuration file from a production system: 
# The following options will be passed to all MySQL clients
[client]
 
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
#this will prevent mysql [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=129&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h1 style="text-align:center;"><strong><span style="color:#800000;"><span style="text-decoration:underline;">MY.CNF Configuration file</span></span></strong></h1>
<p><strong><span style="color:#800000;"><span style="font-weight:normal;">The configuration file supports options for multiple programs. Each program has its own directive, which is a keyword in square brackets, such as [mysqld] or [client]. Here is a sample configuration file from a production system: </span></span></strong></p>
<p><strong><span style="font-weight:normal;"># The following options will be passed to all MySQL clients</span></strong></p>
<p><strong><span style="font-weight:normal;"><span style="color:#0000ff;">[client]</span></span></strong></p>
<p><strong><span style="color:#0000ff;"> </span></strong></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">port = 3306</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">socket = /var/lib/mysql/mysql.sock</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">[mysqld]</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">#this will prevent mysql from starting</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">port = 3306</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">socket = /var/lib/mysql/mysql.sock</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">datadir =/var/lib/mysql</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">log_slow_queries = /var/log/mysql/mysqld_slow-queries.log</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">long_query_time = 4</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">max_connections=200</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">max_connect_errors = 400</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">wait_timeout=7200</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">connect_timeout=10</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">key_buffer = 512M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">tmp_table_size = 32M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">max_heap_table_size = 32M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">max_allowed_packet = 32M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">table_cache = 1800</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">join_buffer_size = 8M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">sort_buffer_size = 16M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">read_buffer_size = 8M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">read_rnd_buffer_size = 524288</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">myisam_sort_buffer_size = 256M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">thread_cache_size = 384</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">bulk_insert_buffer_size = 8M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">query_cache_limit = 4M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">query_cache_size = 128M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">query_cache_type = 1</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">362</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">MySQL Server Tuning 10</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">query_prealloc_size = 65536</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">query_alloc_block_size = 131072</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;"># Try number of CPU’s*2 for thread_concurrency</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">thread_concurrency = 4</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">#innodb configuration</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_data_home_dir = /mysql/data</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_data_file_path=ibdata1:200M:autoextend</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_log_group_home_dir = /mysql/data/data</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_log_arch_dir = /mysql/data/data</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_buffer_pool_size = 24576M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_additional_mem_pool_size = 32M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_log_file_size = 1024M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_log_files_in_group = 2</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_log_buffer_size = 16M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_flush_log_at_trx_commit = 1</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_lock_wait_timeout = 120</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">sync-binlog = 1</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_support_xa = 0</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_thread_concurrency = 128</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">innodb_file_per_table</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;"># binary logging is required for replication</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">log-bin=mysql-bin</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">max_binlog_size = 1024M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">server-id = 4</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">slave-skip-errors = 1062</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">expire-logs-days = 7</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">[mysqldump]</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">quick</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">max_allowed_packet = 16M</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">[mysql.server]</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">user=mysql</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">group=mysql</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">basedir=/var/lib</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">[mysqld_safe]</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">nice = -5</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">open_files_limit = 8192</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">log-error=/var/log/mysql/mysqld.log</span></span></p>
<p><span style="font-weight:normal;"><span style="color:#0000ff;">pid-file=/var/run/mysqld/mysqld.pid</span></span></p>
<p><span style="text-decoration:underline;"><br />
</span></p>
<p style="text-align:center;"><strong><span style="text-decoration:underline;">RAID<br />
</span><span style="font-weight:normal;">(Redundant Array of Independent Disks)</span></strong></p>
<p style="text-align:left;">Raid 0 (zero): Only One Copy of Data spread out into Multiple Disks. if One copy Lost all the Data is Lost.</p>
<p style="text-align:left;">Raid 1 : Two Disks Mirrored if one fails Other will Pickup.</p>
<p style="text-align:left;">Raid 5: Combines Three of more Disks.  Storage Capacity is Reduced by One Disk.</p>
<p style="text-align:left;">Raid 10: Combination of Raid 1 and 0 Storage Capacity &#8211; 50% Mirrored.</p>
<p style="text-align:center;">Linux:</p>
<p style="text-align:justify;">LVM: Logical Volume Manager: Which will Separate Log Files on a Different Server.</p>
<p style="text-align:center;"><strong><span style="text-decoration:underline;">File System</span></strong></p>
<p style="text-align:left;"><strong><span style="text-decoration:underline;">EXT 2: </span><span style="font-weight:normal;"> Good Perfoermance &amp; Slower Crash Recovery.</span></strong></p>
<p style="text-align:left;"><strong><span style="font-weight:normal;">EXT 3:  Good Performance over EXT2 Filer System.</span></strong></p>
<p style="text-align:left;"><strong><span style="font-weight:normal;">IBM JFS:  Fast Recovery After a file System Failure.</span></strong></p>
<p style="text-align:center;">
<p style="text-align:center;"><strong><span style="text-decoration:underline;">Tuning MYSQL Server</span></strong></p>
<p style="text-align:left;">Show Innodb Status: Which will show all the Status Information of Tables, Queries, Locks, Memory Usage, Memory Dumps, Cache, Flushed Transactions, Thread information Etc.</p>
<p style="text-align:left;">
<div id="_mcePaste"><span style="color:#ff9900;">show innodb status;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">=====================================</span></div>
<div id="_mcePaste"><span style="color:#ff0000;">091105 14:08:54 INNODB MONITOR OUTPUT</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">=====================================</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Per second averages calculated from the last 15 seconds</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;-</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">SEMAPHORES</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;-</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">OS WAIT ARRAY INFO: reservation count 107862, signal count 107846</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Mutex spin waits 0, rounds 9648346, OS waits 26394</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">RW-shared spins 140432, OS waits 70114; RW-excl spins 63, OS waits 54</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">TRANSACTIONS</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;&#8212;&#8212;&#8212;</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">Trx id counter 0 966751765</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">Purge done for trx&#8217;s n:o &lt; 0 966751662 undo n:o &lt; 0 0</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">History list length 13</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">LIST OF TRANSACTIONS FOR EACH SESSION:</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 2923674480</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 466090, query id 8924458 c-24-6-189-185.hsd1.ca.comcast.net 24.6.189.185 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">show innodb status</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 966751278, not started, process no 26454, OS thread id 2968963952</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 466080, query id 8921005 192.168.10.79 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 2946497392</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 466077, query id 8922846 75.7.48.50 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 966751530, not started, process no 26454, OS thread id 3021794160</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 465759, query id 8922979 192.168.10.78 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 3076823920</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 466068, query id 8920769 75.7.48.50 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 2943998832</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 466051, query id 8920551 75.7.48.50 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 2938555248</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 466021, query id 8920902 75.7.48.50 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 2938956656</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 465966, query id 8920351 192.168.10.79 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 3077024624</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 465757, query id 8921477 192.168.10.78 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 966751014, not started, process no 26454, OS thread id 2969365360</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 465566, query id 8921004 192.168.10.79 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 0, not started, process no 26454, OS thread id 2900405104</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 465514, query id 8902812 192.168.10.52 HTN</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">&#8212;TRANSACTION 0 966751013, not started, process no 26454, OS thread id 2944400240</span></div>
<div id="_mcePaste"><span style="color:#0000ff;">MySQL thread id 465472, query id 8919475 192.168.10.79 HTN</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8211;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">FILE I/O</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8211;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">I/O thread 0 state: waiting for i/o request (insert buffer thread)</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">I/O thread 1 state: waiting for i/o request (log thread)</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">I/O thread 2 state: waiting for i/o request (read thread)</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">I/O thread 3 state: waiting for i/o request (write thread)</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Pending normal aio reads: 0, aio writes: 0,</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">ibuf aio reads: 0, log i/o&#8217;s: 0, sync i/o&#8217;s: 0</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Pending flushes (fsync) log: 0; buffer pool: 0</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">86187 OS file reads, 11907 OS file writes, 10888 OS fsyncs</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">0.00 reads/s, 0 avg bytes/read, 1.47 writes/s, 0.47 fsyncs/s</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">INSERT BUFFER AND ADAPTIVE HASH INDEX</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Ibuf: size 1, free list len 60, seg size 62,</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">246 inserts, 246 merged recs, 39 merges</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Hash table size 34679, node heap has 4 buffer(s)</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">6.53 hash searches/s, 6.53 non-hash searches/s</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">LOG</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Log sequence number 5 2711071627</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Log flushed up to   5 2711071627</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Last checkpoint at  5 2711071627</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">0 pending log writes, 0 pending chkp writes</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">8299 log i/o&#8217;s done, 0.20 log i/o&#8217;s/second</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">BUFFER POOL AND MEMORY</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Total memory allocated 21219654; in additional pool allocated 1048576</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Dictionary memory allocated 2740496</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Buffer pool size   512</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Free buffers       1</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Database pages     507</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Modified db pages  0</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Pending reads 0</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Pending writes: LRU 0, flush list 0, single page 0</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Pages read 1127608, created 33, written 2585</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">0.00 reads/s, 0.00 creates/s, 1.20 writes/s</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Buffer pool hit rate 1000 / 1000</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">ROW OPERATIONS</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">0 queries inside InnoDB, 0 queries in queue</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">1 read views open inside InnoDB</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Main thread process no. 26454, id 2987748208, state: sleeping</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">Number of rows inserted 1553, updated 618, deleted 299, read 293174006</span></div>
<div id="_mcePaste"><span style="color:#ff9900;">0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 150.26 reads/s</span></div>
<div id="_mcePaste"><span style="color:#ff9900;"><strong><span style="color:#ff0000;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></strong></span></div>
<div id="_mcePaste"><span style="color:#ff9900;"><strong><span style="color:#ff0000;">END OF INNODB MONITOR OUTPUT</span></strong></span></div>
<div id="_mcePaste"><span style="color:#ff9900;"><strong><span style="color:#ff0000;">============================</span></strong></span></div>
<p><span style="color:#ff9900;"><span style="color:#000000;">SHOW VARIABLES: Displays all variables and the usage    ex: Show Global Variables Like &#8216;%tmp%/&#8217;</span></span></p>
<p><span style="color:#ff9900;"><span style="color:#000000;"> </span></span></p>
<p><span style="color:#800080;">By default, SHOW STATUS will show SESSION variables. This may or may not be your intention, so to avoid confusion, always specify GLOBAL or SESSION as a keyword.</span></p>
<p><span style="color:#ff9900;"><span style="color:#000000;"> </span></span></p>
<p><strong><span style="color:#800080;">mysql&gt; SHOW GLOBAL STATUS LIKE ’%tmp%’;</span></strong></p>
<p><span style="color:#800080;">+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;+</span></p>
<p><span style="color:#800080;">| Variable_name | Value |</span></p>
<p><span style="color:#800080;">+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;+</span></p>
<p><span style="color:#800080;">| Created_tmp_disk_tables | 2744623 |</span></p>
<p><span style="color:#800080;">| Created_tmp_files | 147344 |</span></p>
<p><span style="color:#800080;">| Created_tmp_tables | 5003238 |</span></p>
<p><span style="color:#800080;">+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;+</span></p>
<p><span style="color:#800080;"> </span></p>
<p><span style="color:#008000;">The SHOW VARIABLES can be used to determine the values of system variables. This is a very useful command when tuning a server. As with the SHOW STATUS command, it can use the LIKE modifier, and you should always specify GLOBAL or SESSION to avoid possible confusion. </span></p>
<p><span style="color:#008000;">If you wanted to see the global settings for temporary tables:</span></p>
<p><span style="color:#008000;"><strong>mysql&gt; SHOW GLOBAL VARIABLES LIKE ’%tmp\_%’;</strong></span></p>
<p><span style="color:#008000;">+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+</span></p>
<p><span style="color:#008000;">| Variable_name | Value |</span></p>
<p><span style="color:#008000;">+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+</span></p>
<p><span style="color:#008000;">| max_tmp_tables | 32 |</span></p>
<p><span style="color:#008000;">| tmp_table_size | 33554432 |</span></p>
<p><span style="color:#008000;">+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+</span></p>
<p><span style="color:#008000;">&#8220;max_tmp_tables&#8221;,&#8221;32&#8243;</span></p>
<p><span style="color:#008000;">&#8220;slave_load_tmpdir&#8221;,&#8221;/tmp&#8221;</span></p>
<p><span style="color:#008000;">&#8220;tmp_table_size&#8221;,&#8221;16777216&#8243;</span></p>
<p><span style="color:#008000;">&#8220;tmpdir&#8221;,&#8221;/tmp&#8221;</span></p>
<h1 style="text-align:center;"><span style="color:#000000;"><span style="text-decoration:underline;"><span style="color:#800000;">INNODB Performance Tuning  Parameters</span></span></span></h1>
<p>INNODB_BUFFER_POOL_SIZE : 70-80% memory can be allocated to Buffer Pool size, Set it to 12gb on a 16gb box.</p>
<p>INNODB_LOG_FILE_SIZE:  This Depends on your Recovery Speed but 256mb Seems to be a good balance between Reasonable Recovery and Good Time Performance.</p>
<p>INNODB_LOG_BUFFER_SIZE: This can be Set to the</p>
<p>INNODB_FLUSH_LOG_AT_TRX_COMMAND: Works good before Server Crashes.</p>
<p>INNODB_THREAD_CONCURRENCY: 8</p>
<p>INNODB_FLUSH_METHOD: O-Direct</p>
<p><span style="color:#008000;">INNODB_FILE_PER_TABLE: </span></p>
<p><span style="color:#008000;"><strong>Transaction Isolation: Read Committed: This Option has some performance Benefits especially in locking in 5.0 and Even more to come with MySQL 5.1 and Row Level Application</strong></span></p>
<p style="text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:#800000;">Application Tuning for INNODB:</span></span></strong></p>
<p><span style="color:#008000;">ERROR log:  Sql Daemon Start Stop, Critical Errors will be Logged in this Error Log File</span></p>
<p><span style="color:#008000;">Binary Log: Update, Delete, Insert,  Statements will be logged to Binary Log file.</span></p>
<p><span style="color:#008000;">General Query Log:  All Select Queries, general data retrieval queries will be recorded.</span></p>
<p><span style="color:#008000;">Slow Query Log:  Queries which are running slow and can be logged in to the file</span><span style="font-family:sans-serif;color:#202020;"><span style="line-height:25px;font-size:medium;">.<br />
<span style="color:#000000;font-family:Verdana, Arial, Helvetica, sans-serif;line-height:normal;font-size:small;"> </span></span></span></p>
<p><span style="color:#800080;">To activate the query log, simply place:<br />
</span><em><span style="color:#800080;">log-slow-queries = [slow_query_log_filename]</span></em><span style="color:#800080;"><br />
in your configuration file (my.cnf or my.ini), </span><em><span style="color:#800080;">slow_query_log_filename</span></em><span style="color:#800080;"> being the optional filename for your log file. If you don&#8217;t supply a filename, the default name will be used, which is the name of the host machine, with </span><em><span style="color:#800080;">-slow.log</span></em><span style="color:#800080;"> being appended.</span></p>
<p><span style="color:#800080;">The slow query log logs all queries that take longer than </span><em><span style="color:#800080;">long_query_time</span></em><span style="color:#800080;">, which is usually 10 seconds by default (more than long enough for a self-respecting query to complete). You can alter the long_query_time in the configuration file. The following example sets the time to 5 seconds:<br />
</span><em><span style="color:#800080;">set-variable = long_query_time = 5</span></em><span style="color:#800080;"><br />
The slow query log can also optionally log all queries that don&#8217;t use an index by placing the following in the configuration file:<br />
</span></p>
<p><em><span style="color:#800080;">log-long-format</span></em></p>
<p><span style="color:#008000;"><span style="color:#202020;font-family:sans-serif;line-height:25px;font-size:14px;"><strong><span style="color:#202020;font-family:sans-serif;font-style:normal;">s of MySQL 5.1.6, the destination can be a file or a table, or both</span><a style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;text-decoration:underline;color:blue;background-position:initial initial;" title="4.3.1. mysqld — The MySQL Server" href="http://dev.mysql.com/doc/refman/5.1/en/mysqld.html"><br />
mysqld</a></strong> with the <a style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;text-decoration:underline;color:blue;background-position:initial initial;" href="http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_log-slow-queries"><code class="option" style="color:#0e4075;font-size:13px;background-color:white;font-weight:normal;font-family:monospace, fixed;">--log-slow-queries[=<em><code style="color:#026789;font-size:13px;background-color:#cccccc;font-weight:normal;font-family:monospace, fixed;padding:1px;">file_name</code></em>]</code></a> option to enable the slow query log, and optionally use <a style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;text-decoration:underline;color:blue;background-position:initial initial;" href="http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_log-output"><code class="option" style="color:#0e4075;font-size:13px;background-color:white;font-weight:normal;font-family:monospace, fixed;">--log-output</code></a> to specify the log destination (as described in <a style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:transparent;text-decoration:underline;color:blue;background-position:initial initial;" title="5.2.1. Selecting General Query and Slow Query Log Output Destinations" href="http://dev.mysql.com/doc/refman/5.1/en/log-tables.html">Section 5.2.1, “Selecting General Query and Slow Query Log Output Destinations”</a>).</span></span></p>
<p><span style="color:#008000;"><span style="color:#202020;font-family:sans-serif;line-height:25px;font-size:14px;"><strong>Tee:  Turns on MYSQL Logging  to a specified file. ex: Tee / Filename,<br />
NoTee:  Will stop logging mysql.</strong></span></span></p>
<h2 style="text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:#800000;">Memory Storage Engine Configuration</span></span></strong></h2>
<p><span style="color:#800000;"><strong><span style="color:#ff0000;">max_heap_table_size:</span></strong> The Maximum size of memory tables is limited by the system variable, it has a default value of 16 mega bytes.</span></p>
<p><span style="color:#800000;"><strong><span style="color:#ff0000;">Init_File: </span> </strong>This can be used to specify a file to use to populate a memory table  when mysqld starts, for ex: the file may contain LOAD DATA INFILE Command.</span></p>
<p><span style="color:#008000;"><span style="color:#202020;font-family:sans-serif;line-height:25px;font-size:14px;"><strong>Maria Storage Engine is a Crash Safe Version of MYISAM.</strong></span></span></p>
<h1 style="text-align:center;"><span style="color:#008000;"><span style="color:#202020;font-family:sans-serif;line-height:25px;font-size:14px;"><strong><span style="color:#ff6600;"><span style="text-decoration:underline;">Overall MySQL Server Options</span></span></strong></span></span></h1>
<p><span style="color:#008000;"><span style="color:#202020;font-family:sans-serif;line-height:25px;font-size:14px;"><strong><span style="color:#ff6600;"> </span></strong></span></span></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<h2><span style="color:#800000;"><span style="font-weight:normal;font-size:medium;">
<p>&nbsp;</p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:12pt;font-family:&amp;">Overall MySQL Server Options</span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:8pt;font-family:&amp;">Option Name Global or</span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:small;"><span style="font-size:8.5pt;font-family:IndyCode;"><strong>memlock </strong></span><span style="font-size:8.5pt;font-family:&amp;"><strong>Global<br />
<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-weight:normal;font-size:small;"><span style="font-size:8.5pt;font-family:&amp;">Locks the </span><span style="font-size:8.5pt;font-family:IndyCode;">mysqld </span><span style="font-size:8.5pt;font-family:&amp;">daemon into server memory. While this can improve performance if the server <span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:&amp;">runs out of RAM, the </span><span style="font-size:8.5pt;font-family:IndyCode;">mysqld </span><span style="font-size:8.5pt;font-family:&amp;">daemon will crash.</span></span></span></span></strong></span></span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:8.5pt;font-family:&amp;"><span style="font-family:IndyCode;"><strong>sort_buffer_size = buffer_size</strong><br />
<span style="font-family:Optima, sans-serif;">Session Determines the amount of system memory allocated for SQL sorts. If this size is exceeded, the server will use hard drive space for sorting data.</span></span></span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:8.5pt;font-family:IndyCode;"><strong>thread_cache_size = num_of_threads</strong><br />
<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:&amp;">Global </span><span style="font-size:8.5pt;font-family:IndyCode;">mysqld </span><span style="font-size:8.5pt;font-family:&amp;">creates a cache of unused connection threads rather than destroying threads and creating new ones as need.</span></span></span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:8.5pt;font-family:IndyCode;"><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:IndyCode;"><strong>thread_concurrency = N </strong></span><span style="font-size:8.5pt;font-family:&amp;"><strong>Global</strong><br />
Only use on Solaris systems. This should typically be set to twice the number of CPUs. It should be tested carefully before using in production.</span></span></span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:8.5pt;font-family:IndyCode;"><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:IndyCode;"><strong>tmp_table_size </strong></span><span style="font-size:8.5pt;font-family:&amp;"><strong>Global</strong><br />
<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:&amp;">Both this and the </span><span style="font-size:8.5pt;font-family:IndyCode;">max_heap_table_size </span><span style="font-size:8.5pt;font-family:&amp;">setting are used to determine the maximum size allowed of an in-memory temporary table before it is converted to a MyISAM table. The smallest value <span style="line-height:12px;">for these two settings is the one utilized.</span></span></span></span></span></span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;text-align:center;"><strong><span style="color:#0000ff;">MOCA (MYSQL Optimal Configuration Architechture)</span></strong></p>
<pre><span style="font-size:8.5pt;font-family:IndyCode;"><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:&amp;"><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="font-size:8.5pt;font-family:&amp;"><span style="line-height:12px;">1)  /opt/Mysql/5.1.33           -------------- Software Installed at this Location
2) db01/mysql/mysql01/data --------  Data Directory
<span style="color:#000000;line-height:19px;white-space:normal;font-size:13px;">Db01/mysql/mysql01/binlogs    ------------- binary logs directory
Db01/mysql/mysql01/admin       ------------ main administration</span></span></span></span></span></span></span></pre>
<p>&nbsp;</p>
<p></span></span></h2>
<p>Db01/mysql/mysql01/Backups   &#8212;&#8212;&#8212;&#8212;  Backups<br />
Db01/mysql/mysql01/Trans        &#8212;&#8212;&#8212;&#8212;  Transaction Data Files<br />
Db01/mysql/mysql01/TransLogs  &#8212;&#8212;&#8212;-   Trans Log Files.</p>
<h1 style="text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:#000080;">Backup Strategies and Backup Procedures.<br />
</span></span></strong></h1>
<p><strong>Logical Backup: </strong>Taking Backup Online While Database is Running.</p>
<p><strong>Physical Backup: </strong> Taking Backup of Database Files or Disk Partitions: Occupies More Space.</p>
<p><strong>Full Backup: </strong> Taking Full Backup of Database.</p>
<p><strong>Incremental Backup: </strong> Taking Backups of the Database Since the last Backup.  You may take first full Backup and take Incremental Backups to Save Time. Once a Week full backup might be necessary.</p>
<p><strong>Consistent Backup:</strong> Taking Backup at an Exact Moment of Time, A Backup Process may take time to Complete<br />
<strong>HOT Backup:</strong> Taking Backup while Database is Running.<br />
<strong>Cold Backup:</strong> Taking Backup While Database is Offline.<br />
<strong>Point-in-Time-Restore:</strong> Restoring Backup for Certain Time and Date.</p>
<h1><strong><span style="text-decoration:underline;"><span style="color:#4b2e9d;">REPLICATION &#8211; - Configuring Slave Backup Server.</span></span></strong></h1>
<p>Restore Database and Execute a <strong>CHANGE MASTER </strong>Command to configure the Slave.<br />
<strong><br />
LOAD DATA FROM Master</strong> – Master to Slave.<br />
<strong>Grant Replication Slave on *.* to ‘Slave’ @ ‘Slave-host’ Identified by ‘Password’ ;</strong></p>
<p><strong> </strong></p>
<p><strong>2) Edit My.cnf   Configuration file and add the below line</strong></p>
<p><strong>[mysqld]<br />
Server-Id  =  1<br />
Log – bin = Slave_log</strong></p>
<p><strong> </strong></p>
<p><strong>Show Master Status;</strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong></p>
<p class="MsoNormal" style="text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:red;">PARTITIONING TABLES</span></span></strong></p>
<p class="MsoListParagraphCxSpFirst" style="text-indent:-.25in;"><span style="color:red;">1)<span style="font:7pt &amp;"> </span></span><span style="color:red;">Horizontal Partitioning : Partition tables horizontally as if 2 tables (table1 and table2) both are separated by a line. I) Archiving Old Data is a Common task in Horizontal Partitioning. Merge tables will be used to Partition Data Horizontally.</span></p>
<p class="MsoListParagraphCxSpLast" style="text-indent:-.25in;"><span style="color:red;">2)<span style="font:7pt &amp;"> </span></span><span style="color:red;">Vertical Partitioning: Partitioning table vertically using de-Normalization: A Customer Table will be devided into a two tables splitting customer Data Columns.</span></p>
<p class="MsoNormal" style="margin-left:.25in;"><span style="color:red;"> </span></p>
<p class="MsoNormal" style="margin-left:.25in;"><span style="color:red;"> </span></p>
<p class="MsoNormal" style="margin-left:.25in;text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:red;">Partition Algorithm in MYSQL</span></span></strong></p>
<p class="MsoListParagraphCxSpFirst" style="text-indent:-.25in;"><span style="color:red;">1)<span style="font:7pt &amp;"> </span></span><span style="color:red;">Range: Selects a Partition by Determining if the partition key is inside a Range of Values. An Example of Partition for all Rows based on Customer in Values less than 500,000 Can go into one partition and values greater than or Equal to go into another Partition.</span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="color:red;">Ex:</span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="color:red;"> Create TABLE INVOICES (ID,CLASS,DEPT) </span></p>
<p class="MsoListParagraphCxSpLast"><span style="color:red;">Partition by Range (To_Days (Entry_Date),</span></p>
<p></strong></p>
<p>&nbsp;</p>
<p><strong><span style="font-size:11pt;font-family:&amp;">Partition PO Values Less than (To_Days (‘2009-01-01)),<br />
Partition PO Values Less than (To_Days (‘2009-02-01)),<br />
Partition PO Values Less than (To_Days (‘2009-03-01)),<br />
Partition PO Values Less than (To_Days (‘2009-04-01)),<br />
Partition PO Values Less than (To_Days (‘2009-05-01)),<br />
Partition PO Values Less than MAXVALUE.</span></strong></p>
<p><strong><span style="font-size:11pt;font-family:&amp;"> </span></strong></p>
<p><strong></p>
<p class="MsoListParagraph" style="text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:#17365d;"><span style="color:#800080;">SHOW PLUGINS (all are active except ndbcluster);</span><span style="color:#800080;"> </span></span></span></strong></p>
<p><strong> </strong><strong> </strong><span style="color:#800080;"> </span></p>
<p></strong></p>
<p><strong><span style="font-size:11pt;"><span style="color:#800080;">B</span></span><span style="font-size:11pt;font-family:&amp;">inlog<br />
Partition<br />
CSV<br />
MEMORY<br />
InnoDB<br />
MyISAM<br />
MRG_MYISAM<br />
ndbcluster &#8211; DISABLED &#8211; needs to be downloaded and Installed in order to work.<br />
</span></strong></p>
<h1 style="text-align:center;"><strong><span style="text-decoration:underline;"><span style="color:#800000;">INNODB Row Level Locking</span></span></strong></h1>
<p><strong><span style="font-size:11pt;font-family:&amp;"><span style="font-family:verdana, arial, helvetica, sans-serif;font-weight:normal;line-height:23px;font-size:small;color:#202020;"></p>
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Advantages of row-level locking:</p>
<div class="itemizedlist" style="font-size:14px;">
<ul style="list-style-image:url('http://dev.mysql.com/common/img/list-orange-disc.png');list-style-type:initial;list-style-position:initial;margin:0 4px 8px 16px;padding:0;">
<li style="margin-bottom:5px;margin-left:8px;font-size:14px;line-height:14px;list-style-position:outside;list-style-image:none;list-style-type:disc;vertical-align:middle;">
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Fewer lock conflicts when different sessions access different rows</p>
</li>
<li style="margin-bottom:5px;margin-left:8px;font-size:14px;line-height:14px;list-style-position:outside;list-style-image:none;list-style-type:disc;vertical-align:middle;">
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Fewer changes for rollbacks</p>
</li>
<li style="margin-bottom:5px;margin-left:8px;font-size:14px;line-height:14px;list-style-position:outside;list-style-image:none;list-style-type:disc;vertical-align:middle;">
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Possible to lock a single row for a long time</p>
</li>
</ul>
</div>
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Disadvantages of row-level locking:</p>
<div class="itemizedlist" style="font-size:14px;">
<ul style="list-style-image:url('http://dev.mysql.com/common/img/list-orange-disc.png');list-style-type:initial;list-style-position:initial;margin:0 4px 8px 16px;padding:0;">
<li style="margin-bottom:5px;margin-left:8px;font-size:14px;line-height:14px;list-style-position:outside;list-style-image:none;list-style-type:disc;vertical-align:middle;">
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Requires more memory than page-level or table-level locks</p>
</li>
<li style="margin-bottom:5px;margin-left:8px;font-size:14px;line-height:14px;list-style-position:outside;list-style-image:none;list-style-type:disc;vertical-align:middle;">
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Slower than page-level or table-level locks when used on a large part of the table because you must acquire many more locks</p>
</li>
<li style="margin-bottom:5px;margin-left:8px;font-size:14px;line-height:14px;list-style-position:outside;list-style-image:none;list-style-type:disc;vertical-align:middle;">
<p style="font-size:14px;line-height:25px;font-family:sans-serif;display:block;max-width:720px;margin:0 0 10px;padding:0;">Slower than other locks if you often do <code class="literal" style="color:#026789;font-size:13px;background-color:white;font-weight:bold;font-family:monospace, fixed;">GROUP BY</code> operations on a large part of the data or if you must scan the entire table frequently</p>
</li>
</ul>
</div>
<p></span></span></strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=129&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/11/06/ramblings-on-mysql-administration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Restore SVN from Backup</title>
		<link>http://grabameat.wordpress.com/2009/10/06/restore-svn-from-backup/</link>
		<comments>http://grabameat.wordpress.com/2009/10/06/restore-svn-from-backup/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 00:05:21 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[cron job]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[svn restore]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=122</guid>
		<description><![CDATA[First of all ,
Create the Repository (don&#8217;t import any of your working copies or anything.. just the clean repository).
to Create a Repository issue the below command.
svnadmin create &#8211;fs-type fsfs /srv/svn/repos
if your Svn Backup is saved in  .tgz format i.e., backup.tgz then unzip it first using the command
tar -xvzf filename.gz
for ex: tar -xvzf 030001.tgz will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=122&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>First of all ,</p>
<p><strong>Create the Repository (don&#8217;t import any of your working copies or anything.. just the clean repository).</strong></p>
<p>to Create a Repository issue the below command.</p>
<p><strong>svnadmin create &#8211;fs-type fsfs /srv/svn/repos</strong></p>
<p>if your Svn Backup is saved in  .tgz format i.e., backup.tgz then unzip it first using the command</p>
<p><strong>tar -xvzf filename.gz</strong></p>
<p><strong>for ex: tar -xvzf 030001.tgz</strong> will unzip the file in your given location with a dumpfile as saved previously by the command script.</p>
<p>then run the below script to restore the Repository from Backup.</p>
<p><strong>svnadmin load       &lt; </strong></p>
<p>ex: #svnadmin load /srv/svn/repos &lt; /home/sree/Desktop/030001/dumpfile.txt</p>
<p>then the dumping process will start and dump all the revisions inside the Selected Folder.</p>
<p>check your repository before updating or committing any of your new files.</p>
<p>here are some of the external bash commands if you need for your directory removal  with some content in it.</p>
<p><strong>ex:  rm -rf repos  (will delete main folder and sub folders inside)</strong></p>
<p>if you have any issues please leave a comment.</p>
<h1><span style="color:#ff6600;"><strong>to set the Cron Job for SVN use the below commands</strong></span></h1>
<p><span style="color:#333399;">#crontab -l will list out all the cron jobs</span></p>
<p><span style="color:#333399;">#crontab -e    will edit the cron job file in VI Editor.</span></p>
<p><strong><span style="color:#008000;">&#8220;MAILTO=chava.sree@gmail.com&#8221;<br />
0 3 * * * /srv/svn/backup/inc_backup.sh</span></strong></p>
<p><span style="color:#333399;"><span style="color:#333399;">w</span>ill do incremental backups everyday.</span></p>
<p><span style="color:#333399;">this is the Reference URL  http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/</span></p>
<p>Thanks<br />
Sree.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=122&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/10/06/restore-svn-from-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Apache Server lock issue</title>
		<link>http://grabameat.wordpress.com/2009/09/24/apache-server-lock-issue/</link>
		<comments>http://grabameat.wordpress.com/2009/09/24/apache-server-lock-issue/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 20:36:39 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[apache webserver]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=119</guid>
		<description><![CDATA[Os: Fedora Linux
Webserver : Apache ver 2.1.2
Issue:
Figured out Apache Server is not running when i run the command &#8220;service httpd status&#8221;  until then i am running http://localhost/ in the browser which is working fine and unable to run any other programs 
and when i used this command &#8220;# service httpd status: i got the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=119&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Os: Fedora Linux<br />
Webserver : Apache ver 2.1.2</p>
<p>Issue:<br />
Figured out Apache Server is not running when i run the command &#8220;service httpd status&#8221;  until then i am running http://localhost/ in the browser which is working fine and unable to run any other programs </p>
<p>and when i used this command &#8220;# service httpd status: i got the below message </p>
<p>[root@hirodexdbserver ~]# service httpd status<br />
httpd dead but subsys locked</p>
<p>i thought it might be some locks issue and restarted the server </p>
<p>#service httpd restart     &#8211; i got the below error again.<br />
**********************<br />
[root@hirodexdbserver ~]# service httpd restart<br />
Stopping httpd:                                            [FAILED]<br />
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80<br />
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80<br />
no listening sockets available, shutting down<br />
Unable to open logs<br />
                                                           [FAILED]<br />
You have mail in /var/spool/mail/root<br />
[root@hirodexdbserver ~]# service httpd restart<br />
**********************</p>
<p><strong>Steps to Resolve the Issue<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong><br />
after figuring out and looking at my httpd.conf file and make sure the pid file is pointing to the right file</p>
<p><strong>PidFile run/httpd.pid</strong></p>
<p>and change the path here to<br />
go to <strong>/etc/rc.d/init.d/httpd</strong>  open this file<br />
and find the below line.</p>
<p><font color="red">pidfile=${PIDFILE-/var/run/httpd/httpd.pid}</font></p>
<p>to:<br />
<font color="blue">pidfile=${PIDFILE-/var/run/httpd.pid}</font></p>
<p>Restart the Apache Server </p>
<p># service httpd restart<br />
Stopping httpd:                                            [  OK  ]<br />
Starting httpd:                                            [  OK  ]</p>
<p>which should give you the above status.</p>
<p>hope this helps.</p>
<p>Thanks</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=119&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/09/24/apache-server-lock-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>SVN Backup Commands</title>
		<link>http://grabameat.wordpress.com/2009/09/16/svn-backup-commands/</link>
		<comments>http://grabameat.wordpress.com/2009/09/16/svn-backup-commands/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 01:02:02 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn backup]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=116</guid>
		<description><![CDATA[#!/bin/bash
echo “+++ Backing up subversion repositories”
NOW=`date +&#8221;%OH%M%S&#8221;`
cd backup
mkdir -p $NOW
svnadmin dump /srv/svn/repos &#62; $NOW/dumpfile.txt
tar cfpz $NOW.tgz $NOW .
rm -rf $NOW
echo “+++ Svn Backup Successfully Completed. Thank you”
http://bash.cyberciti.biz/backup/copy-all-local-files-to-remote-ftp-server-2/
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=116&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>#!/bin/bash</p>
<p>echo “+++ Backing up subversion repositories”<br />
NOW=`date +&#8221;%OH%M%S&#8221;`<br />
cd backup<br />
mkdir -p $NOW<br />
svnadmin dump /srv/svn/repos &gt; $NOW/dumpfile.txt<br />
tar cfpz $NOW.tgz $NOW .<br />
rm -rf $NOW<br />
echo “+++ Svn Backup Successfully Completed. Thank you”</p>
<p>http://bash.cyberciti.biz/backup/copy-all-local-files-to-remote-ftp-server-2/</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=116&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/09/16/svn-backup-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Subversion Backup &amp; Restore Automation</title>
		<link>http://grabameat.wordpress.com/2009/09/15/subversion-backup-automation/</link>
		<comments>http://grabameat.wordpress.com/2009/09/15/subversion-backup-automation/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 20:49:31 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=111</guid>
		<description><![CDATA[http://www.hacking-gurus.net/2009/04/26/subversion-backup-and-restore/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=111&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>BACKUP</strong></p>
<p># Subversion Repositories backup script</p>
<p># Please start configuring here<br />
svnbasedir=&#8221;/srv/svn&#8221;<br />
svnfullbkdir=&#8221;/srv/svn/backups/full&#8221; #Don&#8217;t put a trailing slash!<br />
logfile=&#8221;/srv/svn/backups/log.txt&#8221;<br />
tmpdir=&#8221;/tmp&#8221;</p>
<p># dont change below</p>
<p>#check if log file exists<br />
touch ${logfile}<br />
#redirect stdout and stderr to the logfile<br />
mkdir -p $(dirname ${logfile})<br />
exec &gt;&gt; ${logfile}<br />
exec 2&gt;&amp;1</p>
<p>echo &#8220;+++ Backing up subversion repositories&#8221;<br />
#Looks for dirs containing a file &#8220;format&#8221;, that&#8217;s not in the /db/ directory.<br />
#This seems to match the root of a SVN repo. YMMV<br />
repos=$(find $svnbasedir -name format  -a \! -path &#8216;*/db/*&#8217;  -printf &#8216;%h\n&#8217;)</p>
<p>#Make sure that our backup location exists<br />
mkdir -p ${svnfullbkdir}</p>
<p>for repo in $repos ; do<br />
	subpath=$(echo ${repo} | sed -e &#8220;s#${svnbasedir}/##&#8221;)<br />
	name=$(basename $subpath)<br />
	subpath=$(dirname $subpath)<br />
	echo &#8221;   $repo&#8221;<br />
	lastrev=$(svnlook youngest ${repo})</p>
<p>	mkdir -p ${svnfullbkdir}/${subpath}<br />
	svnadmin dump -q ${repo} &gt; ${svnfullbkdir}/${name}.dump<br />
	echo  &#8220;Dumping ${repo} to  ${name}.dump  \n&#8221; </p>
<p>done</p>
<p><strong>RESTORE</strong></p>
<p>#!/bin/sh<br />
# Subversion Repositories backup script</p>
<p># Please start configuring here</p>
<p>svnbasedir=&#8221;/svn/svn&#8221;<br />
svnfullbkdir=&#8221;/tmp/svn-dump&#8221; #Don&#8217;t put a trailing slash!<br />
svnincbkdir=&#8221;/subversion/backup/incremental&#8221;<br />
logfile=&#8221;/subversion/backup/log.txt&#8221;<br />
tmpdir=&#8221;/tmp&#8221;</p>
<p># dont change below</p>
<p>touch ${logfile}<br />
#redirect stdout and stderr to the logfile<br />
mkdir -p $(dirname ${logfile})<br />
exec &gt;&gt; ${logfile}<br />
exec 2&gt;&amp;1</p>
<p>echo &#8220;+++ Restoring subversion repositories &#8220;<br />
#Looks for subversion backup dumps taken before<br />
repos=$(find $svnfullbkdir -name &#8216;*.dump&#8217; )</p>
<p>mkdir -p ${svnbasedir}</p>
<p>for repo in $repos ; do</p>
<p>	dirname=${repo%.dump}<br />
	name=$(basename $dirname)<br />
	$curpath = &#8220;/svn/svn/&#8221;.${name}<br />
	echo &#8221; creating reposity ${name} at ${curpath} &#8220;<br />
	svnadmin create /svn/svn/${name}</p>
<p>	echo &#8221; loading ${repo} &#8220;<br />
	svnadmin load -q /svn/svn/${name} &lt; ${repo}</p>
<p>done</p>
<p>***** ANOTHER WAY OF BACKUP ***********</p>
<p>http://www.linuxquestions.org/questions/linux-server-73/svn-server-backup-574111/</p>
<p>incremental backup.. </p>
<p># svnadmin dump &#8211;incremental /srv/svn/repos | gzip -c &gt; /srv/svn/dumped.gz</p>
<p>Actual Code</p>
<p>#!/bin/bash</p>
<p>NOW=`perl -e &#8216;print time;&#8217;`<br />
cd /var/backup/svn<br />
mkdir $NOW<br />
svnadmin dump /opt/repositories.svn/CC &gt; $NOW/dumpfile.txt<br />
tar cfpz $NOW.tgz $NOW<br />
rm -rf $NOW</p>
<p>&#8230;then follow that up with another cronjob that does this:</p>
<p><strong>CRON JOB</strong></p>
<p>45 3 * * * for i in `find /var/backup -type f -mtime +2` ; do rm -f $i ; done</p>
<p>The first cronjob does a full dump of the svn database and then zips it. (We are paranoid, we only do full dumps of databases and database-like applications.) Later on after that&#8217;s complete, the nightly backup process runs and the full dump is taken as part of a daily backup to tape. The second cronjob deletes anything it finds in the /var/backup tree that&#8217;s older than two days. That way I know I have two days of backups on disk, and I can restore the full database from any day I have tape for.</p>
<p>How to Add a script to Cron Job.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=111&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/09/15/subversion-backup-automation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Code of Conduct for DBA&#8217;s</title>
		<link>http://grabameat.wordpress.com/2009/09/08/code-of-conduct-for-dbas/</link>
		<comments>http://grabameat.wordpress.com/2009/09/08/code-of-conduct-for-dbas/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 02:54:20 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=104</guid>
		<description><![CDATA[http://www.simple-talk.com/sql/database-administration/a-code-of-conduct-for-dbas/?utm_source=simpletalk&#38;utm_medium=email&#38;utm_content=CodeOfConduct20090908&#38;utm_campaign=SQL<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=104&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Despite the fact DBAs are protectors of an organization’s knowledge, and privy to much confidential information, there is no clearly defined set of rules and standards to help govern and guide their ethical conduct.  Brad McGehee, in an article based on a chapter from the second edition of his book <a style="text-decoration:none;color:#cc6633;" href="http://www.red-gate.com/products/SQL_Backup/offers/backup_how_to_become_exceptional_dba.htm?utm_source=simpletalk&amp;utm_medium=email&amp;utm_content=BradExceptionalDBA200909&amp;utm_campaign=sqlbackup">How to Become an Exceptional DBA</a>, discusses a Code of Conduct for DBAs. <span style="font-size:9pt;font-family:Arial, sans-serif;" lang="EN-GB">He advises on why such a code is required, the sort of topics it should contain, and how it might be enforced</span>. Much of this article has relevance for any IT professional.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Physicians, attorneys, accountants, engineers, realtors, and many other professionals have written guidelines designed to discourage misconduct and illegal activity, and to promote the ethical conduct of its members. In fact, according to the Sarbanes-Oxley act, all public companies in the United States are required to create and follow their own code of conduct.</p>
<p style="font-size:17px;margin-left:10px;font-family:Arial, Helvetica, sans-serif;text-align:left;border-right-width:medium;border-right-style:none;border-right-color:initial;padding-right:0;border-top-color:silver;border-top-width:2px;border-top-style:solid;font-weight:bold;float:right;padding-bottom:15px;line-height:15px;margin-right:10px;padding-top:10px;border-bottom-color:silver;border-bottom-width:1px;border-bottom-style:solid;">if, as a DBA, you<br />
identify criminal<br />
behavior within<br />
your organization,<br />
what do you do?</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">However, despite the fact that DBAs are essentially protectors of an organization&#8217;s knowledge, and privy to much confidential information, there are no clearly-defined set of rules, values, standards, and guidelines to help govern and guide their behavior.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">In this article, I define what a code of conduct is, explain how it can be useful to DBAs and the organizations they work for, and consider if and how it could be enforced. Finally, I offer my take on a &#8220;Code of Conduct&#8221; for the Exceptional DBA. Rather than be prescriptive, my goal is simply to offer advice to DBAs on how they might conduct themselves within the bounds of the professional responsibilities of their job.</p>
<h1 style="font-size:19px;margin-left:0;font-family:'Times New Roman', Times, serif;">What is a Code of Conduct?</h1>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Generally speaking, a code of conduct is a set of formal, written rules, policies, standards, guidelines, obligations, behaviors, expectations, and principles that are voluntarily adhered to by a group of people with similar goals, values, and responsibilities. While other definitions exist, this one will serve our purpose well enough, as we seek to define the standards of conduct to which a DBA should adhere, while carrying out their professional duties.</p>
<div style="margin-left:28.35pt;margin-right:0;border-color:initial initial initial gray;border-style:none none none solid;border-width:medium medium medium 2.25pt;padding:0 0 0 6pt;">
<p style="font-size:12px;margin-left:0;font-family:Arial, Helvetica, sans-serif;text-align:left;border:1px solid silver;padding:10px;"><strong>NOTE: </strong>For different perspectives on this topic from other IT professionals, you can explore these websites that contain Codes of Ethics: <a style="text-decoration:none;color:#cc6633;" href="http://www.acm.org/about/code-of-ethics">The Association for Computing Machinery&#8217;s (ACM</a>), or the <a style="text-decoration:none;color:#cc6633;" href="http://www.aitp.org/organization/about/ethics/ethics.jsp">Association of Information Technology Professionals (AITP)</a></p>
</div>
<h1 style="font-size:19px;margin-left:0;font-family:'Times New Roman', Times, serif;">How Can a Code of Conduct be Useful to DBAs?</h1>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">To many people, a &#8220;Code of Conduct&#8221; means one thing: more rules. Most DBAs, myself included, would consider themselves mature enough to make their own decisions and choices, and are naturally resistant to the idea of someone telling them what to do and how to do it.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If this is the case, then why have I written this article? Well, first, my intent is not to offer a set of rules that have to be followed but, instead, a set of guidelines that can be useful for DBAs who want to fully understand and appreciate the nature and scope of their duties and responsibilities. In other words, it is intended to be educational.</p>
<p style="font-size:17px;margin-left:10px;font-family:Arial, Helvetica, sans-serif;text-align:left;border-right-width:medium;border-right-style:none;border-right-color:initial;padding-right:0;border-top-color:silver;border-top-width:2px;border-top-style:solid;font-weight:bold;float:right;padding-bottom:15px;line-height:15px;margin-right:10px;padding-top:10px;border-bottom-color:silver;border-bottom-width:1px;border-bottom-style:solid;">It&#8217;s a sad fact that<br />
many organizations<br />
don&#8217;t fully understand<br />
and appreciate the<br />
true role of a DBA.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">At a fundamental level, most DBAs believe they understand what it means to behave &#8220;ethically&#8221;. In my experience, instances of willful negligence, or blatantly unethical behavior, are relatively scarce in our profession. However, there are many &#8220;grey&#8221; areas where a DBA, especially a less-experienced DBA, can find themselves unsure of where their responsibilities end, and how exactly they should respond to a potentially compromising situation.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">For example if, as a DBA, you identify criminal behavior within your organization, what do you do? Hopefully, your answer would be that you&#8217;d report it. However, is that the end of your responsibilities? What if the company you work for does not respond appropriately? What further action should you take, if any?</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">It&#8217;s a sad fact that many organizations don&#8217;t fully understand and appreciate the true role of a DBA. In their attempts to save money, they sometimes cut corners that can directly affect the integrity of their data, and so unwittingly place the guardians of their data in a difficult dilemma. If you find yourself in this situation then, hopefully, this code of conduct may help convince your organization of the importance of the role of the DBA, and the need to employ experienced DBAs to safeguard their business data. For example, if you are having difficulty convincing your manager to adhere to government regulation that affects the data you manage, then referring the manager to this Code of Conduct might be useful.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Perhaps above all else, the &#8220;Exceptional DBA&#8217;s Code of Conduct&#8221; can be a source of pride to all of us who choose to adhere to it, and give us more confidence that we are doing the best we can at our jobs.</p>
<h1 style="font-size:19px;margin-left:0;font-family:'Times New Roman', Times, serif;">How Should a Code of Conduct be Implemented and Enforced?</h1>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Whenever the topic of a &#8220;code of conduct&#8221; is discussed, one of the first questions to be asked is: how can it be enforced? After all, if the code is not enforced in any way then, it is argued, who is it benefiting? There is no straightforward answer to the question of how to enforce such a code, or even if it should be enforced, rather than be voluntary.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">One suggestion is that the code be enforced by an independent, professional organization, such as the ACM, AITP, or PASS. Anyone who fails to follow the established code of conduct could have their membership of the organization revoked. On the assumption that most businesses would regard membership of the organization a key requirement in their hiring process, then it could, in theory, prove an effective deterrent to malpractice.</p>
<p style="font-size:17px;margin-left:10px;font-family:Arial, Helvetica, sans-serif;text-align:left;border-right-width:medium;border-right-style:none;border-right-color:initial;padding-right:0;border-top-color:silver;border-top-width:2px;border-top-style:solid;font-weight:bold;float:right;padding-bottom:15px;line-height:15px;margin-right:10px;padding-top:10px;border-bottom-color:silver;border-bottom-width:1px;border-bottom-style:solid;">Again, any DBA who fails<br />
to follow the established<br />
code could have their<br />
certification rescinded.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Another suggestion is that organizations that offer DBA certifications, such as Microsoft, should enforce some code of conduct. Again, any DBA who fails to follow the established code could have their certification rescinded. Obviously, this would only be an effective measure for organizations that require certification as part of their terms of employment. On the other hand, if Microsoft were to attempt this, what about the Oracle and MySQL DBAs? Would they need a separate code that is tied to their certifications?</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Another option is to have a DBA Code of Conduct enforced on a per-organization basis. After all, many organizations already require their employers to abide by a &#8220;code of conduct,&#8221; often in the form of an employee handbook. Such a code could be expanded to incorporate conduct specific to DBAs. On the other hand, if a company creates a separate code of conduct for DBAs, wouldn&#8217;t it also have to create different codes of conducts for other job titles? Again, this is not a great solution.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">In light of the numerous complications of implementing and enforcing a DBA&#8217;s Code of Conduct, I suggest that following such a code, or not, is a personal choice on behalf of the individual DBA. As I noted earlier, I regard such as code as being primarily educational in nature, with the rewards for following it being a successful, rewarding, long-term, and satisfying career as a DBA. For those who choose not to follow it, well, who knows how their career will turn out? They might get lucky and survive over the long haul, but I doubt if they will ever fall into the Exceptional DBA category.</p>
<h1 style="font-size:19px;margin-left:0;font-family:'Times New Roman', Times, serif;">The Exceptional DBA&#8217;s Code of Conduct</h1>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">This section contains my suggestions for the core items that should comprise &#8220;The Exceptional DBA&#8217;s Code of Conduct&#8221;. My focus is on providing general guidelines that will help any DBA become more successful in their career.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">I won&#8217;t be so presumptuous as to imply that these guidelines are ideal or exhaustive, but they should hopefully get you thinking and be useful as a guide to you in your role as a DBA.</p>
<h2 style="font-size:17px;margin-left:20px;font-family:'Times New Roman', Times, serif;">Protection and Disclosure of Data</h2>
<ol>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs shall never intentionally do anything that contributes to the corruption or loss of an organization&#8217;s data. While this should be a no-brainer, I am including the obvious, just to cover all the bases.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Above all else, the DBA is the guardian, or protector, of an organization&#8217;s data. The responsibilities of the DBA in this regard include but are not limited to:
<ul style="margin-top:0;">
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Preventing data corruption (from applications, hardware, and people).</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Provide high data availability, as defined by the organization&#8217;s policy. Develop, and regularly test, a disaster recovery plan to minimize unexpected downtime, as defined by the organization&#8217;s policy.</li>
</ul>
</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs shall take all reasonable precautions to ensure that changes to a production server have no detrimental consequences. All proposed changes should be thoroughly tested on a test server prior to deployment to production.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs shall proactively take all the necessary steps to ensure that data can only be accessed by authorized users. This may include, but is not limited to: SQL Server security, Windows Authentication security, encryption, SQL injection attack prevention, auditing, or other such security policies, as defined by their organization.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs generally have full access to all the data in a database. This presents two important points:
<ul style="margin-top:0;">
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs shall only view data in a database if they need to access it to perform their job duties. For example, a DBA may need to access data to optimize a query or create a report. But if the DBA doesn&#8217;t need to access and view data for job-related tasks, then DBAs shall not snoop through the data for the sake of viewing it.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If, through the course of their required job duties, DBAs do view confidential data, DBAs shall not share any sensitive or confidential information with any unauthorized users.</li>
</ul>
</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs shall provide full cooperation with both inside and outside audits, providing truthful and factual information</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If the DBA learns that contractors, co-workers, or managers are making poor choices that could negatively affect the integrity or security of the organization&#8217;s data, then the DBA should notify the appropriate persons within their organization.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If a DBA discovers misuse of an organization&#8217;s data, then the DBA should report this behavior to the appropriate persons within their organization.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The DBA should maintain proper and complete documentation for all servers and processes for which he or she is responsible. The documentation should be of a form and standard that will allow a qualified peer to undertake the task, in the DBA&#8217;s absence. The DBA should never protect (hide) information from their organization that would prevent another person from easily taking over his or her position, should the need arise.</li>
</ol>
<h2 style="font-size:17px;margin-left:20px;font-family:'Times New Roman', Times, serif;">DBAs and the Law</h2>
<ol>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Often, the data under the care of a DBA is subject to laws and regulations of one or more governing bodies. The DBA shall become familiar with these laws and regulations, and adhere to them.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The DBA shall enforce all software licensing agreement with vendors, and notify the proper people in the organization if any breech is discovered.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If the DBA becomes aware of illegal activity within their organization, the DBA shall notify the proper people in their organization, or the appropriate law enforcement agency.</li>
</ol>
<h2 style="font-size:17px;margin-left:20px;font-family:'Times New Roman', Times, serif;">Dealing With Third-Parties</h2>
<ol>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs shall not accept gifts or favors from vendors if the purpose of the gift or favor is to influence, or to reward, the DBA&#8217;s choice of purchasing goods and services from the vendor. More specifically:</li>
</ol>
<ul style="margin-top:0;">
<li>
<ul style="margin-top:0;">
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The DBA shall proactively learn their organization&#8217;s policies about gifts, so they know what they can or cannot accept. For example, company policy might allow a vendor to take a DBA to dinner, or to receive a free gift at a conference or a user&#8217;s group meeting. On the other hand, an organization&#8217;s policy might limit the amount of the gift to a maximum value, such as $50.00.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The acceptance of a gift, even if allowed by the organization, should not influence the behavior of the DBA in regards to potential purchase of the vendor&#8217;s products and services.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Whenever a DBA purchases, or influences the purchase of goods or services, the DBA should only purchase those good or services because they are the ones that best meet the needs of the organization.</li>
</ul>
</li>
</ul>
<h2 style="font-size:17px;margin-left:20px;font-family:'Times New Roman', Times, serif;">General Conduct</h2>
<ol>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The DBA shall conduct himself, or herself, professionally in all relationships with the people they deal with on a daily basis, including managers, co-workers, vendors, and their &#8220;internal customers.&#8221; Favoritism and discrimination of any sort is to be avoided.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If a DBA makes a mistake, and all DBAs make a mistake at one time or another, the mistake should be fixed as soon as is practical, and the DBA should inform everyone who might be negatively affected by the mistake as soon as possible. In addition:
<ul style="margin-top:0;">
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Mistakes should never be covered up.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">DBAs should take full responsibility for all their decisions.</li>
</ul>
</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If a DBA has management responsibilities, the DBA should mentor those who need help accomplishing their objectives, and allow those with experience and enthusiasm to succeed and flourish within the environment he or she provides for them.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The DBA will do their job to the best of his or her ability, developing and implementing best practices as appropriate, to help ensure the smooth and successful operations of the organization&#8217;s databases.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">IT technology changes quickly. It is the responsibility of the DBA to proactively keep up on all technical areas that directly affect his or her job.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If the DBA has agreed to a SLA (Service Level Agreement) for the servers under their care, then they will abide by those agreements. If they are not technically able to abide by the agreed upon SLA (for whatever reason), the DBA needs to contact the SLA owner and work out how to resolve the problem.</li>
<li style="margin-top:0;font-size:12px;margin-bottom:3px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">Occasionally, the DBA may find that there is no established policy with regard to a particular aspect of their duties. For example, perhaps an organization doesn&#8217;t have a policy that defines the desired level of uptime, or that defines who can access what data. In areas where policies should be established (to ensure the protection and integrity of the organization&#8217;s data), but are not established, the DBA shall proactively identify the areas of need, make recommendations, and present them to the organization&#8217;s management so they can make appropriate decisions.</li>
</ol>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">It is impossible to provide advice to guide a DBA through every aspect of their duties and responsibilities as a DBA, and there are many &#8220;grey areas&#8221;. What does the DBA do when they notify the appropriate persons of an important issue that could negatively impact the organization&#8217;s data, and no action is taken to rectify the issue? Where do a DBA&#8217;s responsibilities end with regard to uncovering illegal activity within an organization? What does a DBA do when a cost-cutting measure means they feel they can&#8217;t fully adhere to their own code of conduct? These are all difficult question for any employee, not just a DBA.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">If you, as a DBA, feel &#8220;pressured&#8221; to do something you are uncomfortable doing, then the best advice I can give is to talk to people. In most cases, the first step is to tell your manager, co-worker, project manager, or whoever is causing the problem, that you feel uncomfortable with their request, action or inaction, and explain why. If they don&#8217;t want to listen, your next option is to escalate the issue to their manager. You may, or may not, receive management support for your case. If not, then you have to decide to &#8220;give in,&#8221; or to find another job.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">The key thing is that the DBA needs to keep cool and not take any rash action. Before making an important decision that could potentially hurt your career, talk over the issue with people you trust in order to get their feedback and input. Only take action once you have clearly and thoughtfully considered the consequences of your choices. This might mean keeping quiet and not making trouble, escalating the issue to higher levels of management, reporting a crime to an enforcement agency, or finding a new job.</p>
<h1 style="font-size:19px;margin-left:0;font-family:'Times New Roman', Times, serif;">Summary</h1>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">My goal in suggesting an &#8220;Exceptional DBA&#8217;s Code of Conduct&#8221; is to provide advice and guidance for those DBAs wanting to learn more about what it takes to become an Exceptional DBA. Is the code complete or perfect? Of course not. Consider it a working, educational document; it is certainly not intended to be an absolute set of rules that every DBA must always follow.</p>
<p style="font-size:12px;margin-left:20px;font-family:Arial, Helvetica, sans-serif;text-align:justify;">My hope is that it serves as a useful guide to the DBAs looking to navigate the &#8220;grey areas&#8221; and as a foundation for all those entering the profession with ambitions to become Exceptional DBAs.</p>
<div style="text-align:justify;"><span style="font-size:small;"><br />
</span></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=104&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/09/08/code-of-conduct-for-dbas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>MySql Creating Function Error. (Workaround Solution)</title>
		<link>http://grabameat.wordpress.com/2009/08/14/mysql-creating-function-error-workaround-solution/</link>
		<comments>http://grabameat.wordpress.com/2009/08/14/mysql-creating-function-error-workaround-solution/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 23:27:27 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[mysql function error]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=99</guid>
		<description><![CDATA[When I am trying to Create a Function in MySql Query Browser, I had the below error and want to get rid of it.. and found a solution, as
  ERROR 1418 (HY000) at line 253: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration
     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=99&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When I am trying to Create a Function in MySql Query Browser, I had the below error and want to get rid of it.. and found a solution, as</p>
<pre style="color:black;background-color:#f9f9f9;line-height:1.1em;border:1px dashed #2f6fab;padding:1em;">  ERROR 1418 (HY000) at line 253: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration
               and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)</pre>
<p>for the above error just set the below parameters in my.ini (for windows) and my.cnf (in linux) files to edit and add the below text.</p>
<p>in windows to edit the my.ini file go here c:/program files/mysql/mysql version5.4/bin/my.ini</p>
<p>in linux to edit the my.cnf file go here /etc/mysql/bin/my.cnf and add the below line to your config file.</p>
<pre style="color:black;background-color:#f9f9f9;line-height:1.1em;border:1px dashed #2f6fab;padding:1em;"> log_bin_trust_function_creators=1</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=99&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/08/14/mysql-creating-function-error-workaround-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Subversion Setup</title>
		<link>http://grabameat.wordpress.com/2009/07/29/subversion-setup/</link>
		<comments>http://grabameat.wordpress.com/2009/07/29/subversion-setup/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 00:59:30 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[apache configuration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=76</guid>
		<description><![CDATA[http://www.eukhost.com/forums/f15/how-install-subversion-svn-linux-server-vps-3737/

http://marcgrabanski.com/article/installing-subversion-on-apache


yum install subversion


yum install mod_dav_svn



Creating a User in Svn using the bash Command
1) htpasswd -cm users sam
2) htpasswd -cm users chava
3) htpasswd -cm users veera
Importing a Folder to Repository in Svn (to checkout for later use)
1) svn import -m "Initial Import" local-directory-projectX http://server-name/svn/projectX
2) 
follow this link to install subversion Server 1.4 on Linux Server with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=76&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre>http://www.eukhost.com/forums/f15/how-install-subversion-svn-linux-server-vps-3737/

http://marcgrabanski.com/article/installing-subversion-on-apache
<ol>
<li>
<div>yum install subversion</div>
</li>
<li>
<div>yum install mod_dav_svn</div>
</li>
</ol>
</pre>
<p>Creating a User in Svn using the bash Command</p>
<p>1) htpasswd -cm users sam<br />
2) htpasswd -cm users chava<br />
3) htpasswd -cm users veera</p>
<p>Importing a Folder to Repository in Svn (to checkout for later use)</p>
<p>1) <tt>svn import -m "Initial Import" <em>local-directory-projectX</em> http://server-name/svn/<em>projectX</em></tt></p>
<p><em>2) </em></p>
<p>follow this link to install subversion Server 1.4 on Linux Server with Apache WebServer Running</p>
<p>http://www.yolinux.com/TUTORIALS/LinuxSubversionAndTracServer.html</p>
<p>Create a Subversion repository using the FSFS database format: (as root)</p>
<ul>
<li><tt>mkdir /srv/svn/repos</tt></li>
<li><tt>svnadmin create --fs-type fsfs /srv/svn/repos</tt></li>
<li><tt>chown apache:apache -R  /srv/svn/repos</tt><br />
(The Apache web server running as user &#8220;apache&#8221; is the process owner          which will be interfacing with the Subversion repository.)</li>
<li>SELinux security attribute assignment: (Red Hat EL4+, Fedora 3+)<br />
<tt>restorecon -R /srv/svn/repos</tt></li>
</ul>
<p>Apache configuration file: <tt>/etc/httpd/conf.d/subversion.conf</tt></p>
<ul>
<li>This example performs no authentication:<br />
<table border="1" cellspacing="1" cellpadding="4" width="100%" bgcolor="#000000">
<tbody>
<tr bgcolor="#c0c0c0">
<td>
<pre>LoadModule dav_svn_module     modules/mod_dav_svn.so       <em><strong>- Required for Apache interface</strong></em>
LoadModule authz_svn_module   modules/mod_authz_svn.so     <em><strong>- Required for "per-directory" access control</strong></em>
&lt;Location /svn&gt;        <strong>- URL path in web browser after "http://domain.com/"</strong>
   DAV svn
   SVNPath /srv/svn/repos        <strong>- Local path on server filesystem</strong>
&lt;/Location&gt;</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>This example authenticates to a local Apache user password file: User logins and passwords have no connection to user accounts.<br />
<table border="1" cellspacing="1" cellpadding="4" width="100%" bgcolor="#000000">
<tbody>
<tr bgcolor="#c0c0c0">
<td>
<pre>LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
&lt;Location /svn&gt;
   DAV svn
   SVNPath /srv/svn/repos
   AuthType Basic
   AuthName "Subversion Repository"
   AuthUserFile /etc/httpd/conf/userpw
   require valid-user
&lt;/Location&gt;</pre>
</td>
</tr>
</tbody>
</table>
<p>Remove the line &#8220;require valid-user&#8221; to allow read-only access for unauthenticated users.</li>
</ul>
<p><strong><big>Importing Directory of Files Into Subversion:</big></strong></p>
<p>Subversion Repository on Server File system:</p>
<ul>
<li><tt>/srv/svn/repos</tt></li>
</ul>
<p>Import directory of files into Subversion:</p>
<ul>
<li>Local directory to import into Subversion:
<ul>
<li><tt><em>projectX</em>/trunk/...source code goes here...</tt></li>
<li><tt><em>projectX</em>/branches</tt></li>
<li><tt><em>projectX</em>/tags</tt></li>
</ul>
</li>
<li><tt>svn import -m "Initial Import" <em>local-directory-projectX</em> http://server-name/svn/<em>projectX</em></tt><br />
The import will create the new subdirectory branch &#8220;<em>projectX</em>&#8221; in the repository.</li>
</ul>
<p>Alternate directory creation method: (repository exists but the directories need to be generated)</p>
<ul>
<li><tt>svn mkdir -m"Initial creation of trunk directory" http://svn-server/svn/projectX/trunk</tt></li>
<li><tt>svn mkdir -m"Initial creation of branches directory" http://svn-server/svn/projectX/branches</tt></li>
<li><tt>svn mkdir -m"Initial creation of tags directory" http://svn-server/svn/projectX/tags</tt></li>
</ul>
<p>Browser view of a typical repository directory schema:</p>
<ul>
<li><tt>http://<em>svn-server</em>/svn/<em>projectX</em>/trunk</tt>: For the &#8220;HEAD&#8221;</li>
<li><tt>http://<em>svn-server</em>/svn/<em>projectX</em>/branches</tt>: For branches or &#8220;forks&#8221; in the code.</li>
<li><tt>http://<em>svn-server</em>/svn/<em>projectX</em>/tags</tt>: For tags identifying snapshots of milestones or significant releases.</li>
</ul>
<hr /><strong>Explanation of Subversion directories:</strong></p>
<ul>
<li><tt>/trunk</tt> : Contains the current development branch. New projects should be started here.</li>
<li><tt>/branches</tt> : A branch is just a special copy of the source tree within Subversion that started with a specific revision of the code.       A branch is created by using &#8220;svn copy&#8221; of the trunk to a branch i.e. <tt>/branch/name_of_branch_1.0</tt>.</li>
<li><tt>/branches/personal</tt> : Personal branches are for doing some work which you don&#8217;t want to have interfere with the main trunk until it is working or better defined.</li>
<li><tt>/tags</tt> : This is a ethod of bookmarking or taking a &#8220;snapshot&#8221; of some work in progress.</li>
<li><tt>/releases</tt> : This is similar to &#8220;tags&#8221; except that this version of the code makes it to production. Names used here should match product release names. i.e. version_1.1</li>
</ul>
<p><a name="NOCONTROLM"></a></p>
<hr />
<h4>Avoiding false diffs due to &#8220;^M&#8221; in a cross platform environment:</h4>
<p>The Microsoft development tools love to add a &#8220;^M&#8221; at the end of the line of every file they edit. This breaks UNIX shell script and causes many file difference tools to show a difference in a line of code. This can be avoided in a cross platform environment by telling Subversion that certain files (or all files) that no &#8220;^M&#8221;&#8217;s should be appended at the end of a line. The trigger in fact removes the &#8220;^M&#8221; when the file is checked in. It can also be removed using the command <tt>dos2unix</tt>.</p>
<p>Import files to support no &#8220;^M&#8221; carriage returns at the end of lines:<br />
(This sets file properties and creates a check-in trigger.)</p>
<ul>
<li>Remove &#8220;^M&#8221; from files: <tt>find <em>local-directory</em> -name "*.cpp" -exec dos2unix {} \;</tt></li>
<li>Upload directory of files into Subversion:<br />
<tt>svn import -m "Initial Import" <em>local-directory</em> http://<em>server-name</em>/svn/<em>projectX</em></tt></li>
<li>Checkout files from repository: <tt>svn co http://server-name/svn/<em>projectX</em>/trunk</tt><br />
This creates your local working directory under Subversion control.</li>
<li>Set file properties such that &#8220;^M&#8221; are removed during check-in if added:<br />
<tt>find ./ -name "*.cpp" -exec svn propset svn:eol-style LF {} \;</tt></li>
<li>Apply property changes to repository: <tt>svn ci -m "Apply LF properties" <em>local-directory</em></tt></li>
</ul>
<p>Note that the &#8220;propset&#8221; command must be used for new files added to the Subversion repository if they are to have these properties.</p>
<p>Users can also set this option in the file: <tt>$HOME/.subversion/config</tt></p>
<pre>..
...

[auto-props]
README = svn:eol-style=native
INSTALL = svn:eol-style=native
*.c = svn:eol-style=LF
*.cpp = svn:eol-style=LF
*.h = svn:eol-style=LF
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=native;svn:executable
*.txt = svn:eol-style=LF
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
Makefile = svn:eol-style=LF
*.html = svn:eol-style=LF
*.css = svn:eol-style=LF
*.java = svn:eol-style=LF
*.xml = svn:eol-style=LF
*.m4 = svn:eol-style=LF
*.pdf = svn:mime-type=application/pdf

...
..
<h4>Data repository dump:</h4>
<ul>
<li>Dump first entry to current:
 <tt>svnadmin dump /srv/svn/repos --revision 0:HEAD &gt; repos.dump</tt></li>
<li>Dump revision 625 to current:
 <tt>svnadmin dump /srv/svn/repos --revision 625:HEAD --incremental &gt; repos-625.dump</tt></li>

*************************************************************************************************************
</ul>

TROUBLESHOOTING SUBVERSION.
---------------------------

use the below path 

run the below commands first to make sure you are giving access to the repos folder.

use these vi commands to edit the file.

vi filename.

examples: http://www.cs.colostate.edu/helpdocs/vi.html

chown apache:apache -R /srv/svn/repos

restorecon -R /srv/svn/repos

edit this file and add the below script.

/etc/httpd/conf.d/svnserve.conf

enable these statements below

anon-access = read
auth-access = write

&lt;Location /svn&gt;
 DAV svn
 SVNPath /srv/svn/repos
 AuthType Basic
 AuthName "Subversion Repository"
 AuthUserFile /srv/svn/access/users
 require valid-user
&lt;/Location&gt;
<ul>
</ul>
</pre>
<p><em><br />
</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=76&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/29/subversion-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell Script Commands</title>
		<link>http://grabameat.wordpress.com/2009/07/27/shell-script-commands/</link>
		<comments>http://grabameat.wordpress.com/2009/07/27/shell-script-commands/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 19:04:23 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=73</guid>
		<description><![CDATA[Search for something in Linux
rpm -q -a &#124; grep mysql   (searches for mysql files)
rpm -q -l mysql          (lists out the path of mysql search string) 
Load Putty first and Connect to the Remote Host using Remote Username and Password
1) pwd : to locate the absolute [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=73&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Search for something in Linux</p>
<pre><strong><span style="color:#ff0000;">rpm -q -a | grep mysql   (searches for mysql files)
rpm -q -l mysql          (lists out the path of mysql search string) </span></strong></pre>
<p>Load Putty first and Connect to the Remote Host using Remote Username and Password</p>
<p>1) pwd : to locate the absolute path<br />
2) Ls -l   : list all the directory info.<br />
3) Ls : list all the directory info in wide format.<br />
4)  ./  : used to execute shell script files with &#8220;.sh&#8221; extension.<br />
5) cp : copy directory from one path to another<br />
6) cd .. : change directory just like any other Dos Directory.</p>
<p>htpasswd -m /etc/.svn-auth-file &lt;username&gt; &#8212; to create user account(must be root)  is to create a username and password from apache to use with Subversion.</p>
<p>http://marcgrabanski.com/article/installing-subversion-on-apache (subversion installation instructions).</p>
<p>actual path is    &#8221;htpasswd -m /srv/svn/access/users  username  (pressing enter will ask for password followed by password confirmation and will be saved into the access file.</p>
<p># service httpd restart<br />
(will restart the apache server).</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=73&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/27/shell-script-commands/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Database Security Model</title>
		<link>http://grabameat.wordpress.com/2009/07/24/database-security-model/</link>
		<comments>http://grabameat.wordpress.com/2009/07/24/database-security-model/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 17:43:20 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Security Model]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=69</guid>
		<description><![CDATA[http://database-programmer.blogspot.com/2009/02/comprehensive-database-security-model.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=69&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3><a href="http://database-programmer.blogspot.com/2009/02/comprehensive-database-security-model.html">A Comprehensive Database Security Model</a></h3>
<p>This week I am taking a bit of a departure. Normally I write about things I have already done, but this week I want to speculate a bit on a security model I am thinking of coding up. Basically I have been asking myself how to create a security model for database apps that never requires elevated privileges for code, but still allows for hosts sharing multiple applications, full table security including row level and column level security, and structural immunity to SQL injection.</p>
<h2>The Functional Requirements</h2>
<p>Let&#8217;s consider a developer who will be hosting multiple database applications on a server, sometimes instances of the same application for different customers. The applications themselves will have different needs, but they all boil down to this:</p>
<ul>
<li>Some applications will allow      surfers to join the site and create accounts for themselves, while others      will be private sites where an administrator must make user accounts.</li>
<li>Some applications will not      contain sensitive data, and so the site owner wants to send forgotten      passwords in email &#8212; which means the passwords must be stored in      plaintext. Other site owners will need heightened security that disallows      storing of passwords in plaintext.</li>
<li>In both cases, administrators      must of course be able to manage accounts themselves.</li>
<li>The system should be      structurally immune to SQL injection.</li>
<li>It must be possible to have      users with the same user id (&#8220;Sheilia&#8221;, &#8220;John&#8221;, etc.)      on multiple applications who are actually totally different people.</li>
<li>The application code must      never need to run at an elevated privelege level for any reason &#8212; not      even to create accounts on public sites where users can join up and      conduct transactions.</li>
<li>It must be possible for the      site owners or their agents to directly connect to the database at very      least for querying and possibly to do database writes without going      through our application.</li>
<li>Users with accounts on one      app must never be able to sign on to another app on the same server.</li>
</ul>
<p>These requirements represent the most flexible possible combination of demands that I have so far seen in real life. The question is, can they be met while still providing security? The model I&#8217;d like to speculate on today says yes.</p>
<h2>Informed Paranoia Versus Frightened Ignorance</h2>
<p>Even the most naive programmer knows that the internet is not a safe place, but all too often a lot of security advice you find is based on <em>frightened ignorance</em> and takes the form, &#8220;never do x, you don&#8217;t know what might happen.&#8221; If we are to create a strong security model, we have to do better than this.</p>
<p>Much better is to strive to be like a strong system architect, whose approach is based on <em>informed paranoia</em>. This hypothetical architect knows everybody is out to compromise his system, but he seeks a thorough knowledge of the inner workings of his tools so that he can engineer the vulnerabilities out as much as possible. He is not looking to write rules for the programmer that say &#8220;never do this&#8221;, he is rather looking to make it impossible for the user or programmer to compromise the system.</p>
<h2>Two Examples</h2>
<p>Let us consider a server hosting two applications, which are called &#8220;social&#8221; and &#8220;finance&#8221;.</p>
<p>The &#8220;social&#8221; application is a social networking site with minimal security needs. Most important is that the site owners want members of the general public to sign up, and they want to be able to email forgotten passwords (and we can&#8217;t talk them out of it) &#8212; so we have to store passwords in plaintext.</p>
<p>The &#8220;finance&#8221; application is a private site used by employees of a corporation around the world. The general public is absolutely not welcome. To make matters worse however, the corporation&#8217;s IT department demands to be able to directly connect to the database and write to the database without going through the web app. This means the server will have an open port to the database. Sure it will be protected with SSL and passwords, but we must make sure that only users of &#8220;finance&#8221; can connect, and only to their own application.</p>
<h2>Dispensing With Single Sign-On</h2>
<p>There are two ways to handle connections to a database. One model is to give users real database accounts, the other is to use a single account to sign on to the database. Prior to the web coming along, there were proponents of both models in the client/server world, but amongst web developers the single sign-on method is so prevalent that I often wonder if they know there is any other way to do it.</p>
<p>Nevertheless, we must dispense with the single sign-on method at the start, regardless of how many people think that Moses carved it on the third tablet, because it just has too many problems:</p>
<ul>
<li>Single Sign-on <strong>is the primary architectural      flaw that makes SQL injection possible</strong>. As we will see later, using      real database accounts makes your site (almost) completely immune to SQL      injection.</li>
<li>Single Sign-on requires a      connection at the maximum privilege level that any system user might have,      where the code then decides what it will let a particular user do. This is      a complete violation of the requirement that code always run at the lowest      possible privilege level.</li>
<li>Single Sign-on totally      prevents the requirement that authorized agents be allowed to connect to      the database and directly read and write values.</li>
</ul>
<p>So single sign-on just won&#8217;t work with the requirements listed. This leads us to creating real accounts on the database server.</p>
<h2>Real Accounts and Basic Security</h2>
<p>When you use a real database account, your code connects to the database using the username and password provided by the user. Anything he is allowed to do your code will be allowed to do, and anything he is not allowed to do will throw and error if your code tries to do it.</p>
<p>This approach meets quite a few of our requirements nicely. A site owner&#8217;s IT department can connect with the same accounts they use on the web interface &#8212; they have the same privileges in both cases. Also, there is no need to ever have application code elevate its privilege level during normal operations, since no regular users should ever be doing that. This still leaves the issue of how to create accounts, but we will see that below.</p>
<p>A programmer who thinks of security in terms of <em>what code can run</em> will have a very hard time wrapping his head around using real database accounts for public users. The trick to understanding this approach is to forget about code for a minute and to think about tables. The basic fact of database application security is that <em>all security resolves to table permissions</em>. In other words, our security model is all about who can read or write to what tables, it is not about who can run which program.</p>
<p>If we grant public users real database accounts, and they connect with those accounts, the security must be handled within the database itself, and it comes down to:</p>
<ul>
<li>Defining &#8220;groups&#8221;      as collections of users who share permissions at the table level.</li>
<li>Deciding which groups are      allowed select, insert, update, and delete privileges on which tables.</li>
<li>Granting and revoking those      privileges on the server itself when the database is built.</li>
<li>At very least row-level      security will be required, wherein a user can only see and manipulate      certain rows in a table. This is how you keep users from using SQL      Injection to mess with each other&#8217;s order history or member profiles.</li>
<li>Column security is also very      nice to finish off the picture, but we will not be talking about that      today as it does not play into the requirements.</li>
</ul>
<p>Now we can spend a moment and see why this approach eliminates most SQL Injection vulnerabilities. We will imagine a table of important information called SUPERSECRETS. If somebody could slip in a SQL injection exploit and wipe out this table we&#8217;d all go to jail, so we absolutely cannot allow this. Naturally, most users would have no privileges on this table &#8212; even though they are directly connected to the database they cannot even see the table exists, let alone delete from it. So if our hypothetical black hat somehow slips in &#8220;;delete from supersecrets&#8221; and our code fails to trap for it, nothing happens. They have no privlege on that table. On the other side of things, consider the user who is privileged to delete from that table. If this user slips in a &#8220;;delete from supersecrets&#8221; he is only going to the trouble with SQL Injection <em>to do something he is perfectly welcome to do anyway through the user interface.</em> So much for SQL injection.</p>
<p>To repeat a point made above: row-level security is a must. If you grant members of a social site global UPDATE privileges on the PROFILES table, and you fail to prevent a SQL Injection, all hell could break loose. Much better is the ability to limit the user to seeing only his own row in the PROFILE table, so that once again you have created a structural immunity to SQL injection.</p>
<h2>Anonymous Access</h2>
<p>Many public sites allow users to see all kinds of information when they are not logged on. The most obvious example would be an eCommerce site that needs read access to the ITEMS table, among others. Some type of anonymous access must be allowed by our hypothetical framework.</p>
<p>For our two examples, the &#8220;social&#8221; site might allow limited viewing of member profiles, while the &#8220;finance&#8221; application must show absolutely nothing to the general public.</p>
<p>If we want a general solution that fits both cases, we opt for a <em>deny-by-default</em> model and allow each application to optionally have an anonymous account.</p>
<p>First we consider deny-by-default. This means simply that our databases are always built so that no group has any permissions on any tables. The programmer of the &#8220;social&#8221; site now has to grant certain permissions to the anonymous account, while the programmer of the &#8220;finance&#8221; application does nothing &#8211; he already has a secure system.</p>
<p>But still the &#8220;finance&#8221; site is not quite so simple. An anonymous user account with no privileges <em>can still log in</em>, and that should make any informed paranoid architect nervous. We should extend the deny-by-default philosophy so the framework will not create an anonymous account unless requested. This way the programmer of the &#8220;finance&#8221; application still basically does nothing, while the programmer of the &#8220;social&#8221; must flip a flag to create the anonymous account.</p>
<h2>Virtualizing Users</h2>
<p>If we are having real database accounts, there is one small detail that has to be addressed. If the &#8220;social&#8221; site has a user &#8220;johnsmith&#8221; and the finance application has a user of the same name, but they are totally different people, we have to let both accounts exist but be totally separate.</p>
<p>The answer here is to alias the accounts. The database server would actually have accounts &#8220;finance_johnsmith&#8221; and &#8220;social_johnsmith&#8221;. Our login process would simply take the username provided and append the code in front of it when authenticating on the server. &#8216;nuf said on that.</p>
<h2>Allowing Public Users To Join</h2>
<p>The &#8220;social&#8221; site allows anybody to join up and create an account. This means that somehow the web application must be able to create accounts on the database server. Yet it must do this without allowing the web code to elevate its privileges, and while preventing the disaster that would ensue if a user on the &#8220;social&#8221; site somehow got himself an account on the &#8220;finance&#8221; site.</p>
<p>Believe it or not, this is the easy part! Here is how it works for the &#8220;social&#8221; site:</p>
<ul>
<li>Create a table of users. The      primary key is the user_id which prevents duplication.</li>
<li>For the social site, there is      a column called PASSWORD that stores the password in plaintext.</li>
<li>Allow the anonymous account      to INSERT into this table! (Remember though that deny-by-default means      that so far this account has no other privileges).</li>
<li>Put an INSERT trigger on the      table that automatically creates an aliased user account, so that      &#8220;johnsmith&#8221; becomes &#8220;social_johnsmith&#8221;. The trigger      also sets the password.</li>
<li>A DELETE trigger on the table      would delete users if the row is deleted.</li>
<li>An UPDATE trigger on the      table would update the password if the user UPDATES the table.</li>
<li>Row level security is an      absolute must. Users must be able to SELECT and UPDATE table, but only      their own row. If your database server or framework cannot support      row-level security, it&#8217;s all out the window.</li>
</ul>
<p>This gives us a system that almost gets us where we need to be: the general public can create acounts, the web application does not need to elevate its privileges, users can set and change their passwords, and no user can see or set anything for any other user. However, this leaves the issue of password recovery.</p>
<p>In order to recover passwords and email them to members of the &#8220;social&#8221; site, it is tempting to think that the anonymous account must be able to somehow read the users table, but that is no good because then we have a <em>structural flaw</em> where a successful SQL injection would expose user accounts. However, this also turns out to be easy. There are two options:</p>
<ul>
<li>Write a stored procedure that      the anonymous user is free to execute, which does not return a password      but actually emails it directly from within the database server. This      requires your database server be able to send emails. (Postgres can, and I      assume SQL Server can, and I don&#8217;t really know about mySql).</li>
<li>Create a table for password      requests, allow inserts to it but nothing else. A trigger sends the email.      In this approach you can track email recovery requests.</li>
</ul>
<p>For the &#8220;finance&#8221; application we cannot allow any of this to happen, so again we go to the deny-by-default idea. All of the behaviors above will not happen unless the programmer sets a flag to turn them on when the database is built.</p>
<p>This does leave the detail of how users of the &#8220;finance&#8221; application will reset their passwords. For details on how a secure app can still allow password resets, see my posting of Sept 7 2008 <a href="http://database-programmer.blogspot.com/2008/09/advanced-table-design-secure-password.html">Secure Password Resets</a>.</p>
<h2>One More Detail on Public Users</h2>
<p>We still have one more detail to handle for public users. Presumably a user, having joined up, has more privileges than the anonymous account. So the web application must be able to join them into a group without elevating its privileges. The solution here is the same as for creating the account: there will be a table that the anonymous user can make inserts into (but nothing else), and a trigger will join the user to whatever group is named.</p>
<p>Except for one more detail. We cannot let the user join whatever group they want, only the special group for members. This requirement can be met by defining the idea of a &#8220;freejoin&#8221; group and also a &#8220;solo&#8221; group. If the anonymous user inserts into a user-group table, and the requested group is flagged as allowing anybody to join, the trigger will allow it, but for any other group the trigger will reject the insert. The &#8220;solo&#8221; idea is similar, it means that if a user is in the &#8220;members&#8221; group, and that group is a &#8220;solo&#8221; group, they may not join any other groups. This further jails in members of the general public.</p>
<h2>Almost Done: User Administration</h2>
<p>In the last two sections we saw the idea of a table of users and a cross-reference of users to groups. This turns out to solve another issue we will have: letting administrators manage groups. If we define a group called &#8220;user_administrators&#8221; and give them total power on these tables, and also give them CRUD screens for them, then we have a user administrator system. This works for both the &#8220;social&#8221; and the &#8220;finance&#8221; application.</p>
<p>The triggers on the table have to be slightly different for the two cases, but that is a small exercise to code them up accordingly.</p>
<h2>Cross-Database Access</h2>
<p>Believe it or not, the system outlined above has met all of our requirements except one. So far we have a system that never requires the web server to have any elevated priveleges within the database, allows members of the public to join some sites while barring them from others, is structurally immune from SQL injection, allows different people on different sites to have the same user id, and allows administrators of both sites to directly manage accounts. Moreover, we can handle both plaintext passwords and more serious reset-only situations.</p>
<p>This leaves only one very thorny issue: cross-database access. The specific database server I use most is PostgreSQL, and this server has a problem (for this scenario) anyway, which is that out-of-the-box, a database account can connect to any database. This does not mean the account has any priveleges on the database, but we very seriously do not want this to happen at all. If a member of the &#8220;social&#8221; site can connect to the &#8220;finance&#8221; app, we have a potential vulnerability even if he has zero privileges in that database. We would be much happier if he could not connect at all.</p>
<p>In Postgres there is a solution to this, but I&#8217;ve grown to not like it. In Postgres you can specify that a user can only connect to a database if they are in a group that has the same name as the database. This is easy to set up, but it requires changing the default configuration of Postgres. However, for the sheer challenge of it I&#8217;d like to work out how to do it without requiring that change. So far I&#8217;m still puzzling this out. I&#8217;d also like to know that the approach would work at very least on MS SQL Server and mySql.</p>
<h2>Conclusion</h2>
<p>Most of what is in this week&#8217;s essay is not that radical to any informed database veteran. But to web programmers who were unfortunate enough to grow up in the world of relational-databases-must-die nonsense, it is probably hard or impossible to imagine a system where users are connecting with real database accounts. The ironic thing is that the approached described here is far more secure than any single sign-on system, but it requires the programmer to shift thinking away from action-based code-centric models to what is really going on: table-based privileges. Once that hurdle is past, the rest of it comes easy.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=69&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/24/database-security-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Security Model Using MYSQL Database</title>
		<link>http://grabameat.wordpress.com/2009/07/17/security-model-using-mysql-database/</link>
		<comments>http://grabameat.wordpress.com/2009/07/17/security-model-using-mysql-database/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 18:41:50 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Security]]></category>
		<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=64</guid>
		<description><![CDATA[this is a copy content from http://www.securityinfocus.com/ storing as a technical document reference for myself<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=64&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><table border="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td><span><strong>Secure MySQL Database Design<br />
</strong></span><span><em>by</em> <a style="text-decoration:none;color:#3366cc;" href="mailto:ckwestphal@cox.net">Kristy Westphal</a><br />
</span><span>last February 18, 2003<br />
</span></p>
<hr /></td>
</tr>
<tr>
<td>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">When it comes to installing software, secure design is often the last consideration. The first goal is usually just to get it to work. This is particularly true of databases. Databases are commonly referred to the keys to the kingdom: meaning that once they are compromised, all the valuable data that is stored there could fall into the hands of the attacker. With this in mind, this article will discuss various methods to secure databases, specifically one of the most popular freeware databases in use today, MySQL.</p>
<p><strong>Introduction to MySQL</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">MySQL can be found at <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/" target="nonlocal">http://www.mysql.com</a> or at <a style="text-decoration:none;color:#3366cc;" href="http://sourceforge.net/projects/mysql/" target="nonlocal">http://sourceforge.net/projects/mysql/</a>. MySQL is used in over 4 million installations all over the world. It is licensed under both GNU GPL (General Public License) and commercial licenses, depending upon what level of support that you require. It has a large user community, which makes it somewhat easier to use under the GPL license. There are actually four versions of MySQL:</p>
<ul><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"></p>
<li><strong>MySQL Standard</strong> includes the standard storage engine, as well as the InnoDB storage engine, which is touted as a “transaction-safe, ACID-compliant database” with some additional features over the standard version.</li>
<li><strong>MySQL Pro</strong> is the commercial version.</li>
<li><strong>MySQL Max</strong> includes the more technologically advanced features that are available during early access programs.</li>
<li><strong>MySQL Classic</strong> is the standard storage engine without the InnoDB engine. This is another commercial version.</li>
<p></span></ul>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Most of the recommendations discussed in this article apply to all versions of MySQL unless otherwise noted.</p>
<p><strong>Introducing Security Into MySQL Design</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">As with securing a network, securing a database by looking at the various layers that are involved is an effective approach. Security of databases can be defined as preventing unauthorized or accidental disclosure, alteration, or destruction of data [2]. In addition, the confidentiality of data that exists in the database must be considered, as should the availability of that data. The following section will discuss a secure database design; while not all-inclusive, it should provide a good, basic starting point.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Three-Tier Design</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Also referred to as n-tier design, this design incorporates the three layers of a Web application running on different servers, usually set apart by firewalls that have specific rules to only let traffic through to the specific port on a specific server at whichever layer that the user is trying to access:</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Internet -&gt; Firewall -&gt; Web -&gt; Firewall -&gt; Application -&gt; Firewall -&gt; Database</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Something else that it should demonstrate is that it is very costly to implement such a design because firewalls and servers are not cheap. Oftentimes, a sys admin will choose a compromise, combining the application and database servers. This isn’t ideal from a security perspective; nevertheless, it is a vast improvement over leaving a sensitive database facing the Internet directly. The point is that if one of the layers closest to the Internet is compromised, then several more layers still need to be compromised before access to the vital information can be gained.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Access Control</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Access to information contained in the tables must be properly regulated. This can be done with control over direct access to the tables, and also through views. Views and privileges assigned to the views can be created to limit users to only see specified portions of data contained within a table [2]. Through the use of the selects, projections and joins, existing relations between tables in a relational database, as well as a single table, can be created. Control over the <code>read</code>, <code>insert</code>, <code>update</code> and <code>delete</code> commands must also be assigned appropriately within those views.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Roles</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Role-based authentication should be considered when adding access to any database. Typical roles for access include administrator, user, programmer and operator. For the first three roles, it is fairly obvious what access should be granted; it is the operator role that can be a sticking point. Operators are expected to play an essential part in the production operation of a system, yet they are often restricted in what type of access they are granted. Segregation of duties should be considered in the operator role, instead of just granting one operator control over an entire process. Operators’ roles do need to be carefully defined and kept within the realm of production support as much as possible. Furthermore, all roles should have logging enabled to keep track of what occurs [3].</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Integrity</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Another key ingredient in database design is data integrity, or ensuring that the data that is stored in the database is in fact valid and accurate. It is best to determine very early in the design process that it will be responsible for ensuring the integrity of the database. No matter the sensitivity of the data (credit card information vs. your record collection), if the data isn’t right, then what good is the database? When the owner is determined, they should maintain this role and appropriate access only, not attempting to dole this out to others less it become diluted and possibly become corrupt.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">A good process for ensuring the integrity of the data includes understanding what is processed and then identifying what can be considered personal, critical, or proprietary. As with any security issue, risk must be assigned according to the likelihood that something could occur to that data and the potential effect of such an occurence. Most of all, accountability must be assigned and designed into the environment where the database resides. Otherwise, the goals of privacy and security cannot be met [3].</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Encryption</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">The sensitivity of the data will logically determine the need for the use of encryption. There are a few things to consider when thinking about implementing encryption:</p>
<ol><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"></p>
<li>Will the data stored in the database need to be encrypted or just the user passwords?</li>
<li>Will you need to encrypt the data only in the local instance of the database, or do you need to also encrypt the data in transit?</li>
<p></span></ol>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Change Control</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">It is important to remember that changes made to the database, whether structural or to the data itself, must be tracked and regulated by interested parties. Whether formal or informal, the process must be defined and followed by all roles defined in the database structure.</p>
<p><strong>Specific MySQL Security Considerations</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Now that we have covered some of the general principals of database security, we can examine some specific considerations for the MySQL database. Please note that many variables that are mentioned in the following discussion are set in the “my.cnf” file. The location of this depends on how the MySQL database is installed. Essentially, you can create the file on your own, or use one of the handy sample files that come with the distribution (see the “support-files” directory). Then, if you would like the parameters to apply all MySQL users, you can place the “my.cnf” file in <code>/etc</code>. If you want the parameters to apply to specific users, then you can set the file in their respective home directory as “.my.cnf”. Make sure that the appropriate permissions are applied to the file wherever it resides, ensuring that the unauthorizedusers cannot write to it.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">A discussion of the basic post-installation configuration of MySQL is beyond the scope of this discussion. For that information, please refer to the MySQL documentation, <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/documentation/mysql/bychapter/manual_Installing.html#Post-installation" target="nonlocal">Post-Installation Set-up and Testing</a>, and <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/doc/en/Default_privileges.html" target="nonlocal">Setting Up the Initial MySQL Privileges</a>, as well as Ryan W. Maple&#8217;s article <a style="text-decoration:none;color:#3366cc;" href="http://www.linuxsecurity.com/tips/tip-24.html" target="nonlocal">MySQL Security</a>.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>The MySQL Permission Model</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">In order to fully implement a secure MySQL database, it is necessary to learn the MySQL access control system (your friends the GRANT and REVOKE commands). There are four privilege levels that apply:</p>
<ol><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"></p>
<li>Global: these privileges apply to all databases on a server.</li>
<li>Database: these privileges apply to all tables in a database.</li>
<li>Table: these apply to all columns within a table.</li>
<li>Column: these apply to individual columns in a table.</li>
<p></span></ol>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">The usage of these commands is varied:</p>
<pre>GRANT priv_type [(column_list)] [, priv_type [(column_list)] ...]
    ON {tbl_name | * | *.* | db_name.*}
    TO user_name [IDENTIFIED BY [PASSWORD] 'password']
        [, user_name [IDENTIFIED BY 'password'] ...]
    [REQUIRE
        NONE |
    	[{SSL| X509}]
	[CIPHER cipher [AND]]
	[ISSUER issuer [AND]]
	[SUBJECT subject]]
    [WITH [GRANT OPTION | MAX_QUERIES_PER_HOUR # |
                          MAX_UPDATES_PER_HOUR # |
                          MAX_CONNECTIONS_PER_HOUR #]]

REVOKE priv_type [(column_list)] [, priv_type [(column_list)] ...]
    ON {tbl_name | * | *.* | db_name.*}
    FROM user_name [, user_name ...]</pre>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">The privileges can get very granular, so it is important that they are used in a well planned fashion. The types of privileges include:</p>
<ul><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"></p>
<li>Alter</li>
<li>Delete</li>
<li>Create</li>
<li>Drop</li>
<li>Execute</li>
<li>Select</li>
<li>Update</li>
<p></span></ul>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Once a database is completely set up, these privileges should be reviewed prior to going to any usage of the database to ensure that the privileges were set up appropriately.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">For instance, if you wanted to limit the alter privilege only to the user <code>kristyw</code> for table called CreditCards, you would use the command as follows:</p>
<pre>Mysql&gt; GRANT alter on CreditCards to kristyw
Mysql&gt; IDENTIFIED by "password";</pre>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">This could take some time if multiple privileges for the same user are to be added. In this case, wildcards can be used, but use caution in doing so! You never want to add more privilege than is necessary or intended. Further, if a user account is compromised, then the use of blanket permissions to numerous hosts can open up unexpected trust relationships between systems. Additionally, if the hostname is left blank for connections, which also effectively works as a wildcard [7].</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">For example, say the user kristyw should now have all the privileges to everything in the database, as well as be required to connect to the database via an SSL connection:</p>
<pre>Mysql&gt; GRANT all on *.* to kristyw
Mysql&gt; IDENTIFIED by ‘password’ REQUIRE SSL;</pre>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">The wildcards that apply with the GRANT and REVOKE permissions include the “*”, which when used with grant privileges to *.* indicates global permissions, the “_”’, which if not used with a “\” in front of it (as in “\_”) could unintentionally indicate access to other databases, and lastly, the “%” can be used in hostnames.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Another privilege that can be assigned controls via GRANT and REVOKE is the PROCESS privilege, which should be restricted to only appropriate users. When used in the format: “mysqladmin processlist”, disclosure of password information is possible. This is especially true if the user excecuted the query with the syntax of “UPDATE user SET password=PASSWORD(‘not_secure&#8217;)” in their query. Furthermore, restrict the use of the FILE privilege. This privilege allows the assigned user to write a file wherever the mysqld daemon has privileges too. In addtion, the FILE privilege can be used to view any file within the UNIX filesystem that the user has privileges to [7].</p>
<p><strong>More Advanced Tips…</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">If a database only needs to be accessed locally, TCP networking can be disabled. You can achieve this by editing the safe_mysqld script (located in /mysq_linstall_dir/bin). Search for “skip-locking”, and add the “skip-networking” flag to the beginning of the line that includes “–skip-locking”:</p>
<pre> --skip-networking --skip-locking &gt; &gt;  $err_log 2&gt; &amp;1

 --skip-networking --skip-locking "$@" &gt; &gt;  $err_log 2&gt; &amp;1</pre>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Now no one will be able to remotely connect to the database [4].</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Start up MySQL with the parameter to disable the use of symlinks (via the –skip-symlink option). This will prevent the possibility of escalated privileges given to the owner of whoever started the mysqld process. Ultimately this could result in accidental or deliberate overwriting of files on your system, so it is best to just remove their usage.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">To prevent a type of denial of service by one compromised or careless user account, you should restrict connections for a single user, by setting the max_user_connections variable in mysqld. These options can be viewed via the SHOW VARIABLES command, and can be updated via the SET command [7].</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">There are a few methods to encrypt stored data in a MySQL database: you can use the ENCRYPT or ENCODE commands. The difference between the two is that ENCRYPT uses the Unix crypt call, where as ENCODE uses a password provided in the command to encrypt the string. Both MD5 and SHA1 hash algorithms are available, as well as AES and DES. (Note: SHA1, DES and AES algorithms only available in version 4.0.2 and later).</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">By default, passwords are inserted into tables using encryption. Also by default, passwords in MySQL are unrelated to operating system passwords. There is no length limit on passwords in MySQL; they can be as short or as long as you want (however, the OS may restrict that length). User names can be up to sixteen characters, but can also be shorter. Therefore, any strict password parameters will have to be encouraged by setting policies and enforced by auditing. Overall, just make sure that all accounts do have passwords, just like you should on their operating system accounts.</p>
<p><strong>All the Other Goodies</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Another thing to keep in mind when securing your database is all of the other possible tools that are installed on your server. If you are on a tight budget, and have placed your Web server with the database (which is still not recommended), then tools like Apache, PHP or Java may be loaded on the same server. If these tools are not kept up-to-date (just as with the OS), then possible exploits may apply, and the server may be vulnerable to intrusion.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">The same principle applies to the other utility packages that may be loaded on your server, such as: SSH, zlib, or wu-ftp. Always remember to apply security checklists to your servers, know what is running on them, and keep up with the latest vulnerabilities.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">We have considered many things here to design into the database itself, but one item that needs to be considered is how the traffic is transmitted between the client and the server. If the data is sensitive and/or going over the Internet, then SSL should be employed. Version 4.0 of MySQL will satisfy this requirement. To have your version of MySQL use SSL, configure it with the following flags: &#8211;with-vio &#8211;with-openssl.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">There are also ways to lock down the usage of SSL once you have it properly installed. If the REQUIRE SSL option is used, no non-SSL connections can be made to this server. Be cautious when employng the REQUIRE X509 option, though, because its usage alone does not mean that the certificate will be validated, only that the user must have one. Other REQUIRE options must be set to have proper validation (e.g. ISSUER, SUBJECT). Lastly, REQUIRE CIPHER is the parameter that requires that certain ciphers and keylengths be used [6].</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">For older versions of MySQL, an encrytped SSH tunnel is a viable option.</p>
<p><strong>And All That Other Stuff…</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Don’t forget the other layers of your servers!!! When I say this, I mean that the security of the operating system, the server authentication, and the server access control must all be taken care of as well, because if these are weak, then why even bother securing your database?</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Database Backups</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Another area that often gets lost in the layers of security is the critical area of database backup and recovery. As a part of whatever backup type is used, testing recovery of data is mandatory. Further, since version 3.23.47, checkpointing (where copies of the database are saved at defined times while processing) has been improved to be done more frequently, also easing the recovery process. With frequent checkpointing, as well as transaction logging (now available with InnoDB) and making regular backup copies, backup and recovery of databases is made more straightforward.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Specifically, the InnoDB transactional model allows for commit, rollback and crash recovery. By adding locking capabilities for users, having many users access the database at the same time becomes faster and more stable. To ensure that InnoDB is available with your installation, configure your package with the ‘—with-innodb’ flags. You will also want to specify InnoDB options in your ‘my.cnf’ file. Details on these set-up options can be found at the MySQL Documentation on <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/doc/en/InnoDB_start.html" target="nonlocal">InnoDB Start-up Options</a>.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;"><strong>Add-Ons</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">As is the case with a lot of popular freeware tools, MySQL has spawned many other tools that can help improve the management of MySQL databases; thus, making the improving the security of the databases as well. If you are looking for a tool to help scan your network for blank MySQL passwords, try this <a style="text-decoration:none;color:#3366cc;" href="http://www.securiteam.com/tools/6Y00L0U5PC.html" target="nonlocal">MySQL Network Scanner</a> script. It was originally compiled for Linux and to scan a class C network, but could be modified if needed.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">There are several GUI consoles available to make the management of MySQL database easier. For instance, <a style="text-decoration:none;color:#3366cc;" href="http://www.mysqltools.com/mysqlexp.htm" target="nonlocal">MySQL Explorer</a> allows several management processes to be done via an interface that runs on several windows platforms. The MySQL team also has a version in beta called MySQL Control Center, and the source code is available here: <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/downloads/mysqlcc.html" target="nonlocal">here</a>. Just keep in mind when using these graphical tools and editors to help you manage a MySQL database that security needs to apply to them as well. This can be done through use of the ACLs to make sure that only certain servers can connect to your database on certain ports.</p>
<p><strong>Conclusion</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">Many of the standard secure database design principles apply to MySQL. Of course, it has many of its own intricacies that need to be understood and audited carefully before any database is fully implemented. Lastly, it is important to keep in mind that other layers of security apply when hosting a database, such as network and operating system security. The good news is that the makers of MySQL have an excellent documentation area on their <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/" target="nonlocal">Web site</a> that, although sometimes cumbersome to navigate, is well stocked with information for the MySQL developer and administrator.</p>
<p><strong>References</strong></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[1] <span style="text-decoration:underline;">Database Management and Design</span>, Gary W. Hansen and James V. Hansen, Prentice Hall, 1992</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[2] <span style="text-decoration:underline;">A Primer on SQL</span>, Roy Ageloff, Times Mirror/Mosby College Publishing, 1988</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[3] Database: Structure Techniques for Design, Performance and Management, 2nd Edition, Shaku Atre, John Wiley and Sons, 1988</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[4] mysql security, Ryan W. Maple, <a style="text-decoration:none;color:#3366cc;" href="http://www.linuxsecurity.com/tips/tip-24.html" target="nonlocal">http://www.linuxsecurity.com/tips/tip-24.html</a></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[5] General Security Guidelines, <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/doc/en/General_security.html" target="nonlocal">http://www.mysql.com/doc/en/General_security.html</a></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[6] SSL Usage Requirements <a style="text-decoration:none;color:#3366cc;" href="http://www.mysql.com/doc/en/Secure_requirements.html" target="nonlocal">http://www.mysql.com/doc/en/Secure_requirements.html</a></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;text-decoration:none;line-height:18px;font-style:normal;color:#000000;">[7] How to Make MySQL Secure Against Crackers <a style="text-decoration:none;color:#cc0000;" href="http://www.mysql.com/doc/en/Security.html" target="nonlocal">http://www.mysql.com/doc/en/Security.html</a>Se</p>
</td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=64&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/17/security-model-using-mysql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Roles and Previleges in MYSQL</title>
		<link>http://grabameat.wordpress.com/2009/07/16/roles-and-previleges-in-mysql/</link>
		<comments>http://grabameat.wordpress.com/2009/07/16/roles-and-previleges-in-mysql/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 04:50:26 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql Previleges]]></category>
		<category><![CDATA[MySql Roles]]></category>
		<category><![CDATA[MySql WorkBench]]></category>
		<category><![CDATA[SECURICH]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=55</guid>
		<description><![CDATA[http://mysqlpreacher.com/wordpress/2009/06/security-roles-and-password-expiry-on-mysql-using-securich/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=55&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3 style="font-size:21px;font-weight:bold;font-family:Helvetica, Arial, sans-serif;color:black;background-color:white;margin:16px 0 4px;">8.3.10. The Privileges Tab</h3>
<h2 style="font-weight:bolder;letter-spacing:-.07em;font-family:Verdana, 'BitStream vera Sans';font-size:16px;display:block;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#cccccc;margin:10px 0 0;padding:0 5px 3px;"><a href="http://dev.mysql.com/doc/workbench/en/wb-table-editor-privileges.html">http://dev.mysql.com/doc/workbench/en/wb-table-editor-privileges.html</a></h2>
<div>
<div>
<div>
<div>
<h4 style="font-weight:bold;font-size:18px;font-family:Helvetica, Arial, sans-serif;color:black;background-color:white;margin:14px 0 2px;">7.4.3.1. Adding Roles</h4>
<p><a href="http://dev.mysql.com/doc/workbench/en/wb-table-editor-privileges.html"><strong>http://dev.mysql.com/doc/workbench/en/wb-table-editor-privileges.html</strong></a></div>
</div>
</div>
</div>
<p><span style="color:red;"><br />
</span></p>
<p><span style="color:red;"> </span></p>
<h2 style="font-weight:bolder;letter-spacing:-.07em;font-family:Verdana, 'BitStream vera Sans';font-size:16px;display:block;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#cccccc;margin:10px 0 0;padding:0 5px 3px;">Security – Roles and Password Expiry on MySQL using SECURICH</h2>
<p><a href="http://mysqlpreacher.com/wordpress/2009/06/security-roles-and-password-expiry-on-mysql-using-securich/">http://mysqlpreacher.com/wordpress/2009/06/security-roles-and-password-expiry-on-mysql-using-securich/</a></p>
<p style="margin:0 0 10px;padding:0;">Lately there has been quite some talk about security on MySQL, and I’ve decided to GPL a package I wrote, implmenting Roles on MySQL.<br style="margin:0;padding:0;" />This technology has been available on other databases for quite some time, but hasn’t quite yet made it to MySQL’s feature list and apart from this tool, the only solution I know of is google’s patches for MySQL 5.0.</p>
<p style="margin:0 0 10px;padding:0;">The name is SECURICH and downloads as well as documentation are available at<a style="color:#2970a6;text-decoration:none;margin:0;padding:0;" href="http://www.securich.com/">http://www.securich.com/</a>. The bug list is available at <a style="color:#2970a6;text-decoration:none;margin:0;padding:0;" href="http://www.securich.com/mantis/">http://www.securich.com/mantis/</a> (you’ll have to register and log in first). Privileges can be granted on a database or table level with a few combinations like:<br style="margin:0;padding:0;" />1. database as one,<br style="margin:0;padding:0;" />2. all tables in database (useful when you need to grant a bunch of privileges to all tables but a few thus revoking the few later),<br style="margin:0;padding:0;" />3. single tables,<br style="margin:0;padding:0;" />4. stored procedure or<br style="margin:0;padding:0;" />5. tables through the use of regular expression.</p>
<p style="margin:0 0 10px;padding:0;">The user has the facility to create a role and update it on the fly thus propagating the changes onto already existing users having the role in question. There are also loads of other functionalities available and I urge you to check the documentation on<a style="color:#2970a6;text-decoration:none;margin:0;padding:0;" href="http://www.securich.com/">http://www.securich.com/</a>.</p>
<p style="margin:0 0 10px;padding:0;">A cool feature I like is password history which enables dbas to enforce changing of passwords after a certain period of time.</p>
<p style="margin:0 0 10px;padding:0;">#################################################################################################################################################<br style="margin:0;padding:0;" />## PLEASE NOTE THAT:<br style="margin:0;padding:0;" />## 1. THIS IS AN ALPHA VERSION,<br style="margin:0;padding:0;" />## 2. YOU SHOULD NOT INSTALL THIS PACKAGE ON A PRE-EXISTING MYSQL WHICH ALREADY HAS PRIVILEGES SET UP.<br style="margin:0;padding:0;" />#################################################################################################################################################<br style="margin:0;padding:0;" />##<br style="margin:0;padding:0;" />## This tool will modify current privileges on the “mysql” database tables and should only be used with freshly installed mysqls.<br style="margin:0;padding:0;" />##<br style="margin:0;padding:0;" />##################################################################################################################################################</p>
<p style="margin:0 0 10px;padding:0;">Features like block user and unblock user as well as many other functionalities are being developed and more features will be added as time goes by.</p>
<p style="margin:0 0 10px;padding:0;">I would greatly appreciate your feedback about what you think of the package, features you might wish to include etc (feature requests should be done through<a style="color:#2970a6;text-decoration:none;margin:0;padding:0;" href="http://www.securich.com/mantis/">http://www.securich.com/mantis/</a> as well.)</p>
<p style="margin:0 0 10px;padding:0;">
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=55&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/16/roles-and-previleges-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>MySql (what i know as of Today)</title>
		<link>http://grabameat.wordpress.com/2009/07/15/mysql-what-i-know-as-of-today/</link>
		<comments>http://grabameat.wordpress.com/2009/07/15/mysql-what-i-know-as-of-today/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 19:33:05 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[MySql Configuration]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=51</guid>
		<description><![CDATA[1) Downloaded and installed mySql on my Local Machine.
 Host: Localhost
Username: ODBC
Password:  nothing 
2) Installed MySqlQuery Browser, MySqlAdministrator from Mysql Website
3) Connected to MySql Server Using the Below Parameters
i) use the Command prompt and goto  c:/Program files/mysql/mysqlserver 5.4/bin/mysql.exe
ii) To Connect to a Database   &#8220;Use Databasename&#8221;  ex: Use Text;
iii) To see a list of tables [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=51&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>1) Downloaded and installed mySql on my Local Machine.</p>
<p><strong> Host: Localhost<br />
Username: ODBC<br />
Password:  nothing </strong></p>
<p>2) Installed MySqlQuery Browser, MySqlAdministrator from Mysql Website</p>
<p><strong>3) Connected to MySql Server Using the Below Parameters</strong></p>
<p>i) use the Command prompt and goto  c:/Program files/mysql/mysqlserver 5.4/bin/mysql.exe<br />
ii) To Connect to a Database   &#8220;Use Databasename&#8221;  ex: Use Text;<br />
iii) To see a list of tables in mySql just type  &#8221;SHOW TABLES;&#8221;<br />
iv) To See Records in a table type &#8220;Select * from test;&#8221; will display all records.<br />
v)for help with the mysql  type &#8220;help&#8221; and press enter at the mysql prompt</p>
<p><strong>General SQL Topic</strong></p>
<table style="font-family:Tahoma, Arial;font-size:12px;line-height:normal;" border="0" cellspacing="0" cellpadding="2" width="100%">
<tbody>
<tr style="font-family:Tahoma, Arial;font-size:12px;line-height:normal;">
<td style="font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:normal;" colspan="3"><strong>RE: What is the difference between view and materializ&#8230;</strong></p>
<hr /></td>
</tr>
<tr style="font-family:Tahoma, Arial;font-size:12px;line-height:normal;">
<td style="font-family:Verdana;font-size:12px;line-height:normal;margin-top:40px;" colspan="3"><span style="font-family:'Trebuchet MS', sans-serif, Arial, Tahoma, Verdana, Helvetica;font-size:1.1em;line-height:normal;margin:12px 0;"></p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:normal;"><strong>view </strong>- store the <span style="font-family:Tahoma, Arial;font-size:1em;line-height:1.5em;border-bottom-style:solid;display:inline;background-color:transparent;padding-bottom:1px;cursor:pointer;width:auto;margin-left:0;color:#006400;border-bottom-color:#006400;position:relative;border-bottom-width:1px;text-decoration:underline;">SQL statement</span> in the database and let you use it as a table. Everytime you access the view the SQL statement executes.</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:normal;"><strong>materialized view</strong> &#8211; stores the results of the <span style="font-family:Tahoma, Arial;font-size:1em;line-height:1.5em;border-bottom-style:solid;display:inline;background-color:transparent;padding-bottom:1px;cursor:pointer;width:auto;margin-left:0;color:#006400;border-bottom-color:#006400;position:relative;border-bottom-width:1px;text-decoration:underline;">SQL</span> in table form in the database. SQL statement only executes once and after that everytime you run the <span style="font-family:Tahoma, Arial;font-size:1em;line-height:1.5em;border-bottom-width:1px;border-bottom-style:solid;display:inline;background-color:transparent;padding-bottom:1px;cursor:pointer;width:auto;margin-left:0;color:#006400;border-bottom-color:#006400;position:relative;text-decoration:underline;">query</span> the stored result set is used. Pros include quick query results.</p>
<p></span></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=51&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/15/mysql-what-i-know-as-of-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle Database 11g:  The Top New Features for DBAs and Developers</title>
		<link>http://grabameat.wordpress.com/2009/07/10/oracle-database-11g-the-top-new-features-for-dbas-and-developers/</link>
		<comments>http://grabameat.wordpress.com/2009/07/10/oracle-database-11g-the-top-new-features-for-dbas-and-developers/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 19:49:45 +0000</pubDate>
		<dc:creator>grabameat</dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Archivelog]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[New Features]]></category>
		<category><![CDATA[Recovery]]></category>
		<category><![CDATA[Redolog]]></category>
		<category><![CDATA[Restore]]></category>
		<category><![CDATA[RMAN]]></category>

		<guid isPermaLink="false">http://grabameat.wordpress.com/?p=48</guid>
		<description><![CDATA[RMAN
Advice on data recovery, parallel backup of the same file, and virtual catalogs for security are just a few of the new gems available from RMAN in Oracle Database 11g.




Download Oracle Database 11g



Data Recovery Advisor
Consider the error shown below:
SQL&#62; conn scott/tiger
Connected.
SQL&#62; create table t (col1 number);
create table t (col1 number)
*
ERROR at line 1:
ORA-01116: error in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=48&subd=grabameat&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h1 style="font-family:arial, helvetica, sans-serif;font-size:18px;margin-bottom:1px;font-weight:bold;color:#000000;">RMAN</h1>
<p style="font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:14px;font-weight:bold;color:#000000;text-decoration:none;">Advice on data recovery, parallel backup of the same file, and virtual catalogs for security are just a few of the new gems available from RMAN in Oracle Database 11<em>g</em>.</p>
<table border="0">
<tbody>
<tr>
<td><img src="http://oracleimg.com/admin/images/ocom/download_icon.jpg" border="0" alt="Download" width="17" height="17" align="middle" /></td>
<td style="color:#000000;font-size:12px;font-family:Arial, Helvetica, sans-serif;line-height:14px;text-decoration:none;"><a style="font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:14px;color:black;text-decoration:underline;" href="http://www.oracle.com/technology/software/products/database/index.html">Download Oracle Database 11<em>g</em></a></td>
</tr>
</tbody>
</table>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Data Recovery Advisor</h2>
<p>Consider the error shown below:</p>
<pre>SQL&gt; conn scott/tiger
Connected.
SQL&gt; create table t (col1 number);
create table t (col1 number)
*
ERROR at line 1:
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/home/oracle/oradata/PRODB3/users01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3</pre>
<p>Does it look familiar? Regardless of your experience as a DBA, you probably have seen this message more than once. This error occurs because the datafile in question is not available—it could be corrupt or perhaps someone removed the file while the database was running. In any case, you need to take some proactive action before the problem has a more widespread impact.</p>
<p>In Oracle Database 11<em>g</em>, the new Data Recovery Advisor makes this operation much easier. The advisor comes in two flavors: command line mode and as a screen in Oracle Enterprise Manager Database Control. Each flavor has its advantages for a given specific situation. For instance, the former option comes in handy when you want to automate the identification of such files via shell scripting and schedule recovery through a utility such as cron or at. The latter route is helpful for novice DBAs who might want the assurance of a GUI that guides them through the process. I&#8217;ll describe both here.</p>
<h3 style="font-family:arial, helvetica, sans-serif;font-size:14px;margin-bottom:1px;font-weight:bold;color:#000000;">Command Line Option</h3>
<p>The command line option is executed through RMAN. First, start the RMAN process and connect to the target.</p>
<pre>
$ rman target=/

Recovery Manager: Release 11.1.0.5.0 - Beta on Sun Jul 15 19:43:45 2007

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: PRODB3 (DBID=3132722606)</pre>
<p>Assuming that some error has occurred, you want to find out what happened. The <tt>list failure</tt> command tells you that in a jiffy.</p>
<pre>RMAN&gt; list failure;</pre>
<p>If there is no error, this command will come back with the message:</p>
<pre>no failures found that match specification</pre>
<p>If there is an error, a more explanatory message will follow:</p>
<pre>using target database control file instead of recovery catalog
List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
142        HIGH     OPEN      15-JUL-07     One or more non-system datafiles are missing</pre>
<p>This message shows that some datafiles are missing. As the datafiles belong to a tablespace other than SYSTEM, the database stays up with that tablespace being offline. This error is fairly critical, so the priority is set to HIGH. Each failure gets a Failure ID, which makes it easier to identify and address individual failures. For instance you can issue the following command to get the details of Failure 142.</p>
<pre>RMAN&gt; list failure 142 detail;</pre>
<p>This command will show you the exact cause of the error.</p>
<p>Now comes the fun part: How do you rectify the error? Seasoned DBAs will probably ace this without further help but novice DBAs (and even experienced but tired ones) will welcome some guidance here. They can turn to Data Recovery Advisor for assistance:</p>
<pre>RMAN&gt; advise failure;</pre>
<p>It responds with a detailed explanation of the error and how to correct it:</p>
<pre>List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
142        HIGH     OPEN      15-JUL-07     One or more non-system datafiles are missing

analyzing automatic repair options; this may take some time
using channel ORA_DISK_1
analyzing automatic repair options complete

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
1. If file /home/oracle/oradata/PRODB3/users01.dbf was unintentionally renamed or moved, restore it

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover datafile 4
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /home/oracle/app/diag/rdbms/prodb3/PRODB3/hm/reco_3162589478.hm</pre>
<p>This output has several important parts. First, the advisor analyzes the error. In this case, it&#8217;s pretty obvious: the datafile is missing. Next, it suggests a strategy. In this case, this is fairly simple as well: restore and recover the file. (Please note that I have deliberately chosen a simple example to focus the attention on the usage of the tool, not to discuss the many cases where the database could fail and how they can be recovered. The dynamic performance view V$IR_MANUAL_CHECKLIST also shows this information.)</p>
<p>However, the most useful task Data Recovery Advisor does is shown in the very last line: it generates a script that can be used to repair the datafile or resolve the issue. The script does all the work; you don&#8217;t have to write a single line of code.</p>
<p>Sometimes the advisor doesn&#8217;t have all the information it needs. For instance, in this case, it does not know if someone moved the file to a different location or renamed it. In that case, it advises to move the file back to the original location and name (under <strong>Optional Manual Actions</strong>).</p>
<p>OK, so the script is prepared for you. Are you ready to execute it? I don&#8217;t know about you, but I would verify what the script actually does first. So, I issue the following command to &#8220;preview&#8221; the actions the repair task will execute:</p>
<pre>RMAN&gt; repair failure preview;

Strategy: The repair includes complete media recovery with no data loss
Repair script: /home/oracle/app/diag/rdbms/prodb3/PRODB3/hm/reco_741461097.hm

contents of repair script:
   # restore and recover datafile
   sql 'alter database datafile 4 offline';
   restore datafile 4;
   recover datafile 4;
   sql 'alter database datafile 4 online';</pre>
<p>This is good; the repair seems to be doing the same thing I would have done myself using RMAN. Now I can execute the actual repair by issuing:</p>
<pre>RMAN&gt; repair failure;

Strategy: The repair includes complete media recovery with no data loss
Repair script: /home/oracle/app/diag/rdbms/prodb3/PRODB3/hm/reco_3162589478.hm

contents of repair script:
   # restore and recover datafile
   sql 'alter database datafile 4 offline';
   restore datafile 4;
   recover datafile 4;
   sql 'alter database datafile 4 online';

Do you really want to execute the above repair (enter YES or NO)?</pre>
<p>Assuming I&#8217;m OK, I answer YES and the action goes on:</p>
<pre>executing repair script

sql statement: alter database datafile 4 offline

Starting restore at 15-JUL-07
using channel ORA_DISK_1

channel ORA_DISK_1: restoring datafile 00004
input datafile copy RECID=5 STAMP=628025835 file name=/home/oracle/flasharea
    /PRODB3/datafile/o1_mf_users_39ocxbv3_.dbf
destination for restore of datafile 00004: /home/oracle/oradata/PRODB3/users01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00004
output file name=/home/oracle/oradata/PRODB3/users01.dbf RECID=0 STAMP=0
Finished restore at 15-JUL-07

Starting recover at 15-JUL-07
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 51 is already on disk as file /home/oracle/
   flasharea/PRODB3/archivelog/2007_07_15/o1_mf_1_51_39ocxxdw_.arc
... <em>and so on</em> ...
name=/home/oracle/flasharea/PRODB3/archivelog/2007_07_15/o1_mf_1_55_39ocy9ox_.arc thread=1 sequence=55
media recovery complete, elapsed time: 00:00:01
Finished recover at 15-JUL-07

sql statement: alter database datafile 4 online
repair failure complete

RMAN&gt;</pre>
<p>Note how RMAN prompts you before attempting to repair. In a scripting case, you may not want to do that; rather, you would want to just go ahead and repair it without an additional prompt. In such a case, just use repair failure noprompt at the RMAN prompt.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Proactive Health Checks</h2>
<p>It helps you sleep better at night knowing that the database is healthy and has no bad blocks. But how can you ensure that? Bad blocks show themselves only when they are accessed so you want to identify them early and hopefully repair them using simple commands before the users get an error.</p>
<p>The tool dbverify can do the job but it might be a little inconvenient to use because it requires writing a script file contaning all datafiles and a lot of parameters. The output also needs scanning and interpretation. In Oracle Database 11<em>g</em>, a new command in RMAN, <tt>VALIDATE DATABASE</tt>, makes this operation trivial by checking database blocks for physical corruption. If corruption is detected, it logs into the Automatic Diagnostic Repository. RMAN then produces an output that is partially shown below:</p>
<pre>RMAN&gt; validate database;

Starting validate at 09-SEP-07
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=110 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00002 name=/home/oracle/oradata/ODEL11/sysaux01.dbf
input datafile file number=00001 name=/home/oracle/oradata/ODEL11/system01.dbf
input datafile file number=00003 name=/home/oracle/oradata/ODEL11/undotbs01.dbf
input datafile file number=00004 name=/home/oracle/oradata/ODEL11/users01.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:02:18
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              12852        94720           5420717
  File Name: /home/oracle/oradata/ODEL11/system01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              65435
  Index      0              11898
  Other      0              4535            

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2    OK     0              30753        115848          5420730
  File Name: /home/oracle/oradata/ODEL11/sysaux01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              28042
  Index      0              26924
  Other      0              30129           

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3    OK     0              5368         25600           5420730
  File Name: /home/oracle/oradata/ODEL11/undotbs01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0
  Index      0              0
  Other      0              20232           

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4    OK     0              2569         12256           4910970   

... <em>&lt;snipped&gt;</em> ...</pre>
<p>Otherwise, in case of a failure you will see on parts of the above output:</p>
<pre>List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
7    FAILED 0              0            128             5556154
  File Name: /home/oracle/oradata/ODEL11/test01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              108
  Index      0              0
  Other      10             20</pre>
<p>You can also validate a specific tablespace:</p>
<pre>RMAN&gt; validate tablespace users;</pre>
<p>Or, datafile:</p>
<pre>RMAN&gt; validate datafile 1;</pre>
<p>Or, even a block in a datafile:</p>
<pre>RMAN&gt; validate datafile 4 block 56;</pre>
<p>The <tt>VALIDATE</tt> command extends much beyond datafiles however. You can validate spfile, controlfilecopy, recovery files, Flash Recovery Area, and so on.</p>
<h3 style="font-family:arial, helvetica, sans-serif;font-size:14px;margin-bottom:1px;font-weight:bold;color:#000000;">Enterprise Manager Interface</h3>
<p>Let&#8217;s see how failures can also be detected and corrected via Enterprise Manager.</p>
<p>First go to the Database homepage; top part is shown below.</p>
<p><img src="http://www.oracle.com/technology/pub/images/11g-rman-f1.jpg" alt="Figure 1" /></p>
<p>Scroll down further until you see the Alerts section, as shown below:</p>
<p>This window shows the actual RMAN command to be issued. At this time you can press <strong>Submit</strong> to execute the RMAN job. Note the contents of the window: It&#8217;s a real RMAN command, which you can copy and paste into an RMAN prompt.</p>
<p>The Enterprise Manager interface to RMAN provides the best of both worlds: the power of RMAN without the complexities of its command language. Advanced users of RMAN may not find it that useful, but for a novice, it&#8217;s a lifesaver—especially when considering how a relatively complicated block media recovery was done using a simple interface.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Flashback Logs to Rescue</h2>
<p>Remember Flashback Logging introduced in Oracle Database 10<em>g</em>? It records the optimized versions of the before-images of changed blocks into flashback logs that are generated in the Flashback Recovery Area, provided Flashback has been enabled in the database. These logs help you to flash the database back to a point in the time in the past without doing a point-in-time recovery from backups.</p>
<p>Well, since these flashback logs contain past images of the blocks, why not use them for recovery as well? Oracle Database 11<em>g</em> does exactly that. When you recover the specific block (or blocks), Oracle looks in the Flashback logs (instead of datafiles) to find a good copy of the past image of that block and then applies the archived logs to roll it forward. This technique saves a lot of time by not going to the backups, especially if the backup is on tape.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">ZLIB Compression</h2>
<p>RMAN offered compression of backup pieces in Oracle Database 10<em>g</em> to conserve network bandwidth but many people were slow to use it. Why? Because third-party compression utilities provided faster alternatives to RMAN&#8217;s own. Nevertheless, RMAN 10<em>g</em> compression has some neat features that third-party ones do not provide. For instance, when RMAN 10<em>g</em> restores datafiles, it doesn&#8217;t need to uncompress the files first, provided it performed the compression. This approach offers significant bandwidth savings during restores.</p>
<p>In Oracle Database 11<em>g</em>, RMAN offers another algorithm, ZLIB, in addition to the previously available BZIP2. ZLIB is a much faster algorithm but it does not compress a whole lot. On the other hand, it does not consume much CPU either. So if you are CPU starved, it&#8217;s a blessing to have ZLIB compression. (Note that BZIP2 is default in version 11.1; you need to license a new option called Advanced Compression Option to use ZLIB.)</p>
<p>To use ZLIB compression, merely set the RMAN configuration parameter:</p>
<pre>RMAN&gt; configure compression algorithm 'ZLIB' ;</pre>
<p>You have to issue the above command if you have changed it earlier. To change it to BZIP2, issue:</p>
<pre>RMAN&gt; configure compression algorithm 'bzip2';</pre>
<p>All the compressed backups will use the new algorithm now.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Parallel Backup of the Same Datafile</h2>
<p>You probably already know that you can parallelize the backup by declaring more than one channel so that each channel becomes a RMAN session. However, very few realize that each channel can back up only one datafile at a time. So even through there are several channels, each datafile is backed by only one channel, somewhat contrary to the perception that the backup is truly parallel.</p>
<p>In Oracle Database 11<em>g</em> RMAN, the channels can break the datafiles into chunks known as &#8220;sections.&#8221; You can specify the size of each section. Here&#8217;s an example:</p>
<pre>RMAN&gt; run {
2&gt;      allocate channel c1 type disk format '/backup1/%U';
3&gt;      allocate channel c2 type disk format '/backup2/%U';
4&gt;      backup
5&gt;      section size 500m
6&gt;      datafile 6;
7&gt; }</pre>
<p>This RMAN command allocates two channels and backs up the users&#8217; tablespace in parallel on two channels. Each channel takes a 500MB section of the datafile and backs it up in parallel. This makes backup of large files faster.</p>
<p>When backed up this way, the backups show up as sections as well.</p>
<pre>RMAN&gt; list backup of datafile 6;
...
&lt;snipped&gt;
...
    List of Backup Pieces for backup set 901 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    2007    1   AVAILABLE   /backup1/9dhk7os1_1_1
    2008    2   AVAILABLE   /backup2/9dhk7os1_1_1
    2009    3   AVAILABLE   /backup1/9dhk7os1_1_3
    2009    3   AVAILABLE   /backup2/9dhk7os1_1_4</pre>
<p>Note how the pieces of the backup show up as sections of the file. As each section goes to a different channel, you can define them as different mount points (such as /backup1 and /backup2), you can back them to tape in parallel as well.</p>
<p>However, if the large file #6 resides on only one disk, there is no advantage to using parallel backups. If you section this file, the disk head has to move constantly to address different sections of the file, outweighing the benefits of sectioning.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Backup Committed Undo? Why?</h2>
<p>You already know what undo data is used for. When a transaction changes a block, the past image of the block is kept it the undo segments. The data is kept there even if the transaction is committed because some long running query that started before the block is changed can ask for the block that was changed and committed. This query should get the past image of the block—the pre-commit image, not the current one. Therefore undo data is kept undo segments even after the commit. The data is flushed out of the undo segment in course of time, to make room for the newly inserted undo data.</p>
<p>When the RMAN backup runs, it backs up all the data from the undo tablespace. But during recovery, the undo data related to committed transactions are no longer needed, since they are already in the redo log streams, or even in the datafiles (provided the dirty blocks have been cleaned out from buffer and written to the disk) and can be recovered from there. So, why bother backing up the committed undo data?</p>
<p>In Oracle Database 11<em>g</em>, RMAN does the smart thing: it bypasses backing up the committed undo data that is not required in recovery. The uncommitted undo data that is important for recovery is backed up as usual. This reduces the size and time of the backup (and the recovery as well).</p>
<p>In many databases, especially OLTP ones where the transaction are committed more frequently and the undo data stays longer in the undo segments, most of the undo data is actually committed. Thus RMAN has to backup only a few blocks from the undo tablespaces.</p>
<p>The best part is that you needn&#8217;t do anything to achieve this optimization; Oracle does it by itself.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Virtual Private Catalog</h2>
<p>You are most likely using a catalog database for the RMAN repository. If you are not, you should seriously consider using one. There are several advantages, such as reporting, simpler recovery in case the controlfile is damaged, and so on.</p>
<p>Now comes the next question: How many catalogs? Generally, it makes sense to have only one catalog database as the repository for all databases. However, that might not be a good approach for security. A catalog owner will be able to see all the repositories of all databases. Since each database to be backed up may have a separate DBA, making the catalog visible may not be acceptable.</p>
<p>So, what&#8217;s the alternative? Of course, you could create a separate catalog database for each target database, which is probably impractical due to cost considerations. The other option is to create only one database for catalog yet create a virtual catalog for each target database. Virtual catalogs are new in Oracle Database 11g. Let&#8217;s see how to create them.</p>
<p>First, you need to create a base catalog that contains all the target databases. The owner is, say, &#8220;RMAN&#8221;. From the target database, connect to the catalog database as the base user and create the catalog.</p>
<p>$ rman target=/ rcvcat rman/rman@catdb Recovery Manager: Release 11.1.0.6.0 &#8211; Production on Sun Sep 9 21:04:14 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ODEL11 (DBID=2836429497) connected to recovery catalog database RMAN&gt; create catalog; recovery catalog created RMAN&gt; register database; database registered in recovery catalog starting full resync of recovery catalog full resync complete</p>
<p>This is called the base catalog, owned by the user named &#8220;RMAN&#8221;. Now, let&#8217;s create two additional users who will own the respective virtual catalogs. For simplicity, let&#8217;s gives these users the same name as the target database. While still connected as the base catalog owner (RMAN), issue these statement:</p>
<pre>RMAN&gt; grant catalog for database odel11 to odel11;

Grant succeeded.</pre>
<p>Now connect using the virtual catalog owner (odel11), and issue the statement <tt>create virtual catalog</tt></p>
<p>:</p>
<pre>$ rman target=/ rcvcat odel11/odel11@catdb

RMAN&gt; create virtual catalog;

found eligible base catalog owned by RMAN
created virtual catalog against base catalog owned by RMAN</pre>
<p>Now, register a different database (PRONE3) to the same RMAN repository and create a virtual catalog owner &#8220;prone3&#8243; for its namesake database.</p>
<pre>RMAN&gt; grant catalog for database prone3 to prone3;

Grant succeeded.

$ rman target=/ rcvcat prone3/prone3@catdb

RMAN&gt; create virtual catalog;

found eligible base catalog owned by RMAN
created virtual catalog against base catalog owned by RMAN</pre>
<p>Now, connecting as the base catalog owner (RMAN), if you want to see the databases registered, you will see:</p>
<pre>$ rman target=/ rcvcat=rman/rman@catdb

RMAN&gt; list db_unique_name all;

List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
285     PRONE3   1596130080       PRIMARY          PRONE3
1       ODEL11   2836429497       PRIMARY          ODEL11</pre>
<p>As expected, it showed both the registered databases. Now, connect as ODEL11 and issue the same command:</p>
<pre>$ rman target=/ rcvcat odel11/odel11@catdb

RMAN&gt; list db_unique_name all;

List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
1       ODEL11   2836429497       PRIMARY          ODEL11</pre>
<p>Note how only one database was listed, not both. This user (odel11) is allowed to see only one database (ODEL11), and that&#8217;s what it sees. You can confirm this by connecting to the catalog as the other owner, PRONE3:</p>
<pre>$ rman target=/ rcvcat prone3/prone3@catdb

RMAN&gt; list db_unique_name all;

List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
285     PRONE3   1596130080       PRIMARY          PRONE3</pre>
<p>Virtual catalogs allow you to maintain only one database for the RMAN repository catalog yet establish secure boundaries for individual database owners to manage their own virtual repositories. A common catalog database makes administration simpler, reduces costs, and enables the database to be highly available, again, at less cost.</p>
<h2 style="font-family:arial, helvetica, sans-serif;font-size:16px;margin-bottom:1px;font-weight:bold;color:#000000;">Merging Catalogs</h2>
<p>While on the subject of multiple catalogs, let&#8217;s consider another issue. Now that you&#8217;ve learned how to create virtual catalogs on the same base catalogs, you may see the need to consolidate all these independent repositories into a single one.</p>
<p>One option is to deregister the target databases from their respective catalogs and re-register them to this new central catalog. However, doing so also means losing all those valuable information stored in those repositories. You can, of course, sync the controlfiles and then sync back to the catalog, but that will inflate the controlfile and be impractical.</p>
<p>Oracle Database 11<em>g</em> offers a new feature: merging the catalogs. Actually, it&#8217;s importing a catalog from one database to another, or in other words, &#8220;moving&#8221; catalogs.</p>
<p>Let&#8217;s see how it is done. Suppose you want to move the catalog from database CATDB1 to another database called CATDB2. First, you connect to the catalog database CATDB2 (the target):</p>
<pre>$ rman target=/ rcvcat rman/rman@catdb2

Recovery Manager: Release 11.1.0.6.0 - Production on Sun Sep 9 23:12:07 2007

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: ODEL11 (DBID=2836429497)
connected to recovery catalog database</pre>
<p>If this database already has a catalog owned by the user &#8220;RMAN&#8221;, then go on to the next step of importing; otherwise, you will need to create the catalog:</p>
<pre>RMAN&gt; create catalog;

recovery catalog created</pre>
<p>Now, you import from the remote catalog (catdb1):</p>
<pre>RMAN&gt; import catalog rman/rman@catdb1;

Starting import catalog at 09-SEP-07
connected to source recovery catalog database
import validation complete
database unregistered from the source recovery catalog
Finished import catalog at 09-SEP-07
starting full resync of recovery catalog
full resync complete</pre>
<p>There are several important information in the above output. Note how the target database got de-registered from its original catalog database. Now if you check the database names in this new catalog:</p>
<pre>RMAN&gt; list db_unique_name all;

List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
286     PRONE3   1596130080       PRIMARY          PRONE3
2       ODEL11   2836429497       PRIMARY          ODEL11</pre>
<p>You will notice that the DB Key has changed. ODEL11 was 1 earlier; it&#8217;s 2 now.</p>
<p>The above operations will import the catalogs of all target databases registered to the catalog database. Sometimes you may not want that—rather, you may want to import only one or two databases. Here is a command to do that:</p>
<pre>RMAN&gt; import catalog rman/rman@catdb3 db_name = odel11;</pre>
<p>Doing so changes the DB Key again.</p>
<p>What if you don&#8217;t want to deregister the imported database from the source database during import? In other words, you want to keep the database registered in both catalog databases. You will need to use the &#8220;no unregister&#8221; clause:</p>
<pre>RMAN&gt; import catalog rman/rman@catdb1 db_name = odel11 no unregister;</pre>
<p>This will make sure the database ODEL11 is not unregistered from catalog database catdb1 but rather registered in the new catalog.</p>
<p><a style="font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:14px;color:black;text-decoration:underline;" href="http://www.oracle.com/technology/pub/articles/oracle-database-11g-top-features/index.html">Back to &#8220;Oracle Database 11<em>g</em>: Top Features for DBAs and Developers&#8221; homepage</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grabameat.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grabameat.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grabameat.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grabameat.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grabameat.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grabameat.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grabameat.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grabameat.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grabameat.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grabameat.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grabameat.wordpress.com&blog=8513308&post=48&subd=grabameat&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://grabameat.wordpress.com/2009/07/10/oracle-database-11g-the-top-new-features-for-dbas-and-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f6ce70b3776ab061ca481c7ec80919c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">grabameat</media:title>
		</media:content>

		<media:content url="http://oracleimg.com/admin/images/ocom/download_icon.jpg" medium="image">
			<media:title type="html">Download</media:title>
		</media:content>

		<media:content url="http://www.oracle.com/technology/pub/images/11g-rman-f1.jpg" medium="image">
			<media:title type="html">Figure 1</media:title>
		</media:content>
	</item>
	</channel>
</rss>