Tuesday, November 13, 2007

Oracle Interview Questions - Part 8

What are the components of physical database structure of Oracle database?
Oracle database is comprised of three types of files. One or more datafiles, two are more redo log files, and one or more control files.

What are the components of logical database structure of Oracle database?
There are tablespaces and database's schema objects.

What is a tablespace?
A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related logical structures together.

What is SYSTEM tablespace and when is it created?
Every Oracle database contains a tablespace named SYSTEM, which is automatically created when the database is created. The SYSTEM tablespace always contains the data dictionary tables for the entire database.

Explain the relationship among database, tablespace and data file ?
Each databases logically divided into one or more tablespaces one or more data files are explicitly created for each tablespace.

What is schema?
A schema is collection of database objects of a user.

What are Schema Objects?
Schema objects are the logical structures that directly refer to the database's data. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database triggers, procedures, functions packages and database links.

Can objects of the same schema reside in different tablespaces?

Yes.

Can a tablespace hold objects from different schemes?
Yes.

What is Oracle table?
A table is the basic unit of data storage in an Oracle database. The tables of a database hold all of the user accessible data. Table data is stored in rows and columns.

What is an Oracle view?
A view is a virtual table. Every view has a query attached to it. (The query is a SELECT statement that identifies the columns and rows of the table(s) the view uses.)

What is Partial Backup ?
A Partial Backup is any operating system backup short of a full backup, taken while the database is open or shut down.

What is Mirrored on-line Redo Log ?
A mirrored on-line redo log consists of copies of on-line redo log files physically located on separate disks, changes made to one member of the group are made to all members

What is Full Backup ?
A full backup is an operating system backup of all data files, on-line redo log files and control file that constitute ORACLE database and the parameter.

Can a View based on another View ?
Yes.

Can a Tablespace hold objects from different Schemes ?
Yes.

Can objects of the same Schema reside in different tablespace ?
Yes.

What is the use of Control File ?
When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery.

Do View contain Data ?
Views do not contain or store data.

What are the Referential actions supported by FOREIGN KEY integrity constraint ?
UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion of referenced data. DELETE Cascade - When a referenced row is deleted all associated dependent rows are deleted.

What are the type of Synonyms?
There are two types of Synonyms Private and Public.

What is a Redo Log ?
The set of Redo Log files YSDATE,UID,USER or USERENV SQL functions, or the pseudo columns LEVEL or ROWNUM.

What is an Index Segment ?
Each Index has an Index segment that stores all of its data.

Explain the relationship among Database, Tablespace and Data file?
Each databases logically divided into one or more tablespaces one or more data files are explicitly created for each tablespace

What are the different type of Segments ?
Data Segment, Index Segment, Rollback Segment and Temporary Segment.

What are Clusters ?
Clusters are groups of one or more tables physically stores together to share common columns and are often used together.

What is an Integrity Constrains ?
An integrity constraint is a declarative way to define a business rule for a column of a table.

What is an Index ?
An Index is an optional structure associated with a table to have direct access to rows, which can be created to increase the performance of data retrieval. Index can be created on one or more columns of a table.

What is an Extent ?
An Extent is a specific number of contiguous data blocks, obtained in a single allocation, and used to store a specific type of information.

What is a View ?
A view is a virtual table. Every view has a Query attached to it. (The Query is a SELECT statement that identifies the columns and rows of the table(s) the view uses.)

What is Table ?
A table is the basic unit of data storage in an ORACLE database. The tables of a database hold all of the user accessible data. Table data is stored in rows and columns.

What are snap shots and views
Snapshots are mirror or replicas of tables. Views are built using the columns from one or more tables. The Single Table View can be updated but the view with multi table cannot be updated

What are the OOPS concepts in Oracle.
Oracle does implement the OOPS concepts. The best example is the Property Classes. We can categorise the properties by setting the visual attributes and then attach the property classes for the objects. OOPS supports the concepts of objects and classes and we can consider the peroperty classes as classes and the items as objects

