Apr 3, 2010

RAID

RAID an acronym for Redundant Array of Inexpensive Disks or Redundant Array of Independent Disks, is a technology that allows high levels of storage reliability from low-cost and less reliable PC-class disk-drive components, via the technique of arranging the devices into arrays for redundancy.

Consider Personal computer they come with more than enough memory, have more than enough processing power, and have lots of disk space. The one thing they don’t come with is a backup (or external) drive. if User need to protect their important files, such as e-mails, pictures , and all .Many homeowners don’t think about backups. They go on merrily for years, adding their financial data, their photographs, and their collections of e-mail to their hard drives. Then one day they realize about the hard drive failure. Their hard drive fails, their computer won’t boot . What about servers do they come with extra disks? Usually, yes, servers are ordered with extra disks. Depending on the model of the server, you will have a different number of options and disks available. The primary reason for extra disks, besides the need for disk capacity, is to protect yourself through the utilization of RAID in the event of a hard disk failure.

For example, Figure below shows one possible RAID configuration. In this Figure , three hard drives are tied together to appear as one. The same data gets written to all three drives. Because the three drives are mirror images of each other, we can trash one of the drives and still have access to our data on the other two. We can even trash two drives, leaving just one good one.

Figure 1



RAID for Performance

----------------------

RAID can also be utilized to improve performance. Knowing how to do that can be
helpful when trying to performance tuning queries. The faster you can read and write data to and from your disks, the faster your response times will be. You can use RAID to increase your I/O throughput by taking advantage of
striping your data across several disks at once.

For example, a traditional hard disk has a little arm inside of it that moves back and forth every time you want to read and write data. IF you had to do 50 read and 50 write operations, and each one took 1/50th of a second. Then it will take Two seconds on one disk . Now, configure RAID as shown in Figure below




Now you have two little arms moving back and forth across two disks at the same time. You would still have your two hundred operations to perform, but they would be done on two drives simultaneously. Each individual drive would get half the work. Your overall time would be reduced from two seconds to one second.
Another method for improving performance would be caching. Most RAID controllers
allow for some amount of data to be stored in cache.

---------------------------------------------------------

RAID for Fault Tolerance

RAID uses two methods to provide for fault tolerance: mirroring and parity. Mirroring is exactly what it sounds like: you have two (or more) copies of your data on two (or more) different disks. As in Figure 1

Parity occurs when you add extra data called parity data to one of your disks, which can then be used to reconstruct your real data when one disk fail

Raid Level 0 (RAID 0) - Striped Disk Array without Fault Tolerance: Provides data striping (spreading out blocks of each file across multiple disk drives) but no redundancy. This improves performance but does not deliver fault tolerance. If one drive fails then all data in the array is lost.

RAID 0 is also used in some gaming systems where performance is desired and data integrity is not very important.#and in Video Production and Editing,
,Image Editing, Pre-Press Applications,any application requiring high bandwidth

RAID 1 - Mirroring and Duplexing: Provides disk mirroring.

A RAID 1 creates an exact copy (or mirror) of a set of data on two or more disks. This is useful when read performance or reliability are more important than data storage capacity. A classic RAID 1 mirrored pair contains two disks

Characteristics & Advantages

One Write or 2 Reads possible per mirrored pair.Twice the Read transaction rate of single disks, same Write transaction rate as single disks.100% redundancy of data means no rebuild is necessary in case of a disk failure, just a copy to the replacement disk.Simplest RAID storage subsystem design

Recommended Applications

Accounting,Payroll,Financial,Any application requiring very high availability

RAID 5
-------

This level is also known as striping with parity. It is very similar to RAID 0, with one additional disk needed to hold the parity bit that gets striped across all disks. . Without a doubt, RAID 5 is a favorite RAID level,
and I have seen it used by many administrators.The reason for RAID 5 being so well liked is that if one disk fails, you simply have to add in a new disk (before a second disk fails; otherwise, you lose everything) and the array will rebuild itself. While RAID 5 can offer better performance than RAID 1, the overhead for that parity bit means it will not perform as well as RAID 0. But you do get fault tolerance with RAID 5, and that is why so many administrators love using RAID 5 over anything else.

Mar 31, 2010

LOCKING IN ORACLE

Two types of Locking


In Optimistic locking the row will not be locked until the actual update is performed. In order to prevent the lost update issue a version number column will be used.

In Pessimistic locking the row will be locked at the time when the data is selected from the database. This will prevent other users who want to update the same record. This should not prevent the readers but this behaviour varies from database to database.


Optimistic : One who usually expects a favorable outcome
Pessimistic : Expecting the worst possible outcome (negative)



