Unit-3 Final
Unit-3 Final
https://easy2learncode.in
22
RDBMS Using Oracle unit-3
View
A view is a logical representation of a division(subset) of
data from one or more table
https://easy2learncode.in Page 2
RDBMS Using Oracle unit-3
Drop view
Drop view <view_name>
https://easy2learncode.in Page 3
RDBMS Using Oracle unit-3
https://easy2learncode.in Page 4
RDBMS Using Oracle unit-3
SEQUENCE
An oracle sequence is aoracle object that is used to
generate an Auto number field.
https://easy2learncode.in Page 5
RDBMS Using Oracle unit-3
Example.
STEP(1)
https://easy2learncode.in Page 6
RDBMS Using Oracle unit-3
STEP(3)
insert into student
values(seq01.nextval,'shiv','rajkot');
insert into student
values(seq01.nextval,'shivansh','rajkot');
STEP(4)
select *from student;
STEP(5)
Drop sequence
Drop sequence < sequence _name>
Drop sequence seq01
https://easy2learncode.in Page 7
RDBMS Using Oracle unit-3
SYNONYMS
A synonym is an alternative name for object.
Ex.
Step-1
Step-2
select *from syn_123
Step-3
Drop synonym
https://easy2learncode.in Page 8
RDBMS Using Oracle unit-3
DATABASE LINKS
Database link allows you to connect from one database
to another.
Ex.
create database link myremotedb using 'system'
selectsysdate from dual myremotedb
INDEX
Types of index:
https://easy2learncode.in Page 9
RDBMS Using Oracle unit-3
INDEX
Function Application
B*Tree Bitmap
based Domain
B-Tree/Normal/Simple Indexes
CreateINDEX <index_name>ON
table_nm<colm1,colm2>
Drop index
Drop index < index _name>
Drop index inx1
Bitmap Indexes
https://easy2learncode.in Page 10
RDBMS Using Oracle unit-3
Syntax:
Create bitmap index Index_name on
Table_name(Columns which have distinct values);
Example:
Function-Based Indexes
Syntax:
Create index indexname on
tablename(Function_name(column_name));
Example:
Create index func_name_idx ON
student(UPPER(NAME))
https://easy2learncode.in Page 11
RDBMS Using Oracle unit-3
The Oracle server interacts with the application to build, maintain, and
search the domain index.
CLUSTER
Oracle DB store together all the rows from all the tables
that share the same cluster key. use the CREATE
CLUSTER statement to create a cluster.
Syntax :
https://easy2learncode.in Page 12
RDBMS Using Oracle unit-3
SNAPSHOT
It is a read only copy of a table or a subset of a table. A
snapshot is more useful in distributed computing
environment .that time using command create
snapshot.
Syntax :
create snapshot [schema.]snapshot as query.
Ex.
create snapshot snap_emp1 as select *from cust
select * from snap_emp1
https://easy2learncode.in Page 13
RDBMS Using Oracle unit-3
Locking Issues
1. Lost Updates
https://easy2learncode.in Page 14
RDBMS Using Oracle unit-3
2. Pessimistic Locking
pessimistic locking prevents any other
application or user from fetching or updating
the same record at the same time.
Pessimistic locking can be a very powerful
mechanism, but often databases can impose
limitations. Some databases are not support
this locking.
Raise an exception when an attempt is made to
update a record that has already been locked
and updated.
3. Optimistic Locking
https://easy2learncode.in Page 15
RDBMS Using Oracle unit-3
4. Blocking
Blocking occurs when one session holds a lock
on a resource that another session is
requesting.
As a result, the requesting session will be
blocked – it will hang until the holding session
gives up the locked resource.
5. Deadlocks
https://easy2learncode.in Page 16
RDBMS Using Oracle unit-3
6. Lock Escalation
The system is decreasing the granularity of your
locks.
Lock Types
1. DML Locks
2. DDL Locks
https://easy2learncode.in Page 18
RDBMS Using Oracle unit-3
3. Latches
Latches are locks that are held for short period of
time,
Manual Locking:
The SELECT…FOR UPDATE statement is the
predominant method of manually locking data.
https://easy2learncode.in Page 19
RDBMS Using Oracle unit-3
https://easy2learncode.in Page 20
RDBMS Using Oracle unit-3
Follow Us :
https://easy2learncode.in Page 21