Вы находитесь на странице: 1из 5

Oracle interview questions:

Table space:
Oracle database is divided into one or more logical storage units
called table spaces. Table spaces are divided into logical units of
storage called segments which further divided into extents
.extents are a collection of continous blocks.

Types of table space


By default table space is system table space.
Temporary table space
Undo table space
Read only table space

Table :
Table is the one of the database object.
Table is a basic storage unit of database.
Table is collection of rows and columns
Types of tables in oracle
Heap table-----normal table
Object table-----create on object type
Index organized table----have primary and non parimary columns
same as btree index

Global temporary table---- created tables in temporary we will not


store in data base
Transaction specific
Session specific
External tables

Partition table---data broken into small tables

Truncate vs delete

2. What is difference between TRUNCATE & DELETE?


1. Truncate is a DDL command
2. We can remove bulk amount of records at a time
3. We can't rollback the records
4. Release the space in database
5. Truncate reset the high water mark
6. Truncate implicitly commit
1. Delete is a DML command
2. We can delete record by record
3. We can rollback the records

4. Cant release the memory in database


5. Delete cant reset the water mark
6. Delete explicitly commit
(OR)
Ans: Differences:
TRUNCATE commits after deleting entire table i.e., cannot be rolled back.
Database triggers do not fire on TRUNCATE DELETE allows the filtered deletion.
Deleted records can be rolled back or committed.Database triggers fire on DELETE

High water mark:


High water mark is the maximum amount of database blocks used so far by a segment. This
mark cannot be reset by delete operations.
Delete Table operation won't reset HWM.

3. TRUNCATE will reset HWM.

4. The high water mark level is just a line separate the used blocks and free blocks.

The blocks above the HWM level is free blocks, they are ready to use.
The blocks below the HWM level is used blocks, they are already used.
for example, if you delete some huge records from the database, that data will delete but the
blocks are not ready to used, because that blocks are still below HWM level, so delete
command never reset the HWM level,

At the same time you truncate the date, then the data will delete and that used blocks will goto
above the HWM level, now its ready to used. now they consider has free blocks.

3. Difference between view and materialized view


Difference
View is a logical table
View can hold the query
We cant create indexes on view
View will create security purpose
Mv is a physical table
Mv can hold the query with refresh data
We can create indexes on mv
Mv will create performance issues

Decode vs case

Decode function can be used to replace one or more strings


Decode work like if else condition
In Decode function will not used relational operators
Case function can be used to replace one or more strings

Case will be used relational operators


Dbms_job:
DBMS_JOB supports multi-instance execution of jobs. By default jobs can be executed on any

instance, but only one single instance will execute the job. In addition, you can force instance
binding by binding the job to a particular instance. You implement instance binding by specifying an
instance number to the instance affinity parameter. Note, however, that in Oracle Database 10g
Release 1 (10.1) instance binding is not recommended. Service affinity is preferred. This concept is
implemented in the DBMS_SCHEDULER package.

DBMS_JOB.SUBMIT
To submit a job to the job queue, use the following syntax:
DBMS_JOB.SUBMIT(
job

OUT

BINARY_INTEGER,

what

IN

VARCHAR2, NEXT_DATE IN DATE DEFAULTSYSDATE,

interval

IN

VARCHAR2 DEFAULT 'NULL',

no_parse

IN

BOOLEAN DEFAULT FALSE,

instance

IN

BINARY_INTEGER DEFAULT ANY_INSTANCE,

force

IN

BOOLEAN DEFAULT FALSE);

Вам также может понравиться