The Oracle database uses Optimistic locking by default. Any command that begins with UPDATE SET that is not preceded by a SELECT FOR UPDATE is an example of optimistic locking.

SELECT ..... FOR UPDATE ,
SET TRANSACTION ISOLATION LEVEL,
LOCK TABLE PROJECT_MASTER IN ROW EXCLUSIVE MODE
are examples of Pessimistic locking


Pessimistic has two major problems

The Lockout
- An application user selects a record for update, and then leaves for lunch without finishing or aborting the transaction. All other users that need to update that record are forced to wait until the user returns and completes the transaction, or until the DBA kills the offending transaction

The Deadlock
- Users A and B are both updating the database at the same time. User A locks a record and then attempt to acquire a lock held by user B - who is waiting to obtain a lock held by user A. Both transactions go into an infinite wait state - the so-called deadly embrace or deadlock.

Mar 26, 2010

WIDTH_BUCKET

Syntax:

WIDTH_BUCKET(column-name/expr, low/min,high/max,bucket_count) ;

Divide a set o data into buckets (ie: partition ) with an equal interval.

eg : Number of Cars 0-10 , 10-20 ,30-40 ,40-50

If we specify n buckets then n+2 buckets are generated .The extra 2 buckets are value above the high/max boundary and below the low/min boundary.

select WIDTH_BUCKET(sal,1000,10000,3) util ,sal from (select 5700 sal from dual
union
select 500 sal from dual
union
select 1000 sal from dual
union
select 6000 sal from dual
union
select 9000 sal from dual
union
select 90000 sal from dual
union
select 4500 sal from dual)


Instead of Width_bucket Case Function can be used .But here we want to manually divide the range there may or may not be equal interval its all up to the SQL programmer .


Syntax:

CASE WHEN THEN
WHEN THEN
[ELSE Value n ] END


SELECT SUM(CASE WHEN SUM(amount) BETWEEN 0 AND 49 THEN 1
ELSE 0 END) AS "0-49", SUM(CASE WHEN SUM(amount) BETWEEN 50 AND 100
THEN 1 ELSE 0 END) AS "50-100"  FROM sales


-----------

Benchmark

A benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object


Benchmark Factory ( ie : is a product of QUEST SOFTWARE)is a database performance and code scalability testing tool that simulates users and transactions on the database and replays production workload in non-production environments. . This enables developers, DBAs, and QA teams to validate that their databases will scale as user load increases, application changes are made, and platform changes are implemented.

Benchmark Factory places enormous stress on a database system, which is typically hard to achieve in a standard testing environment.

A system typically breaks under extreme load. By identifying system capacity and performance bottlenecks before they occur,

Benchmark Factory facilitates proactive testing, which in turn reduces downtime, development costs, and potential loss of revenue.

Benchmark Factory allows you to:

Determine system throughput and capacity for database systems

Simulate thousands of concurrent users with a minimal amount of hardware

Find applications that do not scale well with an increase in the number of users

Find breaking points, weak links, or bottlenecks of a system

Quantify application or server performance

Mar 22, 2010

Data Center

The data center is the hub of IT organizations, a provider of business efficiencies (performance)delivered through mission-critical data and business applications, and a serious consumer of resources, including electricity.

Grid computing pools and provisions groups of servers depending on business demands, and it is a key part of the next-generation data center.

Oracle Real Application Clusters (Oracle RAC), a key component of Oracle Grid Computing.


Carbon emission is a problem of Data Center.

Excessive energy consumption becomes an issue for a data center .
It can limit the growth of that data center. There can be enough money, enough physical space, and enough business requirements to grow the data center, but sometimes the actual power availability into the building can become a limitation.

The greatest consumers of energy in the data center are heating and cooling. The rule of thumb is that about half of the energy going into a data center is for air conditioning to cool the equipment that produces heat. “Only a small proportion of the energy going into a data center produces the data processing that you really want.


Many servers run at 50 percent or less of their capacity but still have to be kept running. Virtualization helps us run individual servers at a much higher capacity, which means we don’t need to run nearly as many servers for the same amount of data processing.




Green Computing


The Oracle Grid Computing architecture can improve energy efficiency and data center productivity, making a “greener” data center. Some of the enabling functionality includes the following:

* Server virtualization and consolidation using Oracle Real Application Clusters, Oracle Application Server clusters, and Oracle VM save energy and lower system management overhead.

* Storage virtualization consolidation using Oracle Automatic Storage Management and Oracle Advanced Compression can save energy because companies that use fewer disks will consume less power. More-centrally managed storage also means less administrative overhead.

* Workload management using Oracle Enterprise Manager allows companies to manage spare capacity to provide more processing power to development, test, and production systems.