What is the difference between candidate key, unique key and primary key
Candidate keys are the columns in the table that could be the primary keys and the primary key is the key that has been selected to identify the rows. Unique key is also useful for identifying the distinct rows in the table.)

What is concurrency
Concurrency is allowing simultaneous access of same data by different users. Locks useful for accesing the database are
a) Exclusive
The exclusive lock is useful for locking the row when an insert,update or delete is being done.This lock should not be applied when we do only select from the row.
b) Share lock
We can do the table as Share_Lock as many share_locks can be put on the same resource.

Previleges and Grants
Previleges are the right to execute a particulare type of SQL statements. e.g :: Right to Connect, Right to create, Right to resource Grants are given to the objects so that the object might be accessed accordingly.The grant has to be given by the owner of the object

Table Space,Data Files,Parameter File, Control Files

Table Space :: The table space is useful for storing the data in the database.When a database is created two table spaces are created.
a) System Table space :: This data file stores all the tables related to the system and dba tables
b) User Table space :: This data file stores all the user related tables
We should have seperate table spaces for storing the tables and indexes so that the access is fast.
Data Files :: Every Oracle Data Base has one or more physical data files.They store the data for the database.Every datafile is associated with only one database.Once the Data file is created the size cannot change.To increase the size of the database to store more data we have to add data file.
Parameter Files :: Parameter file is needed to start an instance.A parameter file contains the list of instance configuration parameters e.g.::
db_block_buffers = 500
db_name = ORA7
db_domain = u.s.acme lang
Control Files :: Control files record the physical structure of the data files and redo log files
They contain the Db name, name and location of dbs, data files ,redo log files and time stamp.

Physical Storage of the Data
The finest level of granularity of the data base are the data blocks.
Data Block :: One Data Block correspond to specific number of physical database space
Extent :: Extent is the number of specific number of contigious data blocks.
Segments :: Set of Extents allocated for Extents. There are three types of Segments
a) Data Segment :: Non Clustered Table has data segment data of every table is stored in cluster data segment
b) Index Segment :: Each Index has index segment that stores data
c) Roll Back Segment :: Temporarily store 'undo' information

What are the Pct Free and Pct Used
Pct Free is used to denote the percentage of the free space that is to be left when creating a table. Similarly Pct Used is used to denote the percentage of the used space that is to be used when creating a table
eg.:: Pctfree 20, Pctused 40

What is Row Chaining
The data of a row in a table may not be able to fit the same data block.Data for row is stored in a chain of data blocks .

What is a 2 Phase Commit
Two Phase commit is used in distributed data base systems. This is useful to maintain the integrity of the database so that all the users see the same values. It contains DML statements or Remote Procedural calls that reference a remote object. There are basically 2 phases in a 2 phase commit.
a) Prepare Phase :: Global coordinator asks participants to prepare
b) Commit Phase :: Commit all participants to coordinator to Prepared, Read only or abort Reply

What is the difference between deleting and truncating of tables
Deleting a table will not remove the rows from the table but entry is there in the database dictionary and it can be retrieved But truncating a table deletes it completely and it cannot be retrieved.

What are mutating tables
When a table is in state of transition it is said to be mutating. eg :: If a row has been deleted then the table is said to be mutating and no operations can be done on the table except select.

What are Codd Rules
Codd Rules describe the ideal nature of a RDBMS. No RDBMS satisfies all the 12 codd rules and Oracle Satisfies 11 of the 12 rules and is the only Rdbms to satisfy the maximum number of rules.

What is Normalisation
Normalisation is the process of organising the tables to remove the redundancy.There are mainly 5 Normalisation rules.
a) 1 Normal Form :: A table is said to be in 1st Normal Form when the attributes are atomic
b) 2 Normal Form :: A table is said to be in 2nd Normal Form when all the candidate keys are dependant on the primary key
c) 3rd Normal Form :: A table is said to be third Normal form when it is not dependant transitively

