Professional Documents
Culture Documents
Columns
Constraints
Indexes
Views
Database Triggers
Synonyms
Passwords
Database Links
Sequences
Program Files
Application Security
Schema IDs
Roles
Appendix
Base Word
Abbreviation List
I. Introduction
The objective of this documentation is to provide information relevant to the day-
to-day operations of the Oracle server and suggested best practices to follow
when developing Oracle related applications.
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 2 of 9
code and database objects. Even if the enterprise’s standards are different from
an individual’s common practice, it still creates the consistent common
environment. This can save hours of time and confusion and sometimes avoid
costly mistakes.
This document covers standards for Oracle database creation, objects for
application and application security. This paper does not cover standards for
design and coding (including SQL, PL/SQL, HTML, Java, etc.), GUI design,
database and system administration (e.g. SID names, control file names,
database file names, etc.), other file naming conventions and enterprise modeling
rules.
The intended audiences of this documentation are database administrators and
application developers. Knowledge of Oracle is the prerequisite to understanding
this document.
Development
Quality Assurance
Production
Within any given database, there may be more than one application assigned.
Operating policy will allow for applications to access and/or share their data within
the same database, different databases, or even from different databases type.
But access security must be followed Corporation standard and carefully
designed.
Development Environment
The Quality Assurance environment is used for acceptance testing by both end-
user communities and operations. This database environment is controlled.
Changes made to programs, databases objects and etc. will be approved,
monitored by the appropriate groups and then be executed by Database
Administrators. This database environment should be used to test and verify
changes before implementation in the production environment.
Production Environment
The Production environment is the most stable, restricted and controlled of all the
database types. Changes made to this environment will be carried out by
Database Administrators.
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 3 of 9
An oracle database consists of one or more logical storage units called
tablespaces which collectively store all of the database’s data. Each application
will have its own tablespaces for data, indexes, text indexes and bitmap indexes.
For performance reason, the data files of tablespace should spread out multiple
spindles (LUNs). Especially, data files for index and data tablespace. The datafile
name for tablespace should be the form of <Tablespace name>_<nnn>,dbf,
where nnn is the file sequence number for this tablespace.
Example: WA_SALES_DATA_01.DBF, WA_SALES_INDX_01.DBF
It is prohibited to use Oracle data dictionary naming conventions like V$, X$,
USER_ and ALL_ for application object names. Use BASF standards for
abbreviation. The following type of objects is the most commonly used. If other
type of object is needed in your application, please contact Database
Administration Service for naming standard.
Tables
Table names should be short but meaningful. Avoid generic meaningless table
names like DETAIL_DATA, TMP3 or NEWSTUFF. Table names must be unique
throughout an application and describe their full significance within the
organization, not just within the application. It is a recommended practice to have
columns to capture details of creation or modifications to a table.
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 4 of 9
Columns
Column names should be short but meaningful and ended with the abbreviated
base words. Avoid generic meaningless column names like COLUMN1_NO, or
FIELD2_CD.
Don’t use NUMBER without a precision. Specify the scale and precision of a
fixed-point number column for extra integrity checking on input.
Example: ORDER_NO, ORDER_ISSUE_DT
Constraints
Check Constraints:
Indexes
Ordinary Indexes:
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 5 of 9
indexes that should be named NDX_ORDER_HEADER_01 and
NDX_ORDER_HEADER_02.
Partitioned Indexes:
The form of Global Index name can be treated the same as the Ordinary Index
name.
Example: The SALES.ORDER_HEADER table has two partitioned non-unique
indexes that should be named PRTNDX_ORDER_HEADER_01 and
PRTNDX_ORDER_HEADER_02.
Views
View names conform to the same general requirements as table names. Their
names should reflect the function of the view, not the names of the underlying
tables, and will be prefixed with V_ to distinguish them from tables. It will be
usually be necessary to create a number of complex join views to enhance
application and network performance. These views will always be accessed using
the V_ prefix, in order to alert users to the fact that they are using a view.
Temporary tables are created and dropped for temporary usage by applications.
Their names should be the form of TEMP_<meaningful name>.
Stage tables are permanent tables that hold transient data. Their names should
be the form of STG_<meaningful name>. It is expected that working tables be
maintained by a given application which is responsible for populating and deleting
rows. There can be significant system overhead on loading and unloading staging
tables. Use TRUNCATE whenever possible instead of DELETE FROM.
Temporary and stage table names should be prefixed by the application system
acronym.
Example: SALES.TEMP_ORDER_HEADER, SALES.STG_ORDER_LINE_ITEM
Database Triggers
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 6 of 9
Insert, Update or Delete (I, U or D)
Avoid putting code directly in triggers unless it is very simple, i.e. limited to 10
lines or less. Use “packages instead” and call these from the trigger.
Format:
Therefore the trigger type would be one of the following: BIR, BIS, AIR, AIS, BUR,
BUS, AUR, AUS, BDR, BDS, ADR, ADS.
Example: TR_ORDER_HEADER_BUS_01
(This means that the trigger # 01 will be executed before the update occurs on the
table SALES.ORDER_HEADER).
Synonyms
Public synonyms will not be allowed. Try to avoid using private synonyms.
Passwords
Password should not be encoded in the application. Follow BASF security policy
at http://iwww.basf-corp.com/NTI_ComputerSecurity/index.html
Database Links
Database links will not be allowed from DEVL or QUAL to PROD. If necessary
database administration should be contacted to refresh data from PROD to QUAL
or DEVL instances. Public database links will not be allowed. When
GLOBAL_NAMES = TRUE is set for the instance, the database link name must
be the same as the connect string of the target database. When
GLOBAL_NAMES = FALSE is set for the instance, the database link names
should be the form of DBLNK_<connect string of target database>_<nn> where
<nn> is sequence number of target database.
Example: SALES_PROD is the database link to the SALES Production database
when GLOBAL_NAMES = TRUE. DBLNK_SALES_PROD_01 is the database link
to the SALES Production database when GLOBAL_NAMES = FALSE.
Sequences
Program Files
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 7 of 9
SQLPLUS Procedures .sql
Spooled files .lst
Table definition source files .tab
Constraint definition source files .con
Index definition source files .ind
Sequence definition source files .seq
Views .vw
PLSQL Database procedure source files .prc
Database trigger source files .trg
Database packages source files .pkg
Database packages definition source files .pls
Database packages body source files .plb
SQL Loader Control files .ctl
Log files .log
Bad data files .bad
Input data files .dat
Discard files .dis
Application Security
Schema IDs
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 8 of 9
(Example WA_USER) privileges will privileges will privileges will
be granted be granted be granted
Minimum Minimum Minimum
Necessary Necessary Necessary
End User (LAN ID)
privileges will privileges will privileges will
be granted be granted be granted
Roles
The application role should be created based upon the application function area.
Role names should be the form of <Application Name>_<Function>
Example: SALES_UPDATE, SALES_READ_ONLY
Appendix
Base Word
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006
Design Rules Page 9 of 9
WEIGHT wt A measure of the heaviness of something. Must
be accompanied by a weight unit of measure
code.
Abbreviation List
http://iwww.basf-corp.com/NTI/R/DatabaseAdmin/design_rule.htm 7/26/2006