Wednesday 27 February 2013

Partitioning

What is Partitioning
Partitioning is the way to manage very large database easily and on finer level. Using portioning   You can divide tables ,index and IOT into small parts .

Benefits of partitioning
It enhanced the performance, availability and manageability of large databases.A  database administrator can manage tables as multiple pieces collectively or individually. There is a greater ability for parallelism with more partitions

 1 ) Availability of data:
Partitioning increase the availability of data in production environment  i.e  if one
Partition is unavailable all other partition of the table are available for accasses.

2) Easier Management
It is easy to manage a small partitions i.e de-fragmentation ,index rebuild move tables then  if you manage a single 200gb table .

3) Enhance performance
It may reduce the high contention on same segments  and enhance performance .As we can  spared  the data on  many disk using portioning .

4) Partition Pruning
Partition pruning  use to improve performance using partitioning.
i.e Oracle table have data of 10 years and you have partitioned   it year wise  A query requesting orders for a single year would only access a single partition of the oracle table. This query could potentially execute 10 times faster simply because of partition pruning.

When to  Partitioned  Tables

  • Tables greater than 2 GB should always be considered as candidates for partitioning.
  • Tables containing historical data, in which new data is added into the newest partition. A typical example is a historical table where only the current month's data is updatable and the other 11 months are read only.
  • When the contents of a table need to be distributed across different types of storage devices.
When to Partition an Index
  • Avoid rebuilding the entire index when data is removed.
  • Perform maintenance on parts of the data without invalidating the entire index.
  • Reduce the impact of index skew caused by an index on a column with a monotonically increasing value.
When to  Partitioned Index-Organized Tables
  • Partitioned index-organized tables are very useful for providing improved performance, manageability, and availability for index-organized tables.
  • For partitioning an index-organized table:
  • Partition columns must be a subset of the primary key columns
  • Secondary indexes can be partitioned (both locally and globally)
  • OVERFLOW data segments are always equi-partitioned with the table partitions
Types of  partitions

Range partitioning
Range partitioning is based on the partition key falling within a specified range of values.
Range partitioning is useful when you have distinct ranges of data you want to store together.


CREATE TABLE whr_data1
( range_1   NUMBER NOT NULL,
data_date   DATE   NOT NULL,
)
PARTITION BY RANGE (data_date)
(PARTITION part1 VALUES LESS THAN (TO_DATE('01/01/2011' ,'DD/MM/YYYY')) TABLESPACE tbs1,
 PARTITION part2 VALUES LESS THAN (TO_DATE('01/01/2012', 'DD/MM/YYYY')) TABLESPACE tbs2);


Hash partitioning
Hash partitioning uses a hash function applied to one or more columns, to uniquely determine the partition for each row in a table.Hash partitioning is useful when there is no obvious range key, or range partitioning will cause uneven distribution of data

CREATE TABLE whr_hash
( range_1   NUMBER NOT NULL,
data_date   DATE   NOT NULL,
)
PARTITION BY HASH (data_date)
PARTITIONS 2
STORE IN (tbs1, tbs2);


List  partitioning
List partitioning is based on each partition being associated with an explicit list of values. It's more flexible then hash and range partion you can associate the diffrent type of data within single partition

CREATE TABLE whr_list
(stu_code    NUMBER NOT NULL,
stu_name varchar2(50),
stu_add varchar2(200)
)
PARTITION BY list (stu_name)
(
  PARTITION ATON VALUES ('vanita', 'jannat', 'kiran'),
  PARTITION NTOZ VALUES ('Sumit'),
);


Composite  partition
 Composite  partition  is the combination of different partition type .when you create composite partition there is only sub partition  physically exists . Partition are logical container and sub partition  are actual segment

CREATE TABLE  whr_comp
(data_code    NUMBER NOT NULL,
 data_date  DATE   NOT NULL
)
PARTITION BY RANGE (data_date
SUBPARTITION BY HASH (data_code)
SUBPARTITIONS
(PARTITION part1 VALUES LESS THAN (TO_DATE('01/01/2011', 'DD/MM/YYYY')) TABLESPACE tbs1,
 PARTITION part2 VALUES LESS THAN (TO_DATE('01/01/2012', 'DD/MM/YYYY')) TABLESPACE tbs2
);


Composite Range-Range Partitioning
Composite range-range partitioning enables logical range partitioning along two dimensions; for example, partition by order_date and range subpartition by shipping_date.
Composite Range-Hash Partitioning
Composite range-hash partitioning partitions data using the range method, and within each partition, subpartitions it using the hash method. Composite range-hash partitioning provides the improved manageability of range partitioning and the data placement, striping, and parallelism advantages of hash partitioning.
Composite Range-List Partitioning
Composite range-list partitioning partitions data using the range method, and within each partition, subpartitions it using the list method. Composite range-list partitioning provides the manageability of range partitioning and the explicit control of list partitioning for the subpartitions.
Composite List-Range Partitioning
Composite list-range partitioning enables logical range subpartitioning within a given list partitioning strategy; for example, list partition by country_id and range subpartition by order_date.
Composite List-Hash Partitioning
Composite list-hash partitioning enables hash subpartitioning of a list-partitioned object; for example, to enable partition-wise joins.
Composite List-List Partitioning
Composite list-list partitioning enables logical list partitioning along two dimensions; for example, list partition by country_id and list subpartition by sales_channel.

Monday 25 February 2013

how to install rpms and rpm list for 11g

how to  check rpm installed 

 rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}  (%{ARCH})\n' \
              binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs \
              libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio
