Download Systems Integration Secrets Using Logical Databases

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Database model wikipedia , lookup

Transcript
Systems Integration Secrets
Using Logical Databases
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Physical Database
Logical Database
– Underlying storage structure of
persistent data (tables)
vs.
– Group of objects that
presents the underlying
tables in a manner that is
consistent with the
supported application’s and
reporting objectives (*note
this not the only definition
given for logical database)
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Logical Database: Other Definitions
– Not the logical database referred to in Edger F. (Ted) Codd’s Process
of Normalization/Database Design
– Not part of Oracle’s OFA (Optimal Flexible Architecture) – the
standard placement and naming of database-related files to optimize
performance in a multi-disk environment
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Logical Reasons for Creating Logical
Databases
Their world doesn’t revolve around your design
• Simplified supporting reports
• Disparate systems integration – you can “trick” an application
into using your data structures
• Continuous application development
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Additional reasons
• Beneficial for all uses
– even when directly defining an underlying table (i.e. create view
v_employee as select * from employee)
– easier to manage security and more easily accommodates future
changes
• Increase efficiency
– Customize the path by which data is accessed, making users more
efficient and ensuring optimal performance
• Simplifying the complex
– Confusing data structures can be presented in a manner that is
intuitive to users
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Creating Logical Databases
Presentation
Logical
Physical
app1
app2
app3
report
interface
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Tool: view
View: provides a customizable presentation of an underlying
table or tables and acts similar to a table but has no persistent
data
Table: emp
emp_id f_name
1014
Bob
1015
Jane
1016
Sally
l_name
Jones
Doe
Smith
address_no
street
123
Wedgewood
555
East 40th Street
45
10th Street
zip_cd
94105
94578
94105
status
active
active
inactive
Table: zip
zip_cd
city
st
94105 San Diego
CA
94110 Los Angeles CA
94578 San Leandro CA
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Tool: view, continued…
CREATE or REPLACE VIEW EMPLOYEE AS
SELECT emp_id as e_id, f_name || ‘ ‘ || l_name as
full_name, address_no || ‘ ‘ || street as address1, city, st as
state, zip_cd as postal_cd, ‘USA’ as country
FROM emp
WHERE status = ‘active’;
Results: SELECT * FROM EMPLOYEE;
e_id full_name
address1
city
1014 Bob Jones 123 Wedgewood
San Diego
1015 Jane Doe
555 East 40th Street San Leandro
state
CA
CA
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
postal_cd country
94105
USA
94578
USA
Tool: materialized view (snapshot view)
Materialized view: similar to a view except that it stores
persistent data that utilizes the DBMS synchronization to the
underlying tables.
– The Query Rewrite feature of the Oracle optimizer improves
performance by utilizing materialized views
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Tool: triggers (on views)
Triggers: normally data would be inserted, updated or deleted
from the view’s underlying table, but this event driven
process follows the defined in PL/SQL
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Example of view with instead of trigger
CREATE OR REPLACE TRIGGER employee_insert
INSTEAD OF INSERT
ON employee
FOR EACH ROW
BEGIN
INSERT INTO emp
(emp_id, f_name, l_name)
VALUES
(:NEW.emp_id,:NEW.f_name,:NEW.l_name);
END employee_insert;
/
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
On insert to employee:
e_id full_name
address1
city
1014 Bob Jones 123 Wedgewood
San Diego
1015 Jane Doe
555 East 40th Street San Leandro
Insert into emp instead:
emp_id f_name
l_name
1014 Bob
Jones
1015 Jane
Doe
1016 Sally
Smith
state
CA
CA
postal_cd country
94105
USA
94578
USA
address_no
street
zip_cd
123
Wedgewood
94105
th
555
East 40 Street 94578
45
94105
10th Street
status
active
active
inactive
CREATE VIEW EMPLOYEE AS
SELECT emp_id as e_id, f_name || ‘ ‘ || l_name as full_name,
address_no || ‘ ‘ || street as address1, city, st as state, zip_cd as postal_cd,
‘USA’ as country
FROM emp
WHERE status = ‘active’;
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Tools: stored procedures, synonyms,
database link
• Stored Procedures: provides a process to write to underlying
tables, especially helpful for complex operations
• Synonyms: provides a means of renaming to public or a
specific user’s scope underlying objects (tables, types, views,
materialized views, sequences, procedures, functions,
packages)
• Database link: allows creation of connection to a table or
view in a remote database that makes the ojbect act as if it is
local
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Development Process
• Identify a long term vision
– Where is this database going?
• Design changes in physical model
• Decision point
– Modify physical DB and logical accommodates
– OR modify logical DB to represent future physical DB
– Dependency: if applications, reports, stored procedures, etc. – write
directly to tables, you must choose the latter option
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Development Process, continued…
• Group users of data
– applications, reports, interfaces, etc.
• Model groups
– typically based on function which represents the underlying business
objective, i.e. ‘account payable’
• Create logical DB for one or more groups
• Repeat for each iteration
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Project Planning
• Develop a project plan with each iteration at a fix interval
– Typically one to three months
• Lock down schema changes, at which time schema changes
are assigned to the following release (this keeps groups from
waiting for a significant amount of time)
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com
Eric Buskirk
Contact Information:
14895 East 14th Street, Suite 300
San Leandro, CA 94578
www.verican.com
14895 East 14th Street, Suite 300  San Leandro, CA 94578
phone 800.888.0470 / 510.352.3000  fax 510.352.7301  www.verican.com