What is the Difference between a post query and a pre query
A post query will fire for every row that is fetched but the pre query will fire only once.

Deleting the Duplicate rows in the table
We can delete the duplicate rows in the table by using the Rowid

Can U disable database trigger? How?
Yes. With respect to table
ALTER TABLE TABLE
[[ DISABLE all_trigger ]]

What is pseudo columns ? Name them?
A pseudocolumn behaves like a table column, but is not actually stored in the table. You can select from pseudocolumns, but you cannot insert, update, or delete their values. This section describes these pseudocolumns:
* CURRVAL
* NEXTVAL
* LEVEL
* ROWID
* ROWNUM

How many columns can table have?
The number of columns in a table can range from 1 to 254.

Is space acquired in blocks or extents ?
In extents .

What is clustered index?
In an indexed cluster, rows are stored together based on their cluster key values . Can not applied for HASH.

What are the datatypes supported By oracle (INTERNAL)?
Varchar2, Number,Char , MLSLABEL.

What are attributes of cursor?
%FOUND , %NOTFOUND , %ISOPEN,%ROWCOUNT

Can you use select in FROM clause of SQL select ?
Yes.

Which trigger are created when master -detail relay?
master delete property
* NON-ISOLATED (default)
a) on check delete master
b) on clear details
c) on populate details
* ISOLATED
a) on clear details
b) on populate details
* CASCADE
a) per-delete
b) on clear details
c) on populate details

which system variables can be set by users?
SYSTEM.MESSAGE_LEVEL
SYSTEM.DATE_THRESHOLD
SYSTEM.EFFECTIVE_DATE
SYSTEM.SUPPRESS_WORKING

What are object group?
An object group is a container for a group of objects. You define an object group when you want to package related objects so you can copy or reference them in another module.

What are referenced objects?
Referencing allows you to create objects that inherit their functionality and appearance from other objects. Referencing an object is similar to copying an object, except that the resulting reference object maintains a link to its source object. A reference object automatically inherits any changes that have been made to the source object when you open or regenerate the module that contains the reference object.

Can you store objects in library?
Referencing allows you to create objects that inherit their functionality and appearance from other objects. Referencing an object is similar to copying an object, except that the resulting reference object maintains a link to its source object. A reference object automatically inherits any changes that have been made to the source object when you open or regenerate the module that contains the reference object.

Is forms 4.5 object oriented tool ? why?
yes , partially. 1) PROPERTY CLASS - inheritance property 2) OVERLOADING : procedures and functions.

Can you issue DDL in forms?
yes, but you have to use FORMS_DDL.
Referencing allows you to create objects that inherit their functionality and appearance from other objects. Referencing an object is similar to copying an object, except that the resulting reference object maintains a link to its source object. A reference object automatically inherits any changes that have been made to the source object when you open or regenerate the module that contains the reference object. Any string expression up to 32K:
- a literal
- an expression or a variable representing the text of a block of dynamically created PL/SQL code
- a DML statement or
- a DDL statement
Restrictions:
The statement you pass to FORMS_DDL may not contain bind variable references in the string, but the values of bind variables can be concatenated into the string before passing the result to FORMS_DDL.

What is SECURE property?
- Hides characters that the operator types into the text item. This setting is typically used for password protection.

What are the types of triggers and how the sequence of firing in text item
Triggers can be classified as Key Triggers, Mouse Triggers ,Navigational Triggers.
Key Triggers :: Key Triggers are fired as a result of Key action.e.g :: Key-next-field, Key-up,Key-Down
Mouse Triggers :: Mouse Triggers are fired as a result of the mouse navigation.e.g. When-mouse-button-presed,when-mouse-doubleclicked,etc
Navigational Triggers :: These Triggers are fired as a result of Navigation. E.g. : Post-Text-item,Pre-text-item.
We also have event triggers like when ?new-form-instance and when-new-block-instance.
We cannot call restricted procedures like go_to(?my_block.first_item?) in the Navigational triggers
But can use them in the Key-next-item.
The Difference between Key-next and Post-Text is an very important question. The key-next is fired as a result of the key action while the post text is fired as a result of the mouse movement. Key next will not fire unless there is a key event. The sequence of firing in a text item are as follows ::
a) pre - text
b) when new item
c) key-next
d) when validate
e) post text

