Tuesday, 27 August 2013

When “oracleasm createdisk” command fails.

 Let me first post the details on the system I am working on,
Oracle Enterprise Linux 64bit on an Oracle Virtual Box.

I was trying to setup a standalone DB server on ASM disk.

These are the steps I followed,
1)      Download and install “kmod-oracleasm” using “# yum install kmod-oracleasm”
2)      Next download and install “# yum install oracleasm-support”

To make sure all the libs for ASM are available    
        

Then I tried creating disk I got this error





I made sure all the libs for ASM are up to date and matches all the requirement. There are no previous ASM installation on the same disk. Still I got this error.

Now let tell you the solution,

This is the security issue that’s stopping you from creating ASM disks. What you need to do is disable SELinux and reboot the machine and try again.

Steps:













Once the machine is rebooted check weather SELinux disabled are not? # /usr/sbin/getenforce

Now try crating ASM disk





Listdisks









Hope this document would have helped you.

Thanks
Sushanth Shanthimoole

Wednesday, 7 August 2013

HTTP v/s HTTPS

What is HTTPS?

HTTPS (Hypertext Transfer Protocol over Secure Socket Layer, or HTTP over SSL) is a web protocol developed by Netscape.

One can say: HTTPS = HTTP + SSL

HTTPS uses Secure Socket Layer (SSL) as a sublayer under its regular HTTP application layering.

Need of HTTPS:
Hypertext Transfer Protocol (HTTP) is a protocol for transmitting and receiving information across the Internet. HTTP serves as a request and response procedure that all agents on the Internet follow so that information can be rapidly, easily, and accurately disseminated between servers, which hold information, and clients, who are trying to access it. You normally use HTTP when you are browsing the web, its not secure, so someone can eavesdrop on the conversation between your computer and the web server. In many cases, clients may be exchanging confidential information with a server, which needs to be secured in order to prevent unauthorized access. For this reason, https, or secure http, was developed by Netscape corporation to allow authorization and secured transactions.

Similarity between HTTP and HTTPS:

In many ways, https is identical to http, because it follows the same basic protocols. The http or https client, such as a Web browser, establishes a connection to a server on a standard port. When a server receives a request, it returns a status and a message, which may contain the requested information or indicate an error if part of the process malfunctioned. Both systems use the same Uniform Resource Identifier (URI) scheme, so that resources can be universally identified. Use of https in a URI scheme rather than http indicates that an encrypted connection is desired.


Difference between HTTP and HTTPS:

1. URL begins with “http://" in case of HTTP while the URL begins with “https://” in case of HTTPS.
2. HTTP is unsecured while HTTPS is secured.
3. HTTP uses port 80 for communication while HTTPS uses port 443 for communication.
4. HTTP operates at Application Layer while HTTPS operates at Transport Layer.
5. No encryption is there in HTTP while HTTPS uses encryption.
6. No certificates required in HTTP while certificates required in HTTPS.

How HTTPS works?

For HTTPS connection, public key and signed certificates are required for the server.
When using an https connection, the server responds to the initial connection by offering a list of encryption methods it supports. In response, the client selects a connection method, and the client and server exchange certificates to authenticate their identities. After this is done, both parties exchange the encrypted information after ensuring that both are using the same key, and the connection is closed. In order to host https connections, a server must have a public key certificate, which embeds key information with a verification of the key owner's identity. Most certificates are verified by a third party so that clients are assured that the key is secure.
In other words, we can say, HTTPS works similar to HTTP but SSL adds some spice in it.

HTTP includes the following actions:

1. The browser opens a TCP connection. 
2. The browser sends a HTTP request to the server 
3. The server sends a HTTP response to the browser
 4. The TCP connection is closed.

SSL will include the following actions:
1. Authenticate the server to the client. 
2. Allow the client and server to select the cryptographic algorithms, or ciphers, that they both support. 
3. Optionally authenticate the client to the server. 
4. Use public-key encryption techniques to generate shared secrets. 
5. Establish an encrypted SSL connection.
6. Once the SSL connection is established the usual transfer of HTTP requests will continue.

Tuesday, 6 August 2013