rpm -q|grep rpmname

how to install rpm

#  rpm -Uvh  compat-libstdc++-33-3.2.3-61.x86_64.rpmwarning: compat-libstdc++-33-3.2.3-61.x86_64.rpm: V3 DSA signature: NOKEY, key ID 1d1e034b
Preparing...                ########################################### [100%]
 1:compat-libstdc++-33    ########################################### [100%]

If you find confiction the i.e

 file /usr/share/man/man1/strip.1.gz from install of binutils-2.15.92.0.2-10.EL4 conflicts with file from package binutils-2.15.92.0.2-15

you can overwite the old packegae

 rpm -ivh  --force --oldpackage  gcc-c++-3.4.6-3.1.x86_64.rpm

can check which files have been created by a specific rpm

# rpm -qpl postgresql91-odbc-09.00.0310-1PGDG.rhel5.x86_64.rpm
/usr/pgsql-9.1/lib/psqlodbc.so
/usr/pgsql-9.1/lib/psqlodbcw.so
/usr/share/doc/postgresql91-odbc-09.00.0310
/usr/share/doc/postgresql91-odbc-09.00.0310/license.txt
/usr/share/doc/postgresql91-odbc-09.00.0310/readme.txt

RPM's required to install 11g on linx are given below

The following or later version of packages for Oracle Linux 4 and Red Hat Enterprise Linux 4 must be installed:
binutils-2.15.92.0.2
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.97
elfutils-libelf-devel-0.97
expat-1.95.7
gcc-3.4.6
gcc-c++-3.4.6
glibc-2.3.4-2.41
glibc-2.3.4-2.41 (32 bit)
glibc-common-2.3.4
glibc-devel-2.3.4
glibc-headers-2.3.4
libaio-0.3.105
libaio-0.3.105 (32 bit)
libaio-devel-0.3.105
libaio-devel-0.3.105 (32 bit)
libgcc-3.4.6
libgcc-3.4.6 (32-bit)
libstdc++-3.4.6
libstdc++-3.4.6 (32 bit)
libstdc++-devel 3.4.6
make-3.80
numactl-0.6.4.x86_64
pdksh-5.2.14
sysstat-5.0.5
The following or later version of packages for Asianux 3, Oracle Linux 5, and Red Hat Enterprise Linux 5 must be installed:
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
sysstat-7.0.2
The following or later version of packages for Oracle Linux 6, and Red Hat Enterprise Linux 6 must be installed:
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6.i686
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
The following or later version of packages for SUSE Linux Enterprise Server 10 must be installed:
binutils-2.16.91.0.5
compat-libstdc++-5.0.7
gcc-4.1.0
gcc-c++-4.1.2
glibc-2.4-31.63
glibc-devel-2.4-31.63
glibc-devel-32bit-2.4-31.63
ksh-93r-12.9
libaio-0.3.104
libaio-32bit-0.3.104
libaio-devel-0.3.104
libaio-devel-32bit-0.3.104
libelf-0.8.5
libgcc-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.80
numactl-0.9.6.x86_64
sysstat-8.0.4
The following or later version of packages for SUSE Linux Enterprise Server 11 must be installed:
binutils-2.19
gcc-4.3
gcc-32bit-4.3
gcc-c++-4.3
glibc-2.9
glibc-32bit-2.9
glibc-devel-2.9
glibc-devel-32bit-2.9
ksh-93t
libaio-0.3.104
libaio-32bit-0.3.104
libaio-devel-0.3.104
libaio-devel-32bit-0.3.104
libstdc++33-3.3.3
libstdc++33-32bit-3.3.3
libstdc++43-4.3.3_20081022
libstdc++43-32bit-4.3.3_20081022
libstdc++43-devel-4.3.3_20081022
libstdc++43-devel-32bit-4.3.3_20081022
libgcc43-4.3.3_20081022
libstdc++-devel-4.3
make-3.81
sysstat-8.1.5