Can you store pictures in database? How?
Yes , in long Raw datatype.

What are property classes ? Can property classes have trigger?
Property class inheritance is a powerful feature that allows you to quickly define objects that conform to your own interface and functionality standards. Property classes also allow you to make global changes to applications quickly. By simply changing the definition of a property class, you can change the definition of all objects that inherit properties from that class.
Yes . All type of triggers .

If you have property class attached to an item and you have same trigger written for the item . Which will fire first?
Item level trigger fires , If item level trigger fires, property level trigger won't fire. Triggers at the lowest level are always given the first preference. The item level trigger fires first and then the block and then the Form level trigger.

What are record groups ? * Can record groups created at run-time?
A record group is an internal Oracle Forms data structure that has a column/row framework similar to a database table. However, unlike database tables, record groups are separate objects that belong to the form module in which they are defined. A record group can have an unlimited number of columns of type CHAR, LONG, NUMBER, or DATE provided that the total number of columns does not exceed 64K. Record group column names cannot exceed 30 characters.
Programmatically, record groups can be used whenever the functionality offered by a two-dimensional array of multiple data types is desirable.
TYPES OF RECORD GROUP:
Query Record Group A query record group is a record group that has an associated SELECT statement. The columns in a query record group derive their default names, data types, and lengths from the database columns referenced in the SELECT statement. The records in a query record group are the rows retrieved by the query associated with that record group.
Non-query Record Group A non-query record group is a group that does not have an associated query, but whose structure and values can be modified programmatically at runtime.
Static Record Group A static record group is not associated with a query; rather, you define its structure and row values at design time, and they remain fixed at runtime.

What are ALERT?
An ALERT is a modal window that displays a message notifying operator of some application condition.

Can a button have icon and label at the same time ?
-NO

What is mouse navigate property of button?
When Mouse Navigate is True (the default), Oracle Forms performs standard navigation to move the focus to the item when the operator activates the item with the mouse.
When Mouse Navigate is set to False, Oracle Forms does not perform navigation (and the resulting validation) to move to the item when an operator activates the item with the mouse.

What is FORMS_MDI_WINDOW?
forms run inside the MDI application window. This property is useful for calling a form from another one.

What are timers ? when when-timer-expired does not fire?
The When-Timer-Expired trigger can not fire during trigger, navigation, or transaction processing.

Can object group have a block?
Yes , object group can have block as well as program units.

How many types of canvases are there.
There are 2 types of canvases called as Content and Stack Canvas. Content canvas is the default and the one that is used mostly for giving the base effect. Its like a plate on which we add items and stacked canvas is used for giving 3 dimensional effect.

What are user-exits?
It invokes 3GL programs.

Can you pass values to-and-fro from foreign function ? how ?
Yes . You obtain a return value from a foreign function by assigning the return value to an Oracle Forms variable or item. Make sure that the Oracle Forms variable or item is the same data type as the return value from the foreign function.
After assigning an Oracle Forms variable or item value to a PL/SQL variable, pass the PL/SQL variable as a parameter value in the PL/SQL interface of the foreign function. The PL/SQL variable that is passed as a parameter must be a valid PL/SQL data type; it must also be the appropriate parameter type as defined in the PL/SQL interface.

What is IAPXTB structure ?
The entries of Pro * C and user exits and the form which simulate the proc or user_exit are stored in IAPXTB table in d/b.

Can you call WIN-SDK thru user exits?
YES.

No comments: