Saturday 28 May 2016

Oracle Interview Questions

Oracle Interview Questions
Oracle is a secured database that is widely used in multinational companies. The frequently asked questions from oracle database are given below.

1) What are the components of physical database structure of Oracle database?
Components of physical database structure are given below.
  • One or more data files.
  • Two or more redo log files.
  • One or more control files.

2) What are the components of logical database structure in Oracle database?
Components of logical database structure.
  • Tablespaces
  • Database's schema objects

3) What is a tablespace?
A database contains Logical Storage Unit called tablespaces. A tablespace is a set of related logical structures. Actually a tablespace groups related logical structures together.

4) What is a SYSTEM tablespace and when it is created?
When the database is created in Oracle database system, it automatically generate a SYSTEM named SYSTEM tablespace. The SYSTEM tablespace contains data dictionary tables for the entire database.

5) What is an Oracle table?
A table is basic unit of data storage in Oracle database. A table contains all the accessible information of a user in rows and columns.

6) In the Oracle version 9.3.0.5.0, what does each number shows?
Oracle version number refers:
  • 9 - Major database release number
  • 3 - Database maintenance release number
  • 0 - Application server release number
  • 5 - Component Specific release number
  • 0 - Platform Specific release number

7) What is bulk copy or BCP in Oracle?
Bulk copy or BCP in Oracle, is used to import or export data from tables and views but it does not copy structure of same data.
The main advantage of BCP is fast mechanism for coping data and you can also take the backup of data easily.

8) What is the relationship among database, tablespace and data file?
An Oracle database contains one or more logical storage units called tablespaces. These tablespaces collectively store whole data of databases and each tablespace in Oracle database consists of one or more files called datafiles. These datafiles are physical structure that confirm with the operating system in which Oracle is running.

9) What is a snapshot in Oracle database?
A snapshot is a replica of a target master table from a single point-in-time. In simple words you can say, snapshot is a copy of a table on a remote database.

10) What is the difference between hot backup and cold backup in Oracle? Tell about their benefits also.
Hot backup (Online Backup): A hot backup is also known as online backup because it is done while the database is active. Some sites can not shut down their database while making a backup copy, they are used for 24 hour a day, 7 days a week.
Cold backup (Offline Backup): A cold backup is also known as offline backup because it is done while the database has been shutdown using the SHUTDOWN normal command. If the database is suddenly shutdown with a uncertain condition it should be restarted with RESTRICT mode and then shutdown with NORMAL option.
For a complete cold backup the following files must be backed up.
All datafiles, All control files, All online redo log files(optional) and the init.ora file (you can recreate it manually).

11) How many memory layers are in the Oracle shared pool?
Oracle shared pools contains two layers:
1.     library cache
2.     data dictionary cache

12) What is save point in Oracle database?
Save points are used to divide a transaction into smaller parts. It allows rolling back of a transaction. Maximum five save points are allowed. It is used to save our data, whenever you encounter an error you can roll back from the point where you save your SAVEPOINT.

13) What is hash cluster in Oracle?
Hash cluster is a technique to store a data in hash table and improve the performance of data retrieval. Hash function is applied on table row's cluster key value and store in hash cluster.

14) What are the various Oracle database objects?
Tables: This is a set of elements organized in vertical and horizontal fashion.
Tablespaces: This is a logical storage unit in Oracle.
Views: It is virtual table derived from one or more tables.
Indexes: This is a performance tuning method to process the records.
Synonyms: This is a name for tables.

15) What is the difference between pre-select and pre-query?
A pre-query trigger fire before the query executes and fire once while you try to query. With the help of this trigger you can modify the where clause part dynamically.
Pre-select query fires during the execute query and count query processing after Oracle forms construct the select statement to be issued, but before the statement is actually issued.
Pre-query trigger fires before Pre-select trigger.

16) How to convert a date to char in Oracle? Give one example.
The to_char() function is used to convert date to character. You can also specify the format in which you want output.
1.     SELECT to_char ( to_date ('12-12-2012''DD-MM-YYYY') , 'YYYY-MM-DD'FROM dual;  
Or,
1.     SELECT to_char ( to_date ('12-12-2012''DD-MM-YYYY') , 'DD-MM-YYYY'FROM dual;  

17) What are the extensions used by Oracle reports?
Oracle reports are use to make business enable with the facility to provide information of all level within or outside in a secure way. Oracle report uses REP files and RDF file extensions.

18) How to convert a string to a date in Oracle database?
Syntax: to_date (string , format)
Let us take an example :
1.     to_date ('2012-12-12''YYYY/MM/DD')  
It will return December 12, 2012.

19) How do you find current date and time in Oracle?
The SYSDATE() function is used in Oracle to find the current date and time of operating system on which the database is running.
1.     SELECT TO_CHAR (SYSDATE, 'MM-DD-YYYY HH24:MI:SS'"Current_Date" FROM DUAL;  

20) What will be the syntax to find current date and time in format "YYYY-MM-DD"?
1.     SELECT TO_CHAR (SYSDATE, 'YYYY-MM-DD HH24:MI:SS'"Current_Date" FROM DUAL;  



No comments:

Post a Comment