How does Hard drive disks work?

Internal of a hard disk drive
If you are to dismantle the hard disk drive by opening the top casing (after removing all the necessary screws), the first thing you'll see is a spindle holding one or a number of mirror-like hard rotating platters (commonly called data platter). The platters could be made to spin at an extremely high speed, technically between 5,400 to 10,000 revolutions per minute (RPM). An extremely thin magnetic coating is layered onto the surface of the platter that is polished to mirror-type smoothness.

The platter is usually made of glass or ceramic (modern platter may use titanium). Unlike a floppy disk, the platter cannot be bent or flipped and hence we coin it as "hard disk" or "hard drive". Commonly a hard disk contains 1 to 10 identical platters that are stacked in parallel to form a cylinder. There is usually one Read Write (RW) head designated per platter face, and each head is attached to a single actuator shaft which moves all heads in unison and performs a uniform synchronous motion during reading or writing of data.

Data on a hard disk is stored in microscopic areas called magnetic domains on the magnetic material. Each domain stores either a 1 or 0 value. Similar to a floppy disk, a hard disk records its data in concentric circles or tracks, which are numbered from the outermost edge to the innermost edge of the platter. These tracks are further subdivided into smaller units called sectors which typically store 512 bytes of data each. Zoning may be needed to further optimise the data storage as the outer circumference would normally pack more sector units than the inner circumference.


Read Write Head
The RW head is the key component that performs the reading and writing functions. It is placed on a slider which is in term connected to an actuator arm which allow the RW head to access various parts of the platter during data IO functions by sliding across the spinning platter.
The sliding motion is derived by passing a current through the coil which is part of the actuator-assembly. As the coil is placed between two magnets, the forward or backward sliding motion is hence derived by simple current reversal. This location of the platter (just like the landmark along the road) is identified and made possible by the embedded servo code written on the platter.

Flying Height
To write a piece of information to the disk, an electromagnetic flux is transmitted through the head which hovers very closely to the platter. The RW head suspends on a thin cushion of air which the spinning platter induces. This designed distance between the head and platter is called the flying height. It can literally measure to a few millionths of an inch. A good analogy is to try to imagine flying a Boeing 747 with about 6 inches above ground level.

It is therefore easy to understand that if the RW head happens to "knock" on the spinning platter out of design specification, a Read Write head crash occurs.

 Read Write Function of Disk
As the head writes data onto the disk, it changes its magnetic polarization to induce either a one or zero value. During a read request, data is interpreted when the magnetic fields on the platter brings about an electrical change (as a result of change in electrical resistance of some special material property) in the read-head that passes over it. These electrical fields are then encoded and transmitted to the CPU to be processed and read by the system.

Parking of RW Head
The read/write head will move to the parking zone when the computer is switched off.
When the computer is switched off, the head is usually pulled to a safe parking zone to prevent the head from scratching against the data zone on platter when the air bearing subsides. This process is called a parking and different techniques have been implemented in various hard disks to handle the take offs and landings. In a Ramp load/unload design, a lifting mechanism parks the head outside of the platter onto a "parking bay" prior to a shutdown. It then automatically unparks and relocates itself above the disk platter when the platter spins up to appropriate rotational speed.

Hard Disk Controller PCB Board
A hard disk also contains a pcb controller circuit board that regulates data traffic. It ensures massive data to be streamed in and out of the disk smoothly. A logic board that sits under the drive controls and connects the spindle, head actuator, and various disk functions of the disk. Embedded with a micro-controller, it executes self-diagnostics test and cleans up data working area in the memory and all internal chip bus in the hard drive when it powers up.

Today's Disk and Data
Storage capacity is measured in terms of GB (Gigabyte). 1 Gb roughly equals to 1000 MB (Megabyte). A typical desktop machine purchased today carries a hard disk of at least 80 to 400 gigabyte. Computer data is stored onto the disk logically in the form of files or simply, a string of bytes. When a program requests for a file, the hard disk retrieves its bytes and sends them to the CPU to be processed.

There're two popular ways to measure the performance of a hard disk:

