lab # 1 introduction to oracle eng. alaa o...
TRANSCRIPT
The Islamic University of Gaza
Faculty of Engineering
Department of Computer Engineering
ECOM 4113: Database Lab
Lab # 1
Introduction To Oracle
Eng. Alaa O Shama
September, 2015
1
2
Objective
To be familiar with Oracle DataBase Management System.
What is a DataBase?
A database is a collection of related data that is known facts that can be recorded and
that have implicit meaning.
Examples: University, Library, ect.
A database may be generated and maintained manually or it may be computerized. A
computerized database may be created and maintained by a database management
system (DBMS).
What is the DBMS ?
DBMS is a collection of programs that enables users to create and maintain a
database.
DBMS is a general-purpose software system that facilitates the processes of
defining, constructing, manipulating, and sharing databases among various users
and applications.
DBMS includes protecting the database and maintaining it over a long period of
time.
DBMS Responsibilities
Creating the database.
Providing query and update facilities.
Multitasking.
Managing the security of the database.
Maintaining referential integrity.
Examples:
Oracle, SQL Server, MySQL, PostgreSQL.
For our lab, we will use Oracle Database Express Edition 11.2g, since this version does not have
significant system overhead requirements.
2
3
DataBase System
The database and DBMS software together are called a database system.
Figure 1: DataBase System
Oracle DataBase
Oracle Database (commonly referred to as Oracle RDBMS or simply as Oracle) is
an object-relational database management system produced and marketed by Oracle
Corporation. Its last version is Oracle 12c (c refers to cloud) and its primary query
language is PL/SQL.
3
4
Oracle XE Installation on Windows
1- Double click on setup.exe
2- Next.
4
3- Accept the license Agreement >> Next.
4- Next.
5
6
5- Enter the password for SYS and SYSTEM default users that will be explained later
in this lab.
manager
6- Install.
6
7
7
8
7- Finish. ^_^
8
Oracle XE Default Schemas/Users
During installation, Oracle XE creates a default database called XE.
XE database contains many schemas that each of them has an owner with
the same name.
Schemas
Schemas are the most important objects within the database. A schema is acollection of database objects. A schema is owned by a database user and has the same name as that user. Schema objects include structures like tables, triggers, functions,
views, and other objects for handling data in the database.
The Schemas have two purposes:
To help manage the access of many different users to a single database.
To allow extra tables to be associated with a standard database,
but kept separate.
Users
When Oracle Express Edition has successfully installed, it can be accessed
through user accounts. Some of these accounts are automatically created
administrative accounts—accounts with database administration privileges, and
others are created but LOCKED by default and their passwords are expired.
Before you can use a locked account, you must unlock it and reset its password.
The following table lists some of the Oracle Database XE predefined user
accounts:
9
HR Scheme :
As we said before, some accounts are automatically created while installing
Oracle XE. One of these accounts is “HR” account, which has a sample schema
that is full of objects and its tables is rich of data. This schema was created for
academic purposes and targets students. Unfortunately, “HR” account is initially
locked and expired, therefore, we have to unlock it by using “ALTER USER ...
ACCOUNT UNLOCK” statement.
Firstly, we will connect to our database using “SYSTEM” account, which has
administrative privileges.
From “start” menu, Run SQL Command Line
SQL Command Line “SQL*Plus”
It is an interactive command-line query tool that is installed with
Oracle Database Express Edition.
10
Secondly, we need to connect to the database: “connect username/password”
Finally, unlock “HR” account by using the “ALTER USER ... ACCOUNT UNLOCK”
statement.
Now you can discover schema objects that belong to “HR”, like tables, by issuing
“SELECT TABLE_NAME FROM USER_TABLES” statement.
11
Oracle SQL Developer
Oracle SQL Developer is the Oracle Database IDE. A free graphical user
interface,Oracle SQL Developer allows database users and administrators to
do their database tasks in fewer clicks and keystrokes.
Working with SQL Developer is very easy; even it does not have to be installed
on your device! Just double click on “sqldeveloper.exe” and it will be ready to
be used for managing database!
1- Double click on sqldeveloper. .
12
Connect to XE database by HR user
1- Click on Connections then click on icon.
2- Enter Connection Parameters
13
3- Test.
Success
4- Connect.
14
Query Example ^_^