0% found this document useful (0 votes)
3 views

Lab 02 - Introduction to Oracle

Introduction to Oracle

Uploaded by

hayamousa78
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lab 02 - Introduction to Oracle

Introduction to Oracle

Uploaded by

hayamousa78
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Introduction To Oracle

LAB SESSION
Introduction to Databases

A database is a collection of Data


(Information).
 Examples of databases, which we use in our daily life,
is an Attendance Register, Telephone Directory,
Muster Rule.

Database Management System(DBMS):


 A database management system is a collection of

programs written to manage a database. That is, it


acts as a interface between user and database.
ORACLE

Oracle is an Object-Relational Database


Management System.

It is the leading RDBMS vendor worldwide.


 Nearly half of RDBMS worldwide market is owned by

Oracle.
Creating Tables

A table is the data structure that holds data


in a relational database.
A table is composed of rows and columns.
Datatypes

Before creating a Table you have to decide


what type of data each column can contain.
This is known as datatype. Lets Discuss what
datatypes are available in Oracle.
Datatype Description
CHAR (size ) Fixed-length character data of length
size bytes or characters. Fixed for every
row in the table maximum size is 2000
bytes per row, default size is 1 byte per
row.
VARCHAR2 Variable-length character data, with
(size) maximum length size bytes or
characters. Variable for each row, up to
4000 bytes per row.
Datatypes

Datatype Description
NUMBER (p, Variable-length numeric data. Maximum precision p
s) and/or scale s is 38. Variable for each row. The
maximum space required for a given column is 21
bytes per row.
DATE Fixed-length date and time data, ranging from Jan. 1,
4712 B.C.E. to Dec. 31, 4712 C.E. Fixed at 7 bytes for
each row in the table. Default format is a string (such
as DD-MON-RR) specified by the NLS_DATE_FORMAT
parameter.
TIMESTAMP A value representing a date and time, including
(precision) fractional seconds. (The exact resolution depends on
the operating system clock.) Varies from 7 to 11 bytes,
depending on the precision.
BLOB Unstructured binary data. Up to 232 - 1 bytes, or 4
gigabytes.
BFILE Binary data stored in an external file . Up to 232 - 1
bytes, or 4 gigabytes.
Creating a User

CREATE USER books_admin IDENTIFIED BY


MyPassword;

Here we’re simply creating


a books_admin account that
is IDENTIFIED or authenticated by the
specified password.
The Grant Statement

With our new books_admin account


created, we can now begin adding
privileges to the account using
the GRANT statement.

GRANT CONNECT TO books_admin;


GRANT CONNECT, RESOURCE, DBA TO
books_admin;
The Revoke Statement

Revoke CONNECT from books_admin;


Revoke CONNECT, RESOURCE, DBA from
books_admin;
Grant/revoke Table Privileges

GRANT SELECT, INSERT, UPDATE, DELETE ON


schema.books TO books_admin;

Revoke INSERT, UPDATE ON schema.books


from books_admin;
Change User Password

alter user <user_name> identified by


<new_password>
Lock Account

alter user <user_name> account lock;


Unlock Account

alter user <user_name> account unlock;


Basics SQL

Select username from dba_users;


Select user from dual;
Select table_name from user_tables;
Select sysdate from dual;
Select 5*(3+2) from dual;
Connect to HR and show his tables

First of all we have to reset its password and


unlock the account:
Alter user hr identified by hr123;
Alter user hr account unlock;
Then, connect to hr:
Connect;
Enter-username : hr
Enter-Password : hr123
Then, display his tables:
Select table_name from user_tables;

You might also like