Data Rate
Data rate is also known as data transfer rate or throughput. It refers to the speed with which the data can be transmitted from one device to another. Data rates are commonly measured in megabytes (MB) per second. The data rates for a typically hard disk ranges between 5 to 40 megabytes per second.


Seek Rate
Seek time refers to the total span of time between a file request by the CPU to the point when the first byte of the file is sent to the CPU. This is one of the several delays associated with reading or writing data on a computer's disk drive. In order to read or write data in a particular place on the disk, the read/write head needs to manoeuvre to the precise location of the disk platter. This process is known as "seeking", and the time it takes for the head to move to the right place is referred to the "seek time". A typical seek time for a hard disk is about 9 to 15.


S.M.A.R.T
Majority of all hard disk today support a technology known as S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) which helps to predict imminent disk failures so that users can be alerted to take preventive actions before the disk fails completely.

SSD/Flash Disk Endurance and Performance issue

The original flash technology, SLC (Single Level Cell) NAND stores one data bit (single level) in each cell. To produce better bit density and increase capacity, MLC (Multi-Level Cell) NAND was developed which can store two bits of information in the same physical location that SLC stores one bit

But MLC has Lower Endurance. All flash devices can sustain a finite number of writes and erasures, also called program/erase cycles, or (P/E cycles). Partly because MLC media stores twice the information in the same physical space, its maximum endurance (measured in P/E cycles) is significantly lower than SLC media, by roughly a factor of 10. In NAND flash storage, cost is a function of endurance -- the faster a device wears out, the more often it must be replaced. This endurance issue reduces the cost advantages MLC enjoys.

A common way to express lifespan is in Total Bytes Written (TBW), which is a product of the P/E cycles and the capacity of the flash device itself. Aside from MLC’s lower TBW, some of the characteristics of flash storage applications can exacerbate its endurance problem. Processes like caching and storage tiering generate more P/E cycles, hastening wear out. Also, the shrinking lithographies inherent in the evolution of semiconductor-based products, like flash memory, increase bit errors that further reduce useful life.

NAND flash stores the information by controlling the amount of electrons in a region called a “floating gate”. These electrons change the conductive properties of the memory cell (the gate voltage needed to turn the cell on and off), which in turn is used to store one or more bits of data in the cell. This is why the ability of the floating gate to hold a charge is critical to the cell’s ability to reliably store data.

When written to and erased during the normal course of use, the oxide layer separating the floating gate from the substrate degrades, reducing its ability to hold a charge for an extended period of time. Each solid-state storage device can sustain a finite amount of degradation before it becomes unreliable, meaning it may still function but not consistently. The number of writes and erasures (P/E cycles) a NAND device can sustain while still maintaining a consistent, predictable output, defines its endurance.

NAND wear is a fact of life in flash storage products, and a result of normal operation. Endurance of the cells, and ultimately the lifespan of the storage product itself, is increased by minimizing this wear and improving the device’s ability to consistently read data despite this normal degradation. Advanced SSD controller technologies, like  STEC’s CellCare, can significantly increase MLC flash endurance by utilizing sophisticated write and erase processes that reduce NAND cell wear, as well as the use of software routines, like DSP, and sophisticated error correction algorithms to increase read reliability.

Monday, 5 August 2013

PCTFREE and PCTUSED - Data block parameters

When creating blocks, set the storage parameters to specify the way the data is stored, how much space is to be used and to improve performance of the database during transactions


PCTFREE and PCTUSED

These parameters are used to set the space available to insert and update the blocks

PCTFREE
This parameter is used to set the free space in a block that can be used for future updates.

            PCTUSED
PCTUSED for a data segment represents the minimum percentage of used space that the Oracle server tries to maintain for each data block of the table. 

Some points to remember when setting the values:
•The sum of PCTFREE and PCTUSED should not be more than 100.
•Set a low PCTFREE and a high PCTUSED if the table has many inserts and deletes and the updates do not increase the row length.
•A high PCTFREE helps in reusing the free space faster
•Set a low PCTFREE value if the table does not have updates and row lengths are large.
•PCTFREE is set when creating tables, cluster and indexes, but PCTUSED cannot be set when creating indexes.