Sunday, March 30, 2014

Introduction to MySQL Utilities

Introduction to MySQL Utilities:-

-1-MySQL Utilities provides a command-line set of tools for working with MySQL Servers and databases.

-2-It is a package of utilities that are used for maintenance and administration of MySQL servers. These utilities encapsulate a set of primitive commands, and bundles them so they can be used to perform macro operations with a single command. They can be installed via MySQL Workbench, or as a standalone package.

-3-The utilities are written in Python, available under the GPLv2 license, and are extendable using the supplied library. They are designed to work with Python versions 2.6 or later and there is no support (yet) for Python v3.1.

-4-MySQL Utilities fully supports MySQL Server versions 5.1 and above. It is also compatible with MySQL Server 5.0, but not every feature of 5.0 may be supported. It does not support MySQL Server versions 4.x.

Synchronize Table or DB on Two Servers Where Neither is Up-to-date


Question:- How Can I Synchronize a Table or DB on Two Servers Where Neither is Up-to-date?

Suggestion/Recommendation :- Use MySQl Utilities Scripts(Ref link for introduction :http://myora-dba-notes.blogspot.in/2014/03/introduction-to-mysql-utilities.html)
In this example below, we connected to two servers and compare the database named mydb. 
We enabled the transformation statements using a combination of options as follows.
1.The --difftype=SQL option instructs the utility to generate the SQL statements.
2.The --show-reverse option instructs the utility to generate the differences in both direction.
That is, from the perspective of server1 as compared to server2 and server2 as compared to server1. 
3.Lastly, the --quiet option simply turns off the verbosity of print statements that normally occur for communicating progress.

Before proceeding let discuss the environment in which we are explaining this case to be tested , There is one db on both server i.e mydb and on server 1 we have 4 table out of which 3 are same as we have in server 2 but one on both server is different table and out of 3 common table we have one table which is out of sync or having different records updated differently on both servers ,So in order to synchronize both server database ,Please follow how can we found the SQL statements that needed to bring the tables into synch

Note:- 
We can also compare different db with command
cmd:-mysqldbcompare --server1=root:root@host1:3310 --server2=root:rrrr@host2:3310  mydbserver1:mydbserver2 -a --difftype=SQL --show-reverse --quiet

Server 1:-
mysql> use mydb

mysql> show tables;
+----------------+
| Tables_in_mydb |
+----------------+
| mydbtb2        |
| mydbtb3        |
| mydbtb5        |
| mydbtbl        |
+----------------+

4 rows in set (0.00 sec
mysql> select * from mydbtbl;
+-------+---------+---------+----------+----------+------+------+-------+------+-------+------+---------------------+
| id    | snap_id | host_id | rd_ios_s | wr_ios_s | rkbs | wkbs | queue | wait | svc_t | busy | snap_time           |
+-------+---------+---------+----------+----------+------+------+-------+------+-------+------+---------------------+
| 22809 |       2 |       6 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:26:35 |
| 22811 |       3 |       6 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:27:24 |
| 22815 |       5 |       6 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:28:15 |
| 22829 |       7 |     243 |    10.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:35:02 |
| 22839 |      12 |     243 |    10.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:40:02 |
| 22853 |      19 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:47:02 |
| 22893 |      39 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 18:07:02 |
| 22901 |      43 |     243 |     0.00 |   200.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 18:11:02 |
+-------+---------+---------+----------+----------+------+------+-------+------+-------+------+---------------------+
8 rows in set (0.00 sec)

Server 2:-
mysql> use mydb
mysql> show tables;
+----------------+
| Tables_in_mydb |
+----------------+
| mydbtb2        |
| mydbtb3        |
| mydbtb4        |
| mydbtbl        |
+----------------+
4 rows in set (0.00 sec)


mysql> select * from mydbtbl;
+-------+---------+---------+----------+----------+------+------+-------+------+-------+------+---------------------+
| id    | snap_id | host_id | rd_ios_s | wr_ios_s | rkbs | wkbs | queue | wait | svc_t | busy | snap_time           |
+-------+---------+---------+----------+----------+------+------+-------+------+-------+------+---------------------+
| 22811 |       3 |       6 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:27:24 |
| 22815 |       5 |       6 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:28:15 |
| 22829 |       7 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:35:02 |
| 22839 |      12 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:40:02 |
| 22845 |      15 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:43:02 |
| 22853 |      19 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 17:47:02 |
| 22893 |      39 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 18:07:02 |
| 22901 |      43 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 18:11:02 |
| 22905 |      45 |     243 |     0.00 |     0.00 | 0.00 | 0.00 |  0.00 | 0.00 |  0.00 | 0.00 | 2013-10-04 18:13:02 |
+-------+---------+---------+----------+----------+------+------+-------+------+-------+------+---------------------+
9 rows in set (0.00 sec)


Solution :-
Example 1:-
[root@localhost ~]# mysqldbcompare --server1=root:root@host1:3310 --server2=root:rrrr@host2:3310  mydb -a --difftype=SQL --show-reverse
# server1 on host1: ... connected.
# server2 on host2: ... connected.
# Checking databases mydb on server1 and mydb on server2
#
# WARNING: Objects in server1.mydb but not in server2.mydb:
#        TABLE: mydbtb5
#
# WARNING: Objects in server2.mydb but not in server1.mydb:
#        TABLE: mydbtb4
#
#                                           Defn    Row     Data
# Type      Object Name                     Diff    Count   Check
# ---------------------------------------------------------------
# TABLE     mydbtb2                         pass    pass    pass
# TABLE     mydbtb3                         pass    pass    pass
# TABLE     mydbtbl                         pass    FAIL    FAIL
#
# Row counts are not the same among `mydb`.`mydbtbl` and `mydb`.`mydbtbl`.
#
# Transformation for --changes-for=server1:
#

# Data differences found among rows:
UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '0.00' WHERE `id` = '22829'`snap_time` = '2013-10-04 17:35:02';
UPDATE `mydb`.`mydbtbl` SET `wr_ios_s` = '0.00' WHERE `id` = '22901'`snap_time` = '2013-10-04 18:11:02';
UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '0.00' WHERE `id` = '22839'`snap_time` = '2013-10-04 17:40:02';
DELETE FROM `mydb`.`mydbtbl` WHERE `id` = '22809'`snap_time` = '2013-10-04 17:26:35';
INSERT INTO `mydb`.`mydbtbl` (`id`, `snap_id`, `host_id`, `rd_ios_s`, `wr_ios_s`, `rkbs`, `wkbs`, `queue`, `wait`, `svc_t`, `busy`, `snap_time`) VALUES('22845', '15', '243', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2013-10-04 17:43:02');
INSERT INTO `mydb`.`mydbtbl` (`id`, `snap_id`, `host_id`, `rd_ios_s`, `wr_ios_s`, `rkbs`, `wkbs`, `queue`, `wait`, `svc_t`, `busy`, `snap_time`) VALUES('22905', '45', '243', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2013-10-04 18:13:02');

#
# Transformation for reverse changes (--changes-for=server2):
#
# # Data differences found among rows:
# UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '10.00' WHERE `id` = '22829'`snap_time` = '2013-10-04 17:35:02';
# UPDATE `mydb`.`mydbtbl` SET `wr_ios_s` = '200.00' WHERE `id` = '22901'`snap_time` = '2013-10-04 18:11:02';
# UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '10.00' WHERE `id` = '22839'`snap_time` = '2013-10-04 17:40:02';
# DELETE FROM `mydb`.`mydbtbl` WHERE `id` = '22845'`snap_time` = '2013-10-04 17:43:02';
# DELETE FROM `mydb`.`mydbtbl` WHERE `id` = '22905'`snap_time` = '2013-10-04 18:13:02';
# INSERT INTO `mydb`.`mydbtbl` (`id`, `snap_id`, `host_id`, `rd_ios_s`, `wr_ios_s`, `rkbs`, `wkbs`, `queue`, `wait`, `svc_t`, `busy`, `snap_time`) VALUES('22809', '2', '6', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2013-10-04 17:26:35');
#



# Database consistency check failed.
#
# ...done
[root@localhost ~]#


Example 2:-
[root@localhost ~]# mysqldbcompare --server1=root:root@host1:3310 --server2=root:rrrr@host2:3310  mydb -a --difftype=SQL --show-reverse --quiet
# Checking databases mydb on server1 and mydb on server2
#
# WARNING: Objects in server1.mydb but not in server2.mydb:
#        TABLE: mydbtb5
#
# WARNING: Objects in server2.mydb but not in server1.mydb:
#        TABLE: mydbtb4
#

#
# Row counts are not the same among `mydb`.`mydbtbl` and `mydb`.`mydbtbl`.
#
# Transformation for --changes-for=server1:
#

# Data differences found among rows:
UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '0.00' WHERE `id` = '22829'`snap_time` = '2013-10-04 17:35:02';
UPDATE `mydb`.`mydbtbl` SET `wr_ios_s` = '0.00' WHERE `id` = '22901'`snap_time` = '2013-10-04 18:11:02';
UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '0.00' WHERE `id` = '22839'`snap_time` = '2013-10-04 17:40:02';
DELETE FROM `mydb`.`mydbtbl` WHERE `id` = '22809'`snap_time` = '2013-10-04 17:26:35';
INSERT INTO `mydb`.`mydbtbl` (`id`, `snap_id`, `host_id`, `rd_ios_s`, `wr_ios_s`, `rkbs`, `wkbs`, `queue`, `wait`, `svc_t`, `busy`, `snap_time`) VALUES('22845', '15', '243', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2013-10-04 17:43:02');
INSERT INTO `mydb`.`mydbtbl` (`id`, `snap_id`, `host_id`, `rd_ios_s`, `wr_ios_s`, `rkbs`, `wkbs`, `queue`, `wait`, `svc_t`, `busy`, `snap_time`) VALUES('22905', '45', '243', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2013-10-04 18:13:02');

#
# Transformation for reverse changes (--changes-for=server2):
#
# # Data differences found among rows:
# UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '10.00' WHERE `id` = '22829'`snap_time` = '2013-10-04 17:35:02';
# UPDATE `mydb`.`mydbtbl` SET `wr_ios_s` = '200.00' WHERE `id` = '22901'`snap_time` = '2013-10-04 18:11:02';
# UPDATE `mydb`.`mydbtbl` SET `rd_ios_s` = '10.00' WHERE `id` = '22839'`snap_time` = '2013-10-04 17:40:02';
# DELETE FROM `mydb`.`mydbtbl` WHERE `id` = '22845'`snap_time` = '2013-10-04 17:43:02';
# DELETE FROM `mydb`.`mydbtbl` WHERE `id` = '22905'`snap_time` = '2013-10-04 18:13:02';
# INSERT INTO `mydb`.`mydbtbl` (`id`, `snap_id`, `host_id`, `rd_ios_s`, `wr_ios_s`, `rkbs`, `wkbs`, `queue`, `wait`, `svc_t`, `busy`, `snap_time`) VALUES('22809', '2', '6', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2013-10-04 17:26:35');
#

Example 3:-
[root@localhost ~]# mysqldbcompare --server1=root:root@host1:3310 --server2=root:rrrr@host2:3310  mydb -a --quiet
# Checking databases mydb on server1 and mydb on server2
#
# WARNING: Objects in server1.mydb but not in server2.mydb:
#        TABLE: mydbtb5
#
# WARNING: Objects in server2.mydb but not in server1.mydb:
#        TABLE: mydbtb4
#

#
# Row counts are not the same among `mydb`.`mydbtbl` and `mydb`.`mydbtbl`.
#
# Data differences found among rows:
--- `mydb`.`mydbtbl`
+++ `mydb`.`mydbtbl`
@@ -1,7 +1,7 @@
 +--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+
 | id     | snap_id  | host_id  | rd_ios_s  | wr_ios_s  | rkbs  | wkbs  | queue  | wait  | svc_t  | busy  | snap_time            |
 +--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+
-| 22829  | 7        | 243      | 10.00     | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 17:35:02  |
-| 22901  | 43       | 243      | 0.00      | 200.00    | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 18:11:02  |
-| 22839  | 12       | 243      | 10.00     | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 17:40:02  |
+| 22829  | 7        | 243      | 0.00      | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 17:35:02  |
+| 22901  | 43       | 243      | 0.00      | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 18:11:02  |
+| 22839  | 12       | 243      | 0.00      | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 17:40:02  |
 +--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+

# Rows in `mydb`.`mydbtbl` not in `mydb`.`mydbtbl`
+--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+
| id     | snap_id  | host_id  | rd_ios_s  | wr_ios_s  | rkbs  | wkbs  | queue  | wait  | svc_t  | busy  | snap_time            |
+--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+
| 22809  | 2        | 6        | 0.00      | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 17:26:35  |
+--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+

# Rows in `mydb`.`mydbtbl` not in `mydb`.`mydbtbl`
+--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+
| id     | snap_id  | host_id  | rd_ios_s  | wr_ios_s  | rkbs  | wkbs  | queue  | wait  | svc_t  | busy  | snap_time            |
+--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+
| 22845  | 15       | 243      | 0.00      | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 17:43:02  |
| 22905  | 45       | 243      | 0.00      | 0.00      | 0.00  | 0.00  | 0.00   | 0.00  | 0.00   | 0.00  | 2013-10-04 18:13:02  |
+--------+----------+----------+-----------+-----------+-------+-------+--------+-------+--------+-------+----------------------+

Monday, March 24, 2014

Oracle Query to check tablespace usage

Oracle Query to check tablespace usage & free details with their percentage 

1.Query:-Return Tablespace usage and free details excluding TEMP Tablespace
break on report
compute sum of FREE_SUM  FREE_MAX on report
/* FREE SPACE */
compute sum of col2 col3 col4  on report
--ttitle 'Free Space by Tablespace'
set lines 200
set pages 2000
set head on
set feed off
col col1    format a25                heading "Tablespace"
col col2    format 999,999,999,999    heading "Bytes(MB)"
col col3    format 999,999,999,999    heading "Used(MB)"
col col4    format 999,999,999,999    heading "Free(MB)"
col col6    format 999,999,999,999    heading "Free MAX(MB)"
col col5    format 999.9              heading "Free(%)"
select
    b.tablespace_name col1,
       b.bytes / 1024 / 1024 col2,
    ((b.bytes - sum(nvl(a.bytes,0)))) / 1024 / 1024 col3,
    (sum(nvl(a.bytes,0))) / 1024 / 1024 col4,
    (sum(nvl(a.bytes,0)) / (b.bytes)) * 100 col5,
    max(a.bytes)/1024 / 1024 col6, count(*)
from sys.dba_free_space a,
     (select  tablespace_name, sum(bytes) bytes
      from sys.dba_data_files
      group by tablespace_name ) b
where a.tablespace_name(+) = b.tablespace_name
group by b.tablespace_name, b.bytes
order by 5 desc;

OUTPUT:-

Tablespace   Bytes(MB)         Used(MB)         Free(MB) Free(%)     Free MAX(MB)   COUNT(*)
-----------  --------- ---------------- ---------------- ------- ---------------- ----------
DYM             16,484                0           16,484   100.0            3,968          7
UNDOTBS1         5,280               33            5,247    99.4            3,907         19
USERS           14,084            1,710           12,374    87.9            3,968         10
SYSTEM           1,370            1,358               12      .9                9          6
SYSAUX             620              616                4      .7                4          2
            ---------- ---------------- ----------------

sum             37,838            3,717           34,121


2.Query:-Return Tablespace usage and free details including TEMP Tablespace.
col tablespace_name format a25 heading 'TableSpace|Name'
col AvailSpace format 9999990.90 heading 'Total Size|(in Mb)'
col FreeSpace format 9999990.90 heading 'FreeSpace |(in Mb)'
col UsedSpace format 9999990.90 heading 'UsedSpace |(in Mb)'
SELECT
        dts.tablespace_name,
        (ddf.bytes / 1024 / 1024) "AvailSpace",
        (ddf.bytes - (dfs.bytes))/1024/1024 "UsedSpace",

        (dfs.bytes / 1024/1024 ) "FreeSpace",

        TO_CHAR(((ddf.bytes - (dfs.bytes)) / ddf.bytes * 100),'990.00') "Used %"

        FROM

        sys.dba_tablespaces dts,

        (select tablespace_name, sum(bytes) bytes

                from dba_data_files group by tablespace_name) ddf,
                        (select tablespace_name, sum(bytes) bytes
                                from dba_free_space group by tablespace_name) dfs
                                WHERE
                                        dts.tablespace_name = ddf.tablespace_name
                                AND dts.tablespace_name = dfs.tablespace_name
                                AND NOT (dts.extent_management like 'LOCAL'
                                AND dts.contents like 'TEMPORARY')
                                UNION ALL
                                SELECT dts.tablespace_name,
                                        (dtf.bytes / 1024 / 1024) "AvailSpace",
                                        (t.bytes)/1024/1024 "UsedSpace",
                                        (dtf.bytes - (t.bytes))/1024/1024 "FreeSpace",
                                        TO_CHAR((t.bytes / dtf.bytes * 100), '990.00') "Used %"
                                FROM
                                        sys.dba_tablespaces dts,
                                        (select tablespace_name, sum(bytes) bytes
                                        from dba_temp_files group by tablespace_name) dtf,
                                                (select tablespace_name, sum(bytes_used) bytes
                                                from v$temp_space_header group by tablespace_name) t
        WHERE
        dts.tablespace_name = dtf.tablespace_name
        AND dts.tablespace_name = t.tablespace_name
        AND dts.extent_management like 'LOCAL'
        AND dts.contents like 'TEMPORARY'
/

OUTPUT:-
TableSpace                 Total Size  UsedSpace   FreeSpace
Name                          (in Mb)     (in Mb)     (in Mb) Used %
------------------------- ----------- ----------- ----------- -------
UNDOTBS1                      5280.00       33.38     5246.63    0.63
SYSAUX                         620.00      615.63        4.38   99.29
DYM                          16484.00        0.19    16483.81    0.00
USERS                        14083.75     1710.00    12373.75   12.14
SYSTEM                        1370.00     1357.75       12.25   99.11
TEMP                            45.00       45.00        0.00  100.00

Friday, March 21, 2014

Reasons to relocated installation directories of package

                             Reasons to relocated installation directories of package


#~~#RPM has the ability to give users some latitude in deciding where packages are to be installed on
their systems. However, package builders must first design their packages to give users this
freedom.
In other words, an RPM package that can be installed into a different directory is said to be relocatable. Please note that not all RPM packages can be installed into another directory.
That's all well and good, but why would the ability to ``relocate'' a package be all that important?
#~~#Why relocate packages?
1.Avoid disk space problem(e.g default installation location is small in size)
2.This is standard installation method adopted for compliance
3.Save from attacks.

#~~#To check is package relocatable or not on Generic Linux 
cmd:-rpm -qpi package-file-name.rpm | grep Relocations

#~~#rpm options for installing other then default predefined location:-
--relocate OLDPATH=NEWPATH
For relocatable binary packages, translate all file paths that start with OLDPATH in the package relocation hint(s) to NEWPATH. This option can be used repeatedly if several OLDPATHâs in the package are to be relocated.
--prefix NEWPATH
For relocatable binary packages, translate all file paths that start with the installation prefix in the package relocation hint(s) to
NEWPATH.



MySQL Distribution Formats / Different types for MySQL Installation Methods

                  MySQL Distribution Formats / Different types for MySQL Installation Methods 


There are Two types of Distribution Format for MySQL Installation
1.Source distribution
2.Binary distribution

2.Binary Installation:This is further divided into two parts
a). Generic Binary Format(Zip arcives or compressed tar )
b). Native Format(RPM packages for Linux, DMG packages for Mac OS X, and PKG packages for Solaris.)

In most cases, pepole should probably use a binary distribution, if one exists for their platform.
Binary distributions are available in native format for many platforms, such as RPM packages for Linux, DMG packages for Mac OS X, and PKG packages for Solaris.
Distributions are also available in more generic formats such as Zip archives or compressed tar.

Reasons to choose a binary distribution include the following:
• Binary distributions generally are easier to install than source distributions.
• To satisfy different user requirements, we provide several servers in binary distributions. mysqld is an optimized server that is a smaller, faster binary. mysqld-debug is compiled with debugging support.
Each of these servers is compiled from the same source distribution, though with different configuration options. All native MySQL clients can connect to servers from either MySQL version.

Under some circumstances, you may be better off installing MySQL from a source distribution:
• You want to install MySQL at some explicit location. The standard binary distributions are ready to run at any installation location, but you might require even more flexibility to place MySQL components where you want.
• You want to configure mysqld to ensure that features are available that might not be included in the standard binary distributions. Here is a list of the most common extra options that you may want to use to ensure feature availability:
• --with-libwrap
• --with-named-z-libs (this is done for some of the binaries)
• --with-debug[=full]How and When Updates Are Released
For more detail please ref:-http://dev.mysql.com/doc/refman/5.x/en/source-configuration-options.html
• You want to configure mysqld without some features that are included in the standard binary distributions. For example, distributions normally are compiled with support for all character sets. If you want a smaller MySQL server, you can recompile it with support for only the character sets you need.
• You want to use the latest sources from one of the Bazaar repositories to have access to all current bugfixes. For example, if you have found a bug and reported it to the MySQL development team, the bugfix is committed to the source repository and you can access it there. The bugfix does not appear in a release until a release actually is issued.
• You want to read (or modify) the C and C++ code that makes up MySQL. For this purpose, you should get a source distribution, because the source code is always the ultimate manual.
• Source distributions contain more tests and examples than binary distributions.

#~~#What is the Difference Between MySQL Generic Binaries and RPM Binaries for Linux?
Q:-Is it possible to use the generic MySQL binaries on Linux platforms where an operating system specific version exists?
Ans:-The main difference between the generic Linux binaries and the platform specific ones is how the binaries have been packed. The generic binaries are packed in a
tar-ball that can be installed on any platform, including those where a specific version exists. Another difference is that the tar-balls include everything under one
subdirectory whereas for example an RPM will install each file in the location common for the platform.

Q:-What will be the impact on production database in terms of support and performance, if the generic Linux based binary installation is used rather than the
platform specific RPMs?
Ans:-There will not be any performance difference between installing the RPMs and using the generic tar-ball on a given system. The main difference is that the RPM automates the installation and upgrades to a larger degree than using the generic package.

Q:-What is Oracle recommending for selecting which MySQL binaries to use and what is "best practice"?
Ans:-Due to the easier maintenance when using the RPM installations, Oracle recommends using these if possible, although considerations such as installing into a nondefault

location will tend to favor using the tar-ball.

Connection lost between oracle server and client.(ORA-03135: connection lost contact,Fatal NI connect error 12170,TNS-12535: TNS:operation timed out,TNS-00505: Operation timed out)

                                 Connection lost between oracle server and client.


#~~#Error :- 
-1-At client side have received error code & message :- ORA-03135: connection lost contact
-2-In alert log file have received below error traces:-
Fatal NI connect error 12170.
  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.1.0 - Production
        Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
  Time: DD-MON-YYYY HH:MM:SS
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12560
    nt main err code: 505

TNS-00505: Operation timed out
    nt secondary err code: 110
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=X.X.X.X)(PORT=XXXX))

Note:- The "nt secondary err code" will be different based on the operating system.
Linux x86 or Linux x86-64: "nt secondary err code: 110"
HP-UX Server: "nt secondary err code: 238"
AIX: "nt secondary err code: 78"
Solaris system: nt secondary err code: 145:

RCA:-These timeouts shown in the alert log above is caused by an unexpected disconnect with the connected client.
There are two cases for this i.e Either the client has terminated the session abnormally or there was a network interruption that terminated the session.
The 110 in the error stack is the Operating System detected error, indicating a problem at the TCP layer.

Solution :-
1_ Check the client seen in the client address to see if the client caused this. If not check the network.
2_ It could be that the client was idle and often there are network devices such as firewalls that terminate idle sessions.
In this case the following can be set in the database sqlnet.ora file in an effort to keep the session alive.
sqlnet.expire_time=1

Ref Next Post :- Resolving Problems with Connection Idle Timeout With Firewall.