Saturday, November 22, 2014

Two Phase Commit Protocol in Animation

Two Phase Commit protocol animated / Animation of Two Phase Commit protocol

Two Phase Commit protocol is used to ensure atomicity of transactions in Distributed database system. Using this, we can perform a consistent transactions which lead to consistent database.





Important links - Two Phase Commit protocol - in text
                                                                                 in Pictures


Developed by: Mr. Nilesh Kesharwani, and Ms. Sushmita Kumari








Thursday, November 20, 2014

ORDBMS Structured Types



Define Structured Types / Overview of Structured Types / What is Abstract Datatype? / How to define Structured types or Abstract datatypes? / Structured type (Abstract datatype) definition in Oracle with example.


Structured Types

The major advantage of using objects is the ability to define new data types (Abstract Data Types). In ORDBMS, the RDBMS extends the usage of objects that can be defined and stored as part of database. Like a CLASS declaration in C++ language, a new type can be defined in an ORDBMS as follows; (the reserved words/keywords are given in UPPERCASE hereafter)

CREATE TYPE type_name AS
(Attribute1_name data_type(size),
Attribute2_name data_type(size),
Attribute3_name data_type(size),
…….
AttributeN_name data+_type(size));

Here, data_type can be any of the following;

  • It can be one of the valid data types like CHAR, VARCHAR, NUMBER, INTEGER, etc. Or
  • It can be another User Defined Type.

We call this kind of new User Defined Types as Structured Types / Abstract Datatypes.

For example, Structured types can be declared and used in SQL:1999 as follows;
CREATE TYPE phone AS
(Country_code NUMBER(4),
STD_Code NUMBER(5),
Phone_Number NUMBER(10))

This type can be used in other TYPE definition or TABLE definition as follows;
CREATE TABLE contact
(Contact_name VARCHAR(25),
Street VARCHAR(25),
City VARCHAR(25),
Ph PHONE);

In this TABLE definition, PHONE is the structured type that we have defined through previous example.

Structured Types in Oracle

Let us see some examples of defining and manipulating Structured types in Oracle.

CREATE TYPE Address AS OBJECT
(Street VARCHAR(35),
City VARCHAR(30),
State VARCHAR(30),
Pincode NUMBER(10));
Execution of the above statement will create a new ABSTRACT datatype named ADDRESS and store the definition as part of the database.
This new type can be used to define an attribute in any TABLEs or TYPEs as follows;

CREATE TABLE Person
(Person_name VARCHAR(25),
Addr ADDRESS,
Phone NUMBER(10));

This table Person will consist of 3 columns where the first one and the third one are of regular datatypes VARCHAR, and NUMBER respectively, and the second one is of the abstract type ADDRESS. The table PERSON will look like as follows;

Person_name
Addr
Phone
Street
City
State
Pincode






Table 1 – Person table


Monday, November 10, 2014

Major Features of Object Relational DBMS (ORDBMS)

List the major features of ORDBMS / What are the important features of ORDBMS? / Apart from features of RDBMS, what are the other Object oriented features supported by ORDBMS?




Major Features of ORDBMS


  • User-defined abstract data types (ADTs) - ADTs allow new data types with structures suited to particular applications to be defined.

  • User-defined routines – these provide the means for writing customized server functions that have much of the power and functionality expressible in C.

  • Inheritance - inheritance of user defined types is supported to derive new sub-types or sub-classes which would therefore inherit all attributes and methods from the parent type.

  • Encapsulation - encapsulation is a language mechanism for restricting access to some of the object's components.

  • Complex objects including first normal form objects.

  • Object Identity – OIDs are used to identify objects.

  • Large objects support - these are disk-based objects that have the functionality of random access files. ADTs use them to store any data that does not fit into a table row.

  • Extensible and flexible indexing - R-tree or Generalized Search Tree (GiST) indexing for multi-dimensional data enables fast searching of particular ADTs in a table.


Disadvantages of ORDBMS

List the disadvantages of ORDBMS / What are the disadvantages of ORDBMS?



Disadvantages of ORDBMSs

  • Complexity

  • Increased cost

  • Unclear if the ORDBMS will actually combine relationships and encapsulated objects to correctly and completely mirror the ‘real world’.


Advantages of ORDBMS

List the advantages of ORDBMS / What are the advantages of ORDBMS?




Advantages of ORDBMSs

  • Reusable and Sharable – able to reuse the hard-coded components. Through database servers those components can be shared among available resources.

  • Ability of applying Objects with existing RDBMS models as it is – That is, RDBMS can be extended with Object concepts without changing the underlying models. This leads the organizations to switch over to ORDBMS concepts easily without performing bigger migration or major changes.

  • It allows users and programmers to start using object-oriented systems in parallel.

  • Object Relational Database Management Systems ensures large storage capacity.

  • Supports rich data types by adding a new object-oriented layer.

  • Scalability

  • Relationships are represented explicitly, often supporting both navigational and associative access to information.

  • Improved concurrency - concurrent users can safely query the same data.

  • Support for Composite data types - data is bundled with its metadata.

  • Improved integrity - ability to reject bad data before it is stored in an ORDBMS.

  • Database extensibility - easy addition of data types and operations.

  • Uniform treatment of data items - the SQL interface can perform complex queries based on any of these data items, e.g., metadata as well as data; hence there is less need for custom programming by users.

  • Custom data access methods - e.g., R-tree indexes.

  • Point-in-time recovery of data is possible.

  • Built-in complex SQL functions can be provided for data operations - e.g., aggregating, slicing, subsetting, reprojecting, etc.