Thursday, 6 October 2011

Oracle Architecture

Overview of Primary Components
The Oracle architecture includes  many primary components, which are discussed below.
Oracle instance: An Oracle instance is the combination of the background processes and the memory structures. The instance must be started to access the database. When instance started, a System Global Area (SGA) is allocated and Oracle background processes are started.  
Oracle database: An Oracle database consists of operating system files, also called database files, that provide the actual physical storage for database information. The database files are used to ensure that the data is kept consistent and can be recovered in the event of a failure of the instance.
User and server processes: The user and server processes are the primary processes which involved when a SQL statement is executed, however, other processes can also help the server complete the processing of the SQL statement.

Sunday, 2 October 2011

PCTFree & PCTUsed

It is used to mention how much space should be Free in the Data Block for future update:

Its is used to mention that how much Data Block should be filled before any new insertion. This parameter worked when the data block reached PCT Free threshold and new insertion stop filling and then this block will start insertion when data block get empty until reached PCTUsed limit.

Lets suppose you have specified PCTFree as 10 % and PCTUsed as 20 %.
  • Oracle will keep inserting new rows until the space is reached 90 %. It will reserve the remaining 10%(PCTFree) for future updates.
  • To start adding new rows again to the data block, Oracle will check the space in the Data Block and the PCTUsed parameter.
  • When the Data Block space falls below 20 %(PCTUsed, Oracle will start adding new rows to the Data Block.

Sunday, 25 September 2011

RMAN-06059: expected archived log not found

RMAN-06059: expected archived log not found RMAN attempted to backup an archive log file, but couldn't find it. This can happen for a variety of reasons; the file has been manually moved or deleted, the archive log destination has recently been changed, the file has been compressed, etc. Your options are either to restore the missing file(s), or to perform a crosscheck. To perform a crosscheck, run the following command from within RMAN: change archivelog all crosscheck; It is advisable to perform a full backup of the database at this point. When an archive log crosscheck is performed, RMAN checks each archive log in turn to make sure that it exists on disk (or tape). Those that are missing are marked as unavailable. If you have got missing logs, this won't bring them back. It will allow you to get past this error and back-up the database though.

Blogger Labels: RMAN,backup,archive,destination,database,disk,logs,error,options,crosscheck

Sunday, 19 June 2011

SQL Operators

There are two type of Operators, namely Comparison Operators and Logical Operators. These operators are used mainly in the WHERE clause, HAVING clause to filter the data to be selected.

Comparison Operators:

Comparison operators are used to compare the column data with specific values in a condition.
Comparison Operators are also used along with the SELECT statement to filter data based on specific conditions.
The below table describes each comparison operator.


Logical Operators:

There are three Logical Operators namely AND, OR and NOT.
Logical operators are discussed in detail in the next section.


The WHERE Clause is used when you want to retrieve specific information from a table excluding other irrelevant data. For example, when you want to see the information about students in class 10th only then you do need the information about the students in other class. Retrieving information about all the students would increase the processing time for the query.
So SQL offers a feature called WHERE clause, which we can use to restrict the data that is retrieved. The condition you provide in the WHERE clause filters the rows retrieved from the table and gives you only those rows which you expected to see. WHERE clause can be used along with SELECT, DELETE, UPDATE statements.
Syntax of SQL WHERE Clause:
WHERE {column or expression} comparison-operator value
Syntax for a WHERE clause with Select statement is:
SELECT column_list FROM table-name
WHERE condition;

  • column or expression - Is the column of a table or a expression
  • comparison-operator - operators like = < > etc.
  • value - Any user value or a column name for comparison
For Example: To find the name of a student with id 100, the query would be like:
SELECT first_name, last_name FROM student_details WHERE id = 100;
Comparison Operators and Logical Operators are used in WHERE Clause. These operators are discussed in the next chapter.
NOTE: Aliases defined for the columns in the SELECT statement cannot be used in the WHERE clause to set conditions. Only aliases created for tables can be used to reference the columns in the table.

How to use expressions in the WHERE Clause?

Expressions can also be used in the WHERE clause of the SELECT statement.
For example: Lets consider the employee table. If you want to display employee name, current salary, and a 20% increase in the salary for only those products where the percentage increase in salary is greater than 30000, the SELECT statement can be written as shown below
SELECT name, salary, salary*1.2 AS new_salary FROM employee WHERE salary*1.2 > 30000;
name salary new_salary
Khurram 35000 37000
Faraz 35000 37000
Ayaz 30000 360000

Friday, 17 June 2011

Setting up Oracle DataGuard for 10g

Technorati Tags:
Oracle Data Guard ensures high availability, data protection, and disaster recovery for enterprise data. Data Guard provides a comprehensive set of services that create, maintain, manage, and monitor one or more standby databases to enable production Oracle databases to survive disasters and data corruptions. Data Guard maintains these standby databases as transactionally consistent copies of the production database. Then, if the production database becomes unavailable because of a planned or an unplanned outage, Data Guard can switch any standby database to the production role, minimizing the downtime associated with the outage. Data Guard can be used with traditional backup, restoration, and cluster techniques to provide a high level of data protection and data availability.
Data Guard Configurations:
A Data Guard configuration consists of one production database and one or more standby databases. The databases in a Data Guard configuration are connected by Oracle Net and may be dispersed geographically. There are no restrictions on where the databases are located, provided they can communicate with each other. For example, you can have a standby database on the same system as the production database, along with two standby databases on other systems at remote locations.
You can manage primary and standby databases using the SQL command-line interfaces or the Data Guard broker interfaces, including a command-line interface (DGMGRL) and a graphical user interface that is integrated in Oracle Enterprise Manager.
Primary Database
A Data Guard configuration contains one production database, also referred to as the primary database, that functions in the primary role. This is the database that is accessed by most of your applications.
The primary database can be either a single-instance Oracle database or an Oracle Real Application Clusters database.
Standby Database
A standby database is a transactionally consistent copy of the primary database. Using a backup copy of the primary database, you can create up to nine standby databases and incorporate them in a Data Guard configuration. Once created, Data Guard automatically maintains each standby database by transmitting redo data from the primary database and then applying the redo to the standby database.
Similar to a primary database, a standby database can be either a single-instance Oracle database or an Oracle Real Application Clusters database.
A standby database can be either a physical standby database or a logical standby database:
Physical standby database
Provides a physically identical copy of the primary database, with on disk database structures that are identical to the primary database on a block-for-block basis. The database schema, including indexes, are the same. A physical standby database is kept synchronized with the primary database by recovering the redo data received from the primary database.
Logical standby database
Contains the same logical information as the production database, although the physical organization and structure of the data can be different. The logical standby database is kept synchronized with the primary database by transforming the data in the redo received from the primary database into SQL statements and then executing the SQL statements on the standby database. A logical standby database can be used for other business purposes in addition to disaster recovery requirements. This allows users to access a logical standby database for queries and reporting purposes at any time. Also, using a logical standby database, you can upgrade Oracle Database software and patch sets with almost no downtime. Thus, a logical standby database can be used concurrently for data protection, reporting, and database upgrades.

For Detailed tutorial please click here

ORA-12547: TNS:lost contact

I get this error while installing Oracle 10g R2 on Redhat Enterprise Linux 5. So I install the following package and problem resolved:
Download it from :