Professional Documents
Culture Documents
second normal form (2nf) further addresses the concept of removing duplicative
data:
meet all the requirements of the first normal form.
remove subsets of data that apply to multiple rows of a table and place them
in separate tables.
create relationships between these new tables and their predecessors through
the use of foreign keys.
http://mercury.cs.weber.edu/dferro/cs0/chapter8/programs/normalization-
jeremiahchristensen/cs3350_final.html
http://oracle.basisconsultant.com/introduction_to_oracle.htm
data log
the data (of the database) resides in datafiles. because these datafiles are
visible (as files) they're called physical structures as opposed to logical
structures.
one ore more datafiles make up a tablespace. besides of datafiles, there are two
other types of physical structures: redo log files and control files
the logical structures are tablespace, schema
control files
an oracle database must at least have one control file, but usually (for
backup und recovery reasons) it has more than one (all of which are exact copies
of one control file).
the control file contains a number of important information that the instance
needs to operate the database.
the following pieces of information are held in a control file:
the name (os path) of all datafiles that the database consists of, the name
of the database, the timestamp of when the database was created, the checkpoint
(all database changes prior to that checkpoint are saved in the datafiles) and
information for rman. when a database is mounted, its control file is used to find
the datafiles and redo log files for that database. because the control file is so
important,
it is imperative to back up the control file whenever a structural change was made
in the database.
redo log
whenever something is changed on a datafile, oracle records it in the redo
log.
the name redo log indicates its purpose:
when the database crashes, oracle can redo all changes on datafiles which
will take the database data back to the state it was when the last redo record was
written. \
use v$log, v$logfile, v$log_history and v$thread to find information about the
redo log of your database.
declare
v_emprecord emp%rowtype;
%type is used to declare a field with the same type as that of a specified
table's column. example:
declare
v_empno emp.empno%type;
==============
if left out, which of the following would cause an infinite loop to occur in a
simple loop?
loop
end loop
if-then
exit
which line in the following statement will produce an error?
cursor action_cursor is
select name, rate, action
into action_record
from action_table;
there are no errors in this statement.
what is the maximum number of handlers processed before the pl/sql block is exited
when an exception occurs?
only one
all that apply
all referenced
none
for which trigger timing can you reference the new and old qualifiers?
statement and row
statement only
row only
oracle forms trigger
the check_theater trigger of the theater table has been disabled. which command
can you issue to enable this trigger?
alter trigger check_theater enable;
enable trigger check_theater;
alter table check_theater enable check_theater;
enable check_theater;
=====================
brief descriptions of the predefined exceptions follow:
not_logged_on ------ your program issues a database call without being connected
to oracle.
program_error ---- pl/sql has an internal problem.
rowtype_mismatch ---- the host cursor variable and pl/sql cursor variable involved
in an assignment have incompatible return types. for example, when an open
host cursor variable is passed to a stored subprogram, the return types of the
actual and formal parameters must be compatible.
create table t (
x int,
y int,
constraint pk_t_iot primary key(x))
organization index
mapping table;
clustered tables
hash clustered tablels
nested tables
temporary tables
object tables
pro*cobol supports four status variables that serve as error handling mechanisms:
sqlcode
sqlstate
sqlca (using the whenever statement)
oraca
you are the database administrator of your company. you are administering the
company's database systems. you want to make use of the sys uer account
sys (default password: change_on_install)
system (default password: manager)
http://www.adp-gmbh.ch/ora/concepts/tables.html
where exception_name is the name of a previously declared exception and the number
is a negative value corresponding to an ora- error number. the pragma must appear
somewhere after the exception declaration in the same declarative section, as
shown in the following example:
declare
deadlock_detected exception;
pragma exception_init(deadlock_detected, -60);
begin
... -- some operation that causes an ora-00060 error
exception
when deadlock_detected then
-- handle the error
end;
default pacakages:-
dbms_shared_pool
dbms_profiler
dbms_oracle_trace_user
dbms_ldap
dbms_iot
note that in general, not in and not exists are not the same!!!
sql> select count(*) from emp where empno not in ( select mgr from emp );
count(*)
----------
0
apparently there are no rows such that an employee is not a mgr -- everyone is
a mgr (or are they)
ahh, but now there are 9 people who are not managers. beware the null value and
not in!! (also the reason why not in is sometimes avoided).
not in can be just as efficient as not exists -- many orders of magnitude better
even -- if an "anti-join" can be used (if the subquery is known to not return
nulls)