Sunteți pe pagina 1din 19

Modeling the Database Schema

(optional)

Copyright 2008, Oracle. All rights reserved.


Objectives

After completing this lesson, you should be able to do the


following:
Describe JDevelopers tool for database modeling
Create a schema model
Modify the schema model
Reconcile the modifications to the database
Import database object definitions to an offline database
Reconcile offline database objects with the database

3-2 Copyright 2008, Oracle. All rights reserved.


Modeling Database Schemas

With JDevelopers database modeler, you can:


Create a schema model
Modify the schema model
Reconcile changes to the database

3-3 Copyright 2008, Oracle. All rights reserved.


Goals of Database Modeling

Database modeling can help you achieve the following goals:


For existing database objects:
Visualize the schema to help analyze whether it meets
requirements.
Make any necessary modifications.
For new database objects:
Design schema to support business requirements.
Generate DDL to create the required database objects.

3-4 Copyright 2008, Oracle. All rights reserved.


Characteristics of the JDeveloper Database
Modeler

With the JDeveloper Database Modeler you can:


Model existing objects, such as Use Property Inspector to set
tables and foreign keys, by properties on diagram and its
dragging from Database objects
Navigator
Create new objects by
dragging from
Component Palette

3-5 Copyright 2008, Oracle. All rights reserved.


Database Modeling Tools in JDeveloper

You can work with database objects in the following ways:


Online: Create and modify schema objects directly in a
database through a JDeveloper connection.
Offline:
Model metadata for database objects outside the context of a
database schema.
Import objects from online database.
Generate changes to online schemas.
Diagrammer:
Create and modify objects by dragging from Component
Palette and Database Navigator.
Import objects from offline database model.
Generate changes to online schemas.

3-6 Copyright 2008, Oracle. All rights reserved.


Modeling Database Objects Offline

You can create offline database definitions in the following


ways:
Create new offline database objects
Copy from database with filters

3-7 Copyright 2008, Oracle. All rights reserved.


Creating a New Offline Database

To create a definition for an offline database in which you


can model database objects, perform the following steps:
1. In the Application Navigator, right-click a project and choose
New to display the New Gallery.
2. In the New Gallery, expand Database Tier, and select Offline
Database Objects.
3. Select Offline Database to launch the Create Offline
Database Wizard.
4. In the pages of the wizard, enter properties for the database,
such as its name.
After an offline database is created, you can create various
database object definitions within it.

3-8 Copyright 2008, Oracle. All rights reserved.


Creating New Schema
Objects in an Offline Database
Create new schema objects in an offline database by using
wizards to define:
Functions
Materialized views and view logs
Packages
Procedures
Sequences
Synonyms
Tables
Triggers
Types
Views

3-9 Copyright 2008, Oracle. All rights reserved.


Creating a Database Diagram

3 - 10 Copyright 2008, Oracle. All rights reserved.


Importing Tables to the Diagram
from an Offline Database

3 - 11 Copyright 2008, Oracle. All rights reserved.


Editing Objects on the Diagram

In-place editing:

Edit Table dialog box:

3 - 12 Copyright 2008, Oracle. All rights reserved.


Generating Changes from the Diagram
to the Database

Invoke wizard.
In the wizard:
Select objects.
Specify operation.
Set database options.
Set SQL script options.
SQL script opens in
editor;
right-click to run it.

3 - 13 Copyright 2008, Oracle. All rights reserved.


Reconciling Changes to the Database

Choosing ALTER with Manual Reconcile enables you to choose


changes to be generated to the database.

3 - 14 Copyright 2008, Oracle. All rights reserved.


Generating Changes from the Offline Database
Object to the Database

To generate imported offline database objects to the database:


Right-click the object
in the Applications
Navigator
Select Generate To
Select the JDeveloper
connection, or choose
to create a SQL script
or SXML

3 - 15 Copyright 2008, Oracle. All rights reserved.


Importing Database Objects Without a Diagram

You can import database


objects to an offline
database without using a
diagram:

3 - 16 Copyright 2008, Oracle. All rights reserved.


Presenting the Storefront Schema

3 - 17 Copyright 2008, Oracle. All rights reserved.


Summary

In this lesson, you should have learned how to:


Describe JDevelopers tool for database modeling
Create a schema model
Modify the schema model
Reconcile the modifications to the database
Import database object definitions to an offline database
Reconcile offline database objects with the database

3 - 18 Copyright 2008, Oracle. All rights reserved.


Practice 3 Overview:
Modeling the Schema for the Course Application
(optional)

This practice covers the following topics:


Creating a database diagram
Adding existing schema objects to the diagram
Adding a new database object to the diagram
Creating the DDL to add the new object to the database

3 - 19 Copyright 2008, Oracle. All rights reserved.

S-ar putea să vă placă și