Oracle Interview Questions and Answers
Oracle Interview Questions and Answers
What is a tablespace?
A database is divided into Logical Storage Unit called tablespaces. A tablespace is
used to grouped related logical structures together.
What is schema?
A schema is collection of database objects of a user.
What are the Referential actions supported by FOREIGN KEY integrity constraint ?
UPDATE and DELETE Restrict - A referential integrity rule that disallows the update
or deletion of referenced data. DELETE Cascade - When a referenced row is deleted all
associated dependent rows are deleted.
What is an Index ?
An Index is an optional structure associated with a table to have direct access to rows,
which can be created to increase the performance of data retrieval. Index can be created on
one or more columns of a table.
What is an Extent ?
An Extent is a specific number of contiguous data blocks, obtained in a single
allocation, and used to store a specific type of information.
What is a View ?
A view is a virtual table. Every view has a Query attached to it. (The Query is a
SELECT statement that identifies the columns and rows of the table(s) the view uses.)
What is Table ?
A table is the basic unit of data storage in an ORACLE database. The tables of a
database hold all of the user accessible data. Table data is stored in rows and columns.
What is a synonym?
A synonym is an alias for a table, view, sequence or program unit.
What is a Tablespace?
A database is divided into Logical Storage Unit called tablespace. A tablespace is
used to grouped related logical structures together
What are the different approaches used by Optimizer in choosing an execution plan ?
Rule-based and Cost-based.
Use the same extent size for all the segments in a given tablespace. Locally Managed
tablespaces (available from 8i onwards) with uniform extent sizes virtually eliminates any
tablespace fragmentation. Note that the number of extents per segment does not cause any
performance issue anymore, unless they run into thousands and thousands where additional
I/O may be required to fetch the additional blocks where extent maps of the segment are
stored.
Where can one find the high water mark for a table? (for DBA)
There is no single system table, which contains the high water mark (HWM) for a
table. A table's HWM can be calculated using the results from the following SQL statements:
SELECT BLOCKS
FROM DBA_SEGMENTS
WHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);
ANALYZE TABLE owner.table ESTIMATE STATISTICS;
SELECT EMPTY_BLOCKS
FROM DBA_TABLES
WHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);
Thus, the tables' HWM = (query result 1) - (query result 2) - 1
NOTE: You can also use the DBMS_SPACE package and calculate the HWM =
TOTAL_BLOCKS - UNUSED_BLOCKS - 1.
What is a Schema ?
The set of objects owned by user account is called the schema.
What is clusters ?
Group of tables physically stored together because they share common columns and
are often used together is called Cluster.
What is an Index ? How it is implemented in Oracle Database ?
An index is a database structure used by the server to have direct access of a row in a
table. An index is automatically created when a unique of primary key constraint clause is
specified in create table comman (Ver 7.0)
What are the system resources that can be controlled through Profile ?
The number of concurrent sessions the user can establish the CPU processing time
available to the user's session the CPU processing time available to a single call to ORACLE
made by a SQL statement the amount of logical I/O available to the user's session the amout
of logical I/O available to a single call to ORACLE made by a SQL statement the allowed
amount of idle time for the user's session the allowed amount of connect time for the user's
session.
What is Auditing ?
Monitoring of user access to aid in the investigation of database use.
How does one see the uptime for a database? (for DBA )
Look at the following SQL query:
SELECT to_char (startup_time,'DD-MON-YYYY HH24: MI: SS') "DB Startup Time"
FROM sys.v_$instance;
Marco Bergman provided the following alternative solution:
SELECT to_char (logon_time,'Dy dd Mon HH24: MI: SS') "DB Startup Time"
FROM sys.v_$session
WHERE Sid=1 /* this is pmon */
/
Users still running on Oracle 7 can try one of the following queries:
Column STARTED format a18 head 'STARTUP TIME'
Select C.INSTANCE,
to_date (JUL.VALUE, 'J')
|| to_char (floor (SEC.VALUE/3600), '09')
|| ':'
-- || Substr (to_char (mod (SEC.VALUE/60, 60), '09'), 2, 2)
|| Substr (to_char (floor (mod (SEC.VALUE/60, 60)), '09'), 2, 2)
|| '.'
|| Substr (to_char (mod (SEC.VALUE, 60), '09'), 2, 2) STARTED
from SYS.V_$INSTANCE JUL,
SYS.V_$INSTANCE SEC,
SYS.V_$THREAD C
Where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
Select to_date (JUL.VALUE, 'J')
|| to_char (to_date (SEC.VALUE, 'SSSSS'), ' HH24:MI:SS') STARTED
from SYS.V_$INSTANCE JUL,
SYS.V_$INSTANCE SEC
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
select to_char (to_date (JUL.VALUE, 'J') + (SEC.VALUE/86400), -Return a DATE
'DD-MON-YY HH24:MI:SS') STARTED
from V$INSTANCE JUL,
V$INSTANCE SEC
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
What is a profile ?
Each database user is assigned a Profile that specifies limitations on various system
resources available to the user.
How can one see who is using a temporary segment? (for DBA )
For every user using temporary space, there is an entry in SYS.V$_LOCK with type
'TS'.
All temporary segments are named 'ffff.bbbb' where 'ffff' is the file it is in and 'bbbb' is first
block of the segment. If your temporary tablespace is set to TEMPORARY, all sorts are done
in one large temporary segment. For usage stats, see SYS.V_$SORT_SEGMENT
From Oracle 8.0, one can just query SYS.v$sort_usage. Look at these examples:
select s.username, u."USER", u.tablespace, u.contents, u.extents, u.blocks
from sys.v_$session s, sys.v_$sort_usage u
where s.addr = u.session_addr
/
select s.osuser, s.process, s.username, s.serial#,
Sum (u.blocks)*vp.value/1024 sort_size
from sys.v_$session s, sys.v_$sort_usage u, sys.v_$parameter VP
where s.saddr = u.session_addr
and vp.name = 'db_block_size'
and s.osuser like '&1'
group by s.osuser, s.process, s.username, s.serial#, vp.value
/
How can we specify the Archived log file name format and destination?
By setting the following values in init.ora file. LOG_ARCHIVE_FORMAT = arch
%S/s/T/tarc (%S - Log sequence number and is zero left paded, %s - Log sequence number
not padded. %T - Thread number lef-zero-paded and %t - Thread number not padded). The
file name created is arch 0001 are if %S is used. LOG_ARCHIVE_DEST = path.
What is a SNAPSHOT ?
Snapshots are read-only copies of a master table located on a remote node which is
periodically refreshed to reflect changes made to the master table.
What is snapshots?
Snapshot is an object used to dynamically replicate data between distribute database
at specified time intervals. In ver 7.0 they are read only.
Can you have more than one content canvas view attached with a window?
Yes. Each window you create must have atleast one content canvas view assigned to
it. You can also create a window that has manipulated content canvas view. At run time only
one of the content canvas views assign to a window is displayed at a time.
Does a Before form trigger fire when the parameter form is suppressed?
Yes.
What is SGA?
The System Global Area in an Oracle database is the area in memory to facilitate the
transfer of information between users. It holds the most recently requested structural
information between users. It holds the most recently requested structural information about
the database. The structure is database buffers, dictionary cache, redo log buffer and shared
pool area.
What are the factors causing the reparsing of SQL statements in SGA?
Due to insufficient shared pool size.Monitor the ratio of the reloads takes place while
executing SQL statements. If the ratio is greater than 1 then increase the
SHARED_POOL_SIZE.
If a parameter is used in a query without being previously defined, what diff. exist
between. report 2.0 and 2.5 when the query is applied?
While both reports 2.0 and 2.5 create the parameter, report 2.5 gives a message that a
bind parameter has been created.
What are the sql clauses supported in the link property sheet?
Where start with having.
What is the "LOV of Validation" Property of an item? What is the use of it?
When LOV for Validation is set to True, Oracle Forms compares the current value of
the text item to the values in the first column displayed in the LOV. Whenever the validation
event occurs. If the value in the text item matches one of the values in the first column of the
LOV, validation succeeds, the LOV is not displayed, and processing continues normally. If
the value in the text item does not match one of the values in the first column of the LOV,
Oracle Forms displays the LOV and uses the text item value as the search criteria to
automatically reduce the list.
What is the diff. when Flex mode is mode on and when it is off?
When flex mode is on, reports automatically resizes the parent when the child is
resized.
What are the two types of views available in the object navigator(specific to report 2.5)?
If two groups are not linked in the data model editor, What is the hierarchy between
them?
Two group that is above are the left most rank higher than the group that is to right or
below it.
An open form can not be execute the call_form procedure if you chain of called forms
has been initiated by another open form?
True
What is the purpose of the product order option in the column property sheet?
To specify the order of individual group evaluation in a cross products.
What is a timer?
Timer is an "internal time clock" that you can programmatically create to perform an
action each time the times.
What are the default extensions of the files created by library module?
The default file extensions indicate the library module type and storage format .pll -
pl/sql library module binary
What are the built-ins that are used to Attach an LOV programmatically to an item?
set_item_property
get_item_property
(by setting the LOV_NAME property)
What are the different file extensions that are created by oracle reports?
Rep file and Rdf file.
How does one put a database into ARCHIVELOG mode? (for DBA )
The main reason for running in archivelog mode is that one can provide 24-hour
availability and guarantee complete data recoverability. It is also necessary to enable
ARCHIVELOG mode before one can start to use on-line database backups. To enable
ARCHIVELOG mode, simply change your database startup command script, and bounce the
database:
SQLPLUS> connect sys as sysdba
SQLPLUS> startup mount exclusive;
SQLPLUS> alter database archivelog;
SQLPLUS> archive log start;
SQLPLUS> alter database open;
NOTE1: Remember to take a baseline database backup right after enabling archivelog mode.
Without it one would not be able to recover. Also, implement an archivelog backup to
prevent the archive log directory from filling-up.
NOTE2: ARCHIVELOG mode was introduced with Oracle V6, and is essential for database
point-in-time recovery. Archiving can be used in combination with on-line and off-line
database backups.
NOTE3: You may want to set the following INIT.ORA parameters when enabling
ARCHIVELOG mode: log_archive_start=TRUE, log_archive_dest=... and
log_archive_format=...
NOTE4: You can change the archive log destination of a database on-line with the
ARCHIVE LOG START TO 'directory'; statement. This statement is often used to switch
archiving between a set of directories.
NOTE5: When running Oracle Real Application Server (RAC), you need to shut down all
nodes before changing the database to ARCHIVELOG mode.
What is the basic data structure that is required for creating an LOV?
Record Group.
How does one backup archived log files? (for DBA )
One can backup archived log files using RMAN or any operating system backup
utility. Remember to delete files after backing them up to prevent the archive log directory
from filling up. If the archive log directory becomes full, your database will hang! Look at
this simple RMAN backup script:
RMAN> run {
2> allocate channel dev1 type disk;
3> backup
4> format '/app/oracle/arch_backup/log_t%t_s%s_p%p'
5> (archivelog all delete input);
6> release channel dev1;
7> }
Does Oracle write to data files in begin/hot backup mode? (for DBA )
Oracle will stop updating file headers, but will continue to write data to the database
files even if a tablespace is in backup mode.
In backup mode, Oracle will write out complete changed blocks to the redo log files.
Normally only deltas (changes) are logged to the redo logs. This is done to enable
reconstruction of a block if only half of it was backed up (split blocks). Because of this, one
should notice increased log activity and archiving during on-line backups.
Which parameter can be used to set read level consistency across multiple queries?
Read only
What are difference between post database commit and post-form commit?
Post-form commit fires once during the post and commit transactions process, after
the database commit occurs. The post-form-commit trigger fires after inserts, updates and
deletes have been posted to the database but before the transactions have been finalized in the
issuing the command. The post-database-commit trigger fires after oracle forms issues the
commit to finalized transactions.
What are the two repeating frame always associated with matrix object?
One down repeating frame below one across repeating frame.
If a break order is set on a column would it affect columns which are under the column?
No
Why are OPS$ accounts a security risk in a client/server environment? (for DBA)
If you allow people to log in with OPS$ accounts from Windows Workstations, you
cannot be sure who they really are. With terminals, you can rely on operating system
passwords, with Windows, you cannot.
If you set REMOTE_OS_AUTHENT=TRUE in your init.ora file, Oracle assumes that the
remote OS has authenticated the user. If REMOTE_OS_AUTHENT is set to FALSE
(recommended), remote users will be unable to connect without a password. IDENTIFIED
EXTERNALLY will only be in effect from the local host. Also, if you are using "OPS$" as
your prefix, you will be able to log on locally with or without a password, regardless of
whether you have identified your ID with a password or defined it to be IDENTIFIED
EXTERNALLY.
Is it possible to link two groups inside a cross products after the cross products group
has been created?
no
What are the different default triggers created when Master Deletes Property is set to
Non-isolated?
Master Deletes Property Resulting Triggers
----------------------------------------------------
Non-Isolated(the default) On-Check-Delete-Master
On-Clear-Details
On-Populate-Details
What are the different default triggers created when Master Deletes Property is set to
isolated?
Master Deletes Property Resulting Triggers
---------------------------------------------------
Isolated On-Clear-Details
On-Populate-Details
What are the different default triggers created when Master Deletes Property is set to
Cascade?
Master Deletes Property Resulting Triggers
---------------------------------------------------
Cascading On-Clear-Details
On-Populate-Details
Pre-delete
What is system.coordination_operation?
It represents the coordination causing event that occur on the master block in master-
detail relation.
What is synchronize?
It is a terminal screen with the internal state of the form. It updates the screen display
to reflect the information that oracle forms has in its internal representation of the screen.
What is forms_DDL?
Issues dynamic Sql statements at run time, including server side pl/SQl and DDL
How is link tool operation different bet. reports 2 & 2.5?
In Reports 2.0 the link tool has to be selected and then two fields to be linked are
selected and the link is automatically created. In 2.5 the first field is selected and the link tool
is then used to link the first field to the second field.
What is the difference between object embedding & linking in Oracle forms?
In Oracle forms, Embedded objects become part of the form module, and linked
objects are references from a form module to a linked source file.
What are the built-ins that are used for setting the LOV properties at runtime?
get_lov_property
set_lov_property
Atleast how many set of data must a data model have before a data model can be base
on it?
Four
To execute row from being displayed that still use column in the row which property
can be used?
Format trigger.
Use the Add_group_row procedure to add a row to a static record group 1. true or
false?
False
What third party tools can be used with Oracle EBU/ RMAN? (for DBA)
The following Media Management Software Vendors have integrated their media
management software packages with Oracle Recovery Manager and Oracle7 Enterprise
Backup Utility. The Media Management Vendors will provide first line technical support for
the integrated backup/recover solutions.
Veritas NetBackup
EMC Data Manager (EDM)
HP OMNIBack II
IBM's Tivoli Storage Manager - formerly ADSM
Legato Networker
ManageIT Backup and Recovery
Sterling Software's SAMS:Alexandria - formerly from Spectralogic
Sun Solstice Backup
How can a break order be created on a column in an existing group? What are the
various sub events a mouse double click event involves?
By dragging the column outside the group.
What is the use of place holder column? What are the various sub events a mouse
double click event involves?
A placeholder column is used to hold calculated values at a specified place rather than
allowing is to appear in the actual row where it has to appear.
What is the use of hidden column? What are the various sub events a mouse double
click event involves?
A hidden column is used to when a column has to embed into boilerplate text.
Application Tuning:
Experience showed that approximately 80% of all Oracle system performance problems are
resolved by coding optimal SQL. Also consider proper scheduling of batch tasks after peak
working hours.
Memory Tuning:
Properly size your database buffers (shared pool, buffer cache, log buffer, etc) by looking at
your buffer hit ratios. Pin large objects into memory to prevent frequent reloads.
Disk I/O Tuning:
Database files needs to be properly sized and placed to provide maximum disk subsystem
throughput. Also look for frequent disk sorts, full table scans, missing indexes, row chaining,
data fragmentation, etc
Eliminate Database Contention:
Study database locks, latches and wait events carefully and eliminate where possible. Tune
the Operating System:
Monitor and tune operating system CPU, I/O and memory utilization. For more information,
read the related Oracle FAQ dealing with your specific operating system.
What are the various sub events a mouse double click event involves? What are the
various sub events a mouse double click event involves?
Double clicking the mouse consists of the mouse down, mouse up, mouse click,
mouse down & mouse up events.
What are the default parameter that appear at run time in the parameter screen? What
are the various sub events a mouse double click event involves?
Destype and Desname.
What are the built-ins used for Creating and deleting groups?
CREATE-GROUP (function)
CREATE_GROUP_FROM_QUERY(function)
DELETE_GROUP(procedure)
What are the different types of Delete details we can establish in Master-Details?
Cascade
Isolate
Non-isolate
What is relation between the window and canvas views?
Canvas views are the back ground objects on which you place the interface items
(Text items), check boxes, radio groups etc.,) and boilerplate objects (boxes, lines, images
etc.,) that operators interact with us they run your form . Each canvas views displayed in a
window.
What is a User_exit?
Calls the user exit named in the user_exit_string. Invokes a 3Gl program by name
which has been properly linked into your current oracle forms executable.
How is it possible to select generate a select set for the query in the query property
sheet?
By using the tables/columns button and then specifying the table and the column
names.
How can values be passed bet. precompiler exits & Oracle call interface?
By using the statement EXECIAFGET & EXECIAFPUT.
How can a square be drawn in the layout editor of the report writer?
By using the rectangle tool while pressing the (Constraint) key.
How can a text file be attached to a report while creating in the report writer?
By using the link file property in the layout boiler plate property sheet.
Does one need to drop/ truncate objects before importing? (for DBA)
Before one import rows into already populated tables, one needs to truncate or drop these
tables to get rid of the old data. If not, the new data will be appended to the existing tables.
One must always DROP existing Sequences before re-importing. If the sequences are not
dropped, they will generate numbers inconsistent with the rest of the database. Note: It is also
advisable to drop indexes before importing to speed up the import process. Indexes can easily
be recreated after the data was successfully imported.
. Create an indexfile so that you can create indexes AFTER you have imported data. Do this
by setting INDEXFILE to a filename and then import. No data will be imported but a file
containing index definitions will be created. You must edit this file afterwards and supply the
passwords for the schemas on all CONNECT statements.
. Place the file to be imported on a separate physical disk from the oracle data files
. Increase DB_CACHE_SIZE (DB_BLOCK_BUFFERS prior to 9i) considerably in the
init$SID.ora file
. Set the LOG_BUFFER to a big value and restart oracle.
. Stop redo log archiving if it is running (ALTER DATABASE NOARCHIVELOG;)
. Create a BIG tablespace with a BIG rollback segment inside. Set all other rollback segments
offline (except the SYSTEM rollback segment of course). The rollback segment must be as
big as your biggest table (I think?)
. Use COMMIT=N in the import parameter file if you can afford it
. Use ANALYZE=N in the import parameter file to avoid time consuming ANALYZE
statements
. Remember to run the indexfile previously created
Where is a procedure return in an external pl/sql library executed at the client or at the
server?
At the client.
What is an LOV?
An LOV is a scrollable popup window that provides the operator with either a single or multi
column selection list.
What are the built -ins used for Modifying a groups structure?
ADD-GROUP_COLUMN (function)
ADD_GROUP_ROW (procedure)
DELETE_GROUP_ROW(procedure)
I've lost my REDOLOG files, how can I get my DB back? (for DBA)
The following INIT.ORA parameter may be required if your current redo logs are corrupted
or blown away. Caution is advised when enabling this parameter as you might end-up losing
your entire database. Please contact Oracle Support before using it.
_allow_resetlogs_corruption = true
I've lost some Rollback Segments, how can I get my DB back? (for DBA)
Re-start your database with the following INIT.ORA parameter if one of your rollback
segments is corrupted. You can then drop the corrupted rollback segments and create it from
scratch.
Caution is advised when enabling this parameter, as uncommitted transactions will be marked
as committed. One can very well end up with lost or inconsistent data!!! Please contact
Oracle Support before using it. _Corrupted_rollback_segments = (rbs01, rbs01, rbs03, rbs04)
What are the differences between EBU and RMAN? (for DBA)
Enterprise Backup Utility (EBU) is a functionally rich, high performance interface for
backing up Oracle7 databases. It is sometimes referred to as OEBU for Oracle Enterprise
Backup Utility. The Oracle Recovery Manager (RMAN) utility that ships with Oracle8 and
above is similar to Oracle7's EBU utility. However, there is no direct upgrade path from EBU
to RMAN.
How can a group in a cross products be visually distinguished from a group that does
not form a cross product?
A group that forms part of a cross product will have a thicker border.
What are three panes that appear in the run time pl/sql interpreter?
1. Source pane.
2. interpreter pane.
3. Navigator pane.
What are the two panes that Appear in the design time pl/sql interpreter?
1. Source pane.
2. Interpreter pane
What are the two ways by which data can be generated for a parameters list of values?
1. Using static values.
2. Writing select statement.
What are the default extensions of the files created by menu module?
.mmb,
.mmx
What are the default extensions of the files created by forms modules?
.fmb - form module binary
.fmx - form module executable
To display the page no. for each page on a report what would be the source & logical
page no. or & of physical page no.?
& physical page no.
It is possible to use raw devices as data files and what is the advantages over file. system
files ?
Yes. The advantages over file system files. I/O will be improved because Oracle is bye-
passing the kernnel which writing into disk. Disk Corruption will be very less.
What is the difference between locks, latches, enqueues and semaphores? (for DBA)
A latch is an internal Oracle mechanism used to protect data structures in the SGA from
simultaneous access. Atomic hardware instructions like TEST-AND-SET is used to
implement latches. Latches are more restrictive than locks in that they are always exclusive.
Latches are never queued, but will spin or sleep until they obtain a resource, or time out.
Enqueues and locks are different names for the same thing. Both support queuing and
concurrency. They are queued and serviced in a first-in-first-out (FIFO) order.
Semaphores are an operating system facility used to control waiting. Semaphores are
controlled by the following Unix parameters: semmni, semmns and semmsl. Typical settings
are:
semmns = sum of the "processes" parameter for each instance
(see init<instance>.ora for each instance)
semmni = number of instances running simultaneously;
semmsl = semmns
Where can one get a list of all hidden Oracle parameters? (for DBA)
Oracle initialization or INIT.ORA parameters with an underscore in front are hidden or
unsupported parameters. One can get a list of all hidden parameters by executing this query:
select *
from SYS.X$KSPPI
where substr(KSPPINM,1,1) = '_';
The following query displays parameter names with their current value:
select a.ksppinm "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value"
from x$ksppi a, x$ksppcv b, x$ksppsv c
where a.indx = b.indx and a.indx = c.indx
and substr(ksppinm,1,1)='_'
order by a.ksppinm;
Remember: Thou shall not play with undocumented parameters!
What is a database EVENT and how does one set it? (for DBA)
Oracle trace events are useful for debugging the Oracle database server. The following two
examples are simply to demonstrate syntax. Refer to later notes on this page for an
explanation of what these particular events do.
Either adding them to the INIT.ORA parameter file can activate events. E.g.
event='1401 trace name errorstack, level 12'
... or, by issuing an ALTER SESSION SET EVENTS command: E.g.
alter session set events '10046 trace name context forever, level 4';
The alter session method only affects the user's current session, whereas changes to the
INIT.ORA file will affect all sessions once the database has been restarted.
" 10046 trace name context forever, level 4 Trace SQL statements and show bind variables in
trace output.
" 10046 trace name context forever, level 8 This shows wait events in the SQL trace files
" 10046 trace name context forever, level 12 This shows both bind variable names and wait
events in the SQL trace files
" 1401 trace name errorstack, level 12 1401 trace name errorstack, level 4 1401 trace name
processstate Dumps out trace information if an ORA-1401 "inserted value too large for
column" error occurs. The 1401 can be replaced by any other Oracle Server error code that
you want to trace.
" 60 trace name errorstack level 10 Show where in the code Oracle gets a deadlock (ORA-
60), and may help to diagnose the problem.
The following lists of events are examples only. They might be version specific, so please
call Oracle before using them:
" 10210 trace name context forever, level 10 10211 trace name context forever, level 10
10231 trace name context forever, level 10 These events prevent database block corruptions
" 10049 trace name context forever, level 2 Memory protect cursor
" 10210 trace name context forever, level 2 Data block check
" 10211 trace name context forever, level 2 Index block check
" 10235 trace name context forever, level 1 Memory heap check
" 10262 trace name context forever, level 300 Allow 300 bytes memory leak for connections
Note: You can use the Unix oerr command to get the description of an event. On Unix, you
can type "oerr ora 10053" from the command prompt to get event details.
How free extents are managed in Ver 6.0 and Ver 7.0 ?
Free extents cannot be merged together in Ver 6.0.
Free extents are periodically coalesces with the neighboring free extent in Ver 7.0
How will you swap objects into a different table space for an existing database ?
Export the user
Perform import using the command imp system/manager file=export.dmp
indexfile=newrite.sql.
This will create all definitions into newfile.sql. Drop necessary objects.
Run the script newfile.sql after altering the tablespaces.
Import from the backup for the necessary objects.
What are the factors causing the reparsing of SQL statements in SGA?
Due to insufficient Shared SQL pool size. Monitor the ratio of the reloads takes place while
executing SQL statements. If the ratio is greater than 1 then increase the
SHARED_POOL_SIZE. LOGICAL & PHYSICAL ARCHITECTURE OF DATABASE.
What is dictionary cache ?
Dictionary cache is information about the databse objects stored in a data dictionary table.
While specifying master/detail relationship between two blocks specifying the join
condition is a must ?
True or False. ?
True
A query fetched 10 records How many times does a PRE-QUERY Trigger and POST-
QUERY Trigger will get executed ?
PRE-QUERY fires once.
POST-QUERY fires 10 times.
Give the sequence in which triggers fired during insert operations, when the following 3
triggers are defined at the same block level ?
a. ON-INSERT b. POST-INSERT c. PRE-INSERT
Can we create two blocks with the same name in form 3.0 ?
No
Name the two files that are created when you generate the form give the filex
extension ?
INP (Source File)
FRM (Executable File)
What package procedure used for invoke sql *plus from sql *forms ?
Host (E.g. Host (sqlplus))
What is the difference between a Function Key Trigger and Key Function Trigger ?
Function key triggers are associated with individual SQL*FORMS function keys You can
attach Key function triggers to 10 keys or key sequences that normally do not perform any
SQL * FORMS operations. These keys referred as key F0 through key F9.
Where can one find I/O statistics per table? (for DBA)
The UTLESTAT report shows I/O per tablespace but one cannot see what tables in the
tablespace has the most I/O. The $ORACLE_HOME/rdbms/admin/catio.sql script creates a
sample_io procedure and table to gather the required information. After executing the
procedure, one can do a simple SELECT * FROM io_per_object; to extract the required
information. For more details, look at the header comments in the
$ORACLE_HOME/rdbms/admin/catio.sql script.
My query was fine last week and now it is slow. Why? (for DBA)
The likely cause of this is because the execution plan has changed. Generate a current explain
plan of the offending query and compare it to a previous one that was taken when the query
was performing well. Usually the previous plan is not available.
Some factors that can cause a plan to change are:
. Which tables are currently analyzed? Were they previously analyzed? (ie. Was the query
using RBO and now CBO?)
. Has OPTIMIZER_MODE been changed in INIT.ORA?
. Has the DEGREE of parallelism been defined/changed on any table?
. Have the tables been re-analyzed? Were the tables analyzed using estimate or compute? If
estimate, what percentage was used?
. Have the statistics changed?
. Has the INIT.ORA parameter DB_FILE_MULTIBLOCK_READ_COUNT been changed?
. Has the INIT.ORA parameter SORT_AREA_SIZE been changed?
. Have any other INIT.ORA parameters been changed?
. What do you think the plan should be? Run the query with hints to see if this produces the
required performance.
What are the unrestricted procedures used to change the popup screen position during
run time ?
Anchor-view
Resize -View
Move-View.
What is an Alert ?
An alert is window that appears in the middle of the screen overlaying a portion of the current
display.
Deleting a page removes information about all the fields in that page ?
a. True. b. False
a. True.
Two popup pages can appear on the screen at a time ?Two popup pages can appear on
the screen at a time ?
a. True. b. False?
a. True.
a. Call - unrestricted
b. User Exit - Unrestricted
c. Call_query - Unrestricted
d. Up - Restricted
e. Execute Query - Restricted
f. Message - Restricted
g. Exit_form - Restricted
h. Post - Restricted
i. Break - Unrestricted.
What is a Trigger ?
A piece of logic that is executed at or triggered by a SQL *forms event.
1. Error_Code
2. Error_Text
3. Form_Failure
4. Form_Fatal
5. Message_Code
Can you attach an lov to a field at run-time? if yes, give the build-in name.?
Yes. Set_item_proprety
How many maximum number of radio buttons can you assign to a radio group?
Unlimited no of radio buttons can be assigned to a radio group
How do you pass the parameters from one form to another form?
To pass one or more parameters to a called form, the calling form must perform the following
steps in a trigger or user named routine execute the create_parameter_list built-in function to
programmatically. Create a parameter list to execute the add parameter built-in procedure to
add one or more parameters list. Execute the call_form, New_form or run_product built_in
procedure and include the name or id of the parameter list to be passed to the called form.
List system variables available in forms 4.0, and not available in forms 3.0?
System.cordination_operation
System Date_threshold
System.effective_Date
System.event_window
System.suppress_working
What built-in is used for changing the properties of the window dynamically?
Set_window_property
Canvas-View
What are the menu items that oracle forms 4.0 supports?
Plain, Check,Radio, Separator, Magic
Give the equivalent term in forms 4.0 for the following. Page, Page 0?
Page - Canvas-View
Page 0 - Canvas-view null.
What is the built-in used to get and set lov properties during run-time?
Get_lov_property
Set_lov_property
Record Group
Write the Abbreviation for the following File Extension 1. FMB 2. MMB 3. PLL?
FMB ----- Form Module Binary.
MMB ----- Menu Module Binary.
PLL ------ PL/SQL Library Module Binary.
What is an Lov?
A list of values is a single or multi column selection list displayed in a pop-up window
List the built-in routines for the controlling canvas views during run-time?
Find_canvas
Get-Canvas_property
Get_view_property
Hide_View
Replace_content_view
Scroll_view
Set_canvas_property
Set_view_property
Show_view
Alert
What is an Alert?
An alert is a modal window that displays a message notifies the operator of some application
condition
What are the built-in routines is available in forms 4.0 to create and manipulate a
parameter list?
Add_parameter
Create_Parameter_list
Delete_parameter
Destroy_parameter_list
Get_parameter_attr
Get_parameter_list
set_parameter_attr
What is a canvas-view?
A canvas-view is the background object on which you layout the interface items (text-items,
check boxes, radio groups, and so on.) and boilerplate objects that operators see and interact
with as they run your form. At run-time, operators can see only those items that have been
assigned to a specific canvas. Each canvas, in term, must be displayed in a specific window.
Name the tables where characteristics of Package, procedure and functions are stored ?
User_objects, User_Source and User_error.
What are two virtual tables available during database trigger execution ?
The table columns are referred as OLD.column_name and NEW.column_name.
For triggers related to INSERT only NEW.column_name values only available.
For triggers related to UPDATE only OLD.column_name NEW.column_name values only
available.
For triggers related to DELETE only OLD.column_name values only available.
What is Raise_application_error ?
Raise_application_error is a procedure of package DBMS_STANDARD which allows to
issue an user_defined error messages from stored sub-program or database trigger.
How many types of database triggers can be specified on a table ? What are they ?
Insert Update Delete
Before Row o.k. o.k. o.k.
After Row o.k. o.k. o.k.
Before Statement o.k. o.k. o.k.
After Statement o.k. o.k. o.k.
If FOR EACH ROW clause is specified, then the trigger for each Row affected by the
statement.
If WHEN clause is specified, the trigger fires according to the returned Boolean value.
I & ii.
How packaged procedures and functions are called from the following?
a. Stored procedure or anonymous block
b. an application program such a PRC *C, PRO* COBOL
c. SQL *PLUS??
What are % TYPE and % ROWTYPE ? What are the advantages of using these over
datatypes?
% TYPE provides the data type of a variable or a database column to that variable.
% ROWTYPE provides the record type that represents a entire row of a table or view or
columns selected in the cursor.
The advantages are :
I. Need not know about variable's data type
ii. If the database definition of a column in a table changes, the data type of a variable
changes accordingly.
What are the different types of PL/SQL program units that can be defined and stored in
ORACLE database ?
Procedures and Functions,Packages and Database Triggers.
What is a Procedure ?
A Procedure consist of a set of SQL and PL/SQL statements that are grouped together as a
unit to solve a specific problem or perform a set of related tasks.
What is a Package ?
A Package is a collection of related procedures, functions, variables and other package
constructs together as a unit in the database.
What is an UTL_FILE.What are different procedures and functions associated with it?
UTL_FILE is a package that adds the ability to read and write to operating system files.
Procedures associated with it are FCLOSE, FCLOSE_ALL and 5 procedures to output data
to a file PUT, PUT_LINE, NEW_LINE, PUTF, FFLUSH.PUT,
FFLUSH.PUT_LINE,FFLUSH.NEW_LINE. Functions associated with it are FOPEN,
ISOPEN.
What should be the return type for a cursor variable. Can we use a scalar data type as
return type?
The return type for a cursor must be a record type.It can be declared explicitly as a user-
defined or %ROWTYPE can be used. eg TYPE t_studentsref IS REF CURSOR RETURN
students%ROWTYPE
What are various privileges that a user can grant to another user?
-SELECT
-CONNECT
-RESOURCES
Display the records between two range?
select rownum, empno, ename from emp where rowid in (select rowid from emp where
rownum <=&upto minus select rowid from emp where rownum<&Start);
What is a cursor?
Oracle uses work area to execute SQL statements and store processing information PL/SQL
construct called a cursor lets you name a work area and access its stored information A cursor
is a mechanism used to fetch more than one row in a Pl/SQl block.
Can cursor variables be stored in PL/SQL tables. If yes how. If not why?
No, a cursor variable points a row which cannot be stored in a two-dimensional PL/SQL
table.
There is a string 120000 12 0 .125 , how you will find the position of the decimal place?
INSTR('120000 12 0 .125',1,'.')
output 13
What are different modes of parameters used in functions and procedures?
-IN -OUT -INOUT
When do you use WHERE clause and when do you use HAVING clause?
HAVING clause is used when you want to specify a condition for a group function and it is
written after GROUP BY clause. The WHERE clause is used when you want to specify a
condition for columns, single row functions except group functions and it is written before
GROUP BY clause if it is used.
What is syntax for dropping a procedure and a function .Are these operations possible?
Drop Procedure procedure_name
Drop Function function_name
What is a view ?
A view is stored procedure based on one or more tables, it’s a virtual table.
What is difference between UNIQUE and PRIMARY KEY constraints?
A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE
keys. The columns that compose PK are automatically define NOT NULL, whereas a column
that compose a UNIQUE is not automatically defined to be mandatory must also specify the
column is NOT NULL.
What is the maximum buffer size that can be specified using the
DBMS_OUTPUT.ENABLE function?
1,000,00
There is a % sign in one field of a column. What will be the query to find it?
'' Should be used before '%'.
What is a transaction ?
Transaction is logical unit between two commits and commit and rollback.
What are the advantages of VIEW ?
To protect some of the columns of a table from other users.To hide complexity of a query.To
hide complexity of calculations.
How to access the current value and next value from a sequence ? Is it possible to access
the current value in a session before accessing next value ?
Sequence name CURRVAL, Sequence name NEXTVAL.It is not possible. Only if you
access next value in the session, current value can be accessed.
What are the usage of SAVEPOINTS ?value in a session before accessing next value ?
SAVEPOINTS are used to subdivide a transaction into smaller parts. It enables rolling back
part of a transaction. Maximum of five save points are allowed.
How many LONG columns are allowed in a table ? Is it possible to use LONG columns
in WHERE clause or ORDER BY ?
Only one LONG columns is allowed. It is not possible to use LONG column in WHERE or
ORDER BY clause.
If an unique key constraint on DATE column is created, will it validate the rows that
are inserted with SYSDATE ?
It won't, Because SYSDATE format contains time attached with it.
How does one stop and start the OMS? (for DBA)
Use the following command sequence to stop and start the OMS (Oracle Management
Server):
oemctl start oms
oemctl status oms sysman/oem_temp
oemctl stop oms sysman/oem_temp
Windows NT/2000 users can just stop and start the required services. The default OEM
administrator is "sysman" with a password of "oem_temp".
NOTE: Use command oemctrl instead of oemctl for Oracle 8i and below.
If a View on a single base table is manipulated will the changes be reflected on the base
table ?
If changes are made to the tables which are base tables of a view will the changes be
reference on the view.
The following describes means to create a OEM V1.x (very old!!!) repository on
WindowsNT:
. Create a tablespace that would hold the repository data. A size between 200- 250 MB would
be ideal. Let us call it Dummy_Space.
. Create an Oracle user who would own this repository. Assign DBA, SNMPAgent,
Exp_Full_database, Imp_Full_database roles to this user. Lets call this user Dummy_user.
Assign Dummy_Space as the default tablespace.
. Create an operating system user with the same name as the Oracle username. I.e.
Dummy_User. Add 'Log on as a batch job' under advanced rights in User manager.
. Fire up Enterprise manager and log in as Dummy_User and enter the password. This would
trigger the creation of the repository. From now on, Enterprise manager is ready to accept
jobs.
How does one list one's databases in the OEM Console? (for DBA)
Follow these steps to discover databases and other services from the OEM Console:
1. Ensure the GLOBAL_DBNAME parameter is set for all databases in your
LISTENER.ORA file (optional). These names will be listed in the OEM Console. Please note
that names entered are case sensitive. A portion of a listener.ora file:
(SID_DESC =
(GLOBAL_DBNAME = DB_name_for_OEM)
(SID_NAME = ...
2. Start the Oracle Intelligent Agent on the machine you want to discover. See section "How
does one start the Oracle Intelligent Agent?".
3. Start the OEM Console, navigate to menu "Navigator/ Discover Nodes". The OEM
Discovery Wizard will guide you through the process of discovering your databases and other
services.
What is CYCLE/NO CYCLE in a Sequence ?
CYCLE specifies that the sequence continues to generate values after reaching either
maximum or minimum value. After pan ascending sequence reaches its maximum value, it
generates its minimum value. After a descending sequence reaches its minimum, it generates
its maximum.NO CYCLE specifies that the sequence cannot generate more values after
reaching its maximum or minimum value.
What is difference between CHAR and VARCHAR2 ? What is the maximum SIZE
allowed for each type ?
CHAR pads blank spaces to the maximum length. VARCHAR2 does not pad blank spaces.
For CHAR it is 255 and 2000 for VARCHAR2.
What are the different types of Coordinations of the Master with the Detail block?
POPULATE_GROUP(function)
POPULATE_GROUP_WITH_QUERY(function)
SET_GROUP_CHAR_CELL(procedure)
SET_GROUPCELL(procedure)
SET_GROUP_NUMBER_CELL(procedure)
Use the ADD_GROUP_COLUMN function to add a column to a record group that was
created at design time?
I) TRUE II) FALSE
II) FALSE
Suppose a customer table is having different columns like customer no, payments.What
will be the query to select top three max payments?
SELECT customer_no, payments from customer C1
WHERE 3<=(SELECT COUNT(*) from customer C2
WHERE C1.payment <= C2.payment)
What are the Back ground processes in Oracle and what are they.
This is one of the most frequently asked question.There are basically 9 Processes but in a
general system we need to mention the first five background processes.They do the house
keeping activities for the Oracle and are common in any system.
The various background processes in oracle are
a) Data Base Writer(DBWR) :: Data Base Writer Writes Modified blocks from Database
buffer cache to Data Files.This is required since the data is not written whenever a transaction
is committed.
b)LogWriter(LGWR) :: LogWriter writes the redo log entries to disk. Redo Log data is
generated in redo log buffer of SGA. As transaction commits and log buffer fills, LGWR
writes log entries into a online redo log file.
c) System Monitor(SMON) :: The System Monitor performs instance recovery at instance
startup. This is useful for recovery from system failure
d)Process Monitor(PMON) :: The Process Monitor performs process recovery when user
Process fails. Pmon Clears and Frees resources that process was using.
e) CheckPoint(CKPT) :: At Specified times, all modified database buffers in SGA are written
to data files by DBWR at Checkpoints and Updating all data files and control files of
database to indicate the most recent checkpoint
f)Archieves(ARCH) :: The Archiver copies online redo log files to archival storal when they
are busy.
g) Recoveror(RECO) :: The Recoveror is used to resolve the distributed transaction in
network
h) Dispatcher (Dnnn) :: The Dispatcher is useful in Multi Threaded Architecture
i) Lckn :: We can have upto 10 lock processes for inter instance locking in parallel sql.
How many Integrity Rules are there and what are they
There are Three Integrity Rules. They are as follows ::
a) Entity Integrity Rule :: The Entity Integrity Rule enforces that the Primary key cannot be
Null
b) Foreign Key Integrity Rule :: The FKIR denotes that the relationship between the foreign
key and the primary key has to be enforced.When there is data in Child Tables the Master
tables cannot be deleted.
c) Business Integrity Rules :: The Third Intigrity rule is about the complex business processes
which cannot be implemented by the above 2 rules.
Who created all these users in my database?/ Can I drop this user? (for DBA)
Oracle creates a number of default database users or schemas when a new database is created.
Below are a few of them:
SYS/CHANGE_ON_INSTALL or INTERNAL
Oracle Data Dictionary/ Catalog
Created by: ?/rdbms/admin/sql.bsq and various cat*.sql scripts
Can password be changed: Yes (Do so right after the database was created)
Can user be dropped: NO
SYSTEM/MANAGER
The default DBA user name (please do not use SYS)
Created by: ?/rdbms/admin/sql.bsq
Can password be changed: Yes (Do so right after the database was created)
Can user be dropped: NO
OUTLN/OUTLN
Stored outlines for optimizer plan stability
Created by: ?/rdbms/admin/sql.bsq
Can password be changed: Yes (Do so right after the database was created)
Can user be dropped: NO
SCOTT/TIGER, ADAMS/WOOD, JONES/STEEL, CLARK/CLOTH and BLAKE/PAPER.
Training/ demonstration users containing the popular EMP and DEPT tables
Created by: ?/rdbms/admin/utlsampl.sql
Can password be changed: Yes
Can user be dropped: YES - Drop users cascade from all production environments
HR/HR (Human Resources), OE/OE (Order Entry), SH/SH (Sales History).
Training/ demonstration users containing the popular EMPLOYEES and DEPARTMENTS
tables
Created by: ?/demo/schema/mksample.sql
Can password be changed: Yes
Can user be dropped: YES - Drop users cascade from all production environments
CTXSYS/CTXSYS
Oracle interMedia (ConText Cartridge) administrator user
Created by: ?/ctx/admin/dr0csys.sql
TRACESVR/TRACE
Oracle Trace server
Created by: ?/rdbms/admin/otrcsvr.sql
DBSNMP/DBSNMP
Oracle Intelligent agent
Created by: ?/rdbms/admin/catsnmp.sql, called from catalog.sql
Can password be changed: Yes - put the new password in snmp_rw.ora file
Can user be dropped: YES - Only if you do not use the Intelligent Agents
ORDPLUGINS/ORDPLUGINS
Object Relational Data (ORD) User used by Time Series, etc.
Created by: ?/ord/admin/ordinst.sql
ORDSYS/ORDSYS
Object Relational Data (ORD) User used by Time Series, etc
Created by: ?/ord/admin/ordinst.sql
DSSYS/DSSYS
Oracle Dynamic Services and Syndication Server
Created by: ?/ds/sql/dssys_init.sql
MDSYS/MDSYS
Oracle Spatial administrator user
Created by: ?/ord/admin/ordinst.sql
AURORA$ORB$UNAUTHENTICATED/INVALID
Used for users who do not authenticate in Aurora/ORB
Created by: ?/javavm/install/init_orb.sql called from ?/javavm/install/initjvm.sql
PERFSTAT/PERFSTAT
Oracle Statistics Package (STATSPACK) that supersedes UTLBSTAT/UTLESTAT
Created by: ?/rdbms/admin/statscre.sql
Remember to change the passwords for the SYS and SYSTEM users immediately after
installation!
Except for the user SYS, there should be no problem altering these users to use a different
default and temporary tablespace.
What is the difference between candidate key, unique key and primary key
Candidate keys are the columns in the table that could be the primary keys and the primary
key is the key that has been selected to identify the rows. Unique key is also useful for
identifying the distinct rows in the table.)
What is concurrency
Concurrency is allowing simultaneous access of same data by different users. Locks useful
for accesing the database are
a) Exclusive
The exclusive lock is useful for locking the row when an insert,update or delete is being
done.This lock should not be applied when we do only select from the row.
b) Share lock
We can do the table as Share_Lock as many share_locks can be put on the same resource.
Previleges and Grants
Previleges are the right to execute a particulare type of SQL statements. e.g :: Right to
Connect, Right to create, Right to resource Grants are given to the objects so that the object
might be accessed accordingly.The grant has to be given by the owner of the object
What is Normalisation
Normalisation is the process of organising the tables to remove the redundancy.There are
mainly 5 Normalisation rules.
a) 1 Normal Form :: A table is said to be in 1st Normal Form when the attributes are atomic
b) 2 Normal Form :: A table is said to be in 2nd Normal Form when all the candidate keys are
dependant on the primary key
c) 3rd Normal Form :: A table is said to be third Normal form when it is not dependant
transitively
What are the types of triggers and how the sequence of firing in text item
Triggers can be classified as Key Triggers, Mouse Triggers ,Navigational Triggers.
Key Triggers :: Key Triggers are fired as a result of Key action.e.g :: Key-next-field, Key-
up,Key-Down
Mouse Triggers :: Mouse Triggers are fired as a result of the mouse navigation.e.g. When-
mouse-button-presed,when-mouse-doubleclicked,etc
Navigational Triggers :: These Triggers are fired as a result of Navigation. E.g. : Post-Text-
item,Pre-text-item.
We also have event triggers like when ?new-form-instance and when-new-block-instance.
We cannot call restricted procedures like go_to(?my_block.first_item?) in the Navigational
triggers
But can use them in the Key-next-item.
The Difference between Key-next and Post-Text is an very important question. The key-next
is fired as a result of the key action while the post text is fired as a result of the mouse
movement. Key next will not fire unless there is a key event. The sequence of firing in a text
item are as follows ::
a) pre - text
b) when new item
c) key-next
d) when validate
e) post text
If you have property class attached to an item and you have same trigger written for the
item . Which will fire first?
Item level trigger fires , If item level trigger fires, property level trigger won't fire. Triggers at
the lowest level are always given the first preference. The item level trigger fires first and
then the block and then the Form level trigger.
What is FORMS_MDI_WINDOW?
forms run inside the MDI application window. This property is useful for calling a form from
another one.
What is precompiler?
It is similar to C precompiler directives.
Locking mode :
Specifies when Oracle Forms should attempt to obtain database locks on rows that
correspond to queried records in the form. a) immediate b) delayed
What are savepoint mode and cursor mode properties ? level?
Specifies whether Oracle Forms should issue savepoints during a session. This property is
included primarily for applications that will run against non-ORACLE data sources. For
applications that will run against ORACLE, use the default setting.
Cursor mode - define cursor state across transaction Open/close.
What are the different modes of mounting a Database with the Parallel Server ?
Exclusive Mode If the first instance that mounts a database does so in exclusive mode, only
that Instance can mount the database.
Parallel Mode If the first instance that mounts a database is started in parallel mode, other
instances that are started in parallel mode can also mount the database.
How many types of columns are there and what are they
Formula columns :: For doing mathematical calculations and returning one value Summary
Columns :: For doing summary calculations such as summations etc. Place holder Columns ::
These columns are useful for storing the value in a variable
What is Flex
Flex is the property of moving the related fields together by setting the flex property on
What are the minimum number of groups required for a matrix report
The minimum of groups required for a matrix report are 4 e -----
What is a Synonym ?
A synonym is an alias for a table, view, sequence or program unit.
What is a Sequence ?
A sequence generates a serial list of unique numbers for numerical columns of a database's
tables.
What is a Segment ?
A segment is a set of extents allocated for a certain logical structure.
What is schema?
A schema is collection of database objects of a User.
What is an extent?
An extent is a specific number of contiguous data blocks, obtained in a single allocation and
used to store a specific type of information.
What is a datafile?
Every Oracle database has one or more physical data files. A database's data files contain all
the database data. The data of logical database structures such as tables and indexes is
physically stored in the data files allocated for a database.
Is it possible to split the print reviewer into more than one region?
Yes
Is it possible to center an object horizontally in a repeating frame that has a variable
horizontal size?
Yes
For a field in a repeating frame, can the source come from the column which does not
exist in the data group which forms the base for the frame?
Yes
The join defined by the default data link is an outer join yes or no?
Yes
Is it possible to insert comments into sql statements return in the data model editor?
Yes
When a form is invoked with call_form, Does oracle forms issues a save point?
Yes
Explain the difference between a hot backup and a cold backup and the benefits
associated with each.
A hot backup is basically taking a backup of the database while it is still up and running and
it must be in archive log mode. A cold backup is taking a backup of the database while it is
shut down and does not require being in archive log mode. The benefit of taking a hot backup
is that the database is still available for use while the backup is occurring and you can recover
the database to any point in time. The benefit of taking a cold backup is that it is typically
easier to administer the backup and recovery process. In addition, since you are taking cold
backups the database does not require being in archive log mode and thus there will be a
slight performance gain as the database is not cutting archive logs to disk.
You have just had to restore from backup and do not have any control files. How would
you go about bringing up this database?
I would create a text based backup control file, stipulating where on disk all the data files
where and then issue the recover command with the using backup control file clause.
Where would you look for errors from the database engine?
In the alert log.
Give the two types of tables involved in producing a star schema and the type of data
they hold.
Fact tables and dimension tables. A fact table contains measurements while dimension tables
will contain data that will help describe the fact tables.
A table is classified as a parent table and you want to drop and re-create it. How would
you do this without affecting the children tables?
Disable the foreign key constraint to the parent, drop the table, re-create the table, enable the
foreign key constraint.
Give the stages of instance startup to a usable state where normal users may access it.
STARTUP NOMOUNT - Instance startup
STARTUP MOUNT - The database is mounted
STARTUP OPEN - The database is opened
What column differentiates the V$ views to the GV$ views and how?
The INST_ID column which indicates the instance in a RAC environment the information
came from.
How would you go about generating an EXPLAIN plan?
Create a plan table with utlxplan.sql.
Use the explain plan set statement_id = 'tst1' into plan_table for a SQL statement
Look at the explain plan with utlxplp.sql or utlxpls.sql
How would you go about increasing the buffer cache hit ratio?
Use the buffer cache advisory over a given workload and then query the v$db_cache_advice
table. If a change was necessary then I would use the alter system set db_cache_size
command.
Explain an ORA-01555
You get this error when you get a snapshot too old within rollback. It can usually be solved
by increasing the undo retention or increasing the size of rollbacks. You should also look at
the logic involved in the application getting the error message.
How would you determine the time zone under which a database was operating?
select DBTIMEZONE from dual;
Where in the Oracle directory tree structure are audit traces placed?
In unix $ORACLE_HOME/rdbms/audit, in Windows the event viewer
How would you determine what sessions are connected and what resources they are
waiting for?
Use of V$SESSION and V$SESSION_WAIT
Give two methods you could use to determine what DDL changes have been made.
You could use Logminer or Streams
When creating a user, what permissions must you grant to allow them to connect to the
database?
Grant the CONNECT to the user.
What view would you use to look at the size of a data file?
DBA_DATA_FILES
You have just compiled a PL/SQL package but got errors, how would you view the
errors?
SHOW ERRORS
What are the values that can be specified for OPTIMIZER MODE Parameter ?
COST and RULE.
What are the values that can be specified for OPTIMIZER_GOAL parameter of the
ALTER SESSION Command ?
CHOOSE,ALL_ROWS,FIRST_ROWS and RULE.
How does one give developers access to trace files (required as input to tkprof)? (for
DBA)
The "alter session set sql_trace=true" command generates trace files in USER_DUMP_DEST
that can be used by developers as input to tkprof. On Unix the default file mask for these files
are "rwx r-- ---".
There is an undocumented INIT.ORA parameter that will allow everyone to read (rwx r-r--)
these trace files:
_trace_files_public = true
Include this in your INIT.ORA file and bounce your database for it to take effect.
What are the responsibilities of a Database Administrator ?
Installing and upgrading the Oracle Server and application tools. Allocating system storage
and planning future storage requirements for the database system. Managing primary
database structures (tablespaces) Managing primary objects (table,views,indexes) Enrolling
users and maintaining system security. Ensuring compliance with Oralce license agreement
Controlling and monitoring user access to the database. Monitoring and optimizing the
performance of the database. Planning for backup and recovery of database information.
Maintain archived data on tape Backing up and restoring the database. Contacting Oracle
Corporation for technical support.
What are the roles and user accounts created automatically with the database?
DBA - role Contains all database system privileges.
SYS user account - The DBA role will be assigned to this account. All of the base tables and
views for the database's dictionary are store in this schema and are manipulated only by
ORACLE. SYSTEM user account - It has all the system privileges for the database and
additional tables and views that display administrative information and internal tables and
views used by oracle tools are created using this username.
What are the minimum parameters should exist in the parameter file (init.ora) ?
DB NAME - Must set to a text string of no more than 8 characters and it will be stored inside
the datafiles, redo log files and control files and control file while database creation.
DB_DOMAIN - It is string that specifies the network domain where the database is created.
The global database name is identified by setting these parameters
(DB_NAME & DB_DOMAIN) CONTORL FILES - List of control filenames of the
database. If name is not mentioned then default name will be used.
DB_BLOCK_BUFFERS - To determine the no of buffers in the buffer cache in SGA.
PROCESSES - To determine number of operating system processes that can be connected to
ORACLE concurrently. The value should be 5 (background process) and additional 1 for
each user.
ROLLBACK_SEGMENTS - List of rollback segments an ORACLE instance acquires at
database startup. Also optionally
LICENSE_MAX_SESSIONS,LICENSE_SESSION_WARNING and
LICENSE_MAX_USERS.
What strategies are available for backing-up an Oracle database? (for DBA)
The following methods are valid for backing-up an Oracle database:
Export/Import - Exports are "logical" database backups in that they extract logical definitions
and data from the database to a file.
Cold or Off-line Backups - Shut the database down and backup up ALL data, log, and control
files.
Hot or On-line Backups - If the databases are available and in ARCHIVELOG mode, set the
tablespaces into backup mode and backup their files. Also remember to backup the control
files and archived redo log files.
RMAN Backups - While the database is off-line or on-line, use the "rman" utility to backup
the database.
It is advisable to use more than one of these methods to backup your database. For example,
if you choose to do on-line database backups, also cover yourself by doing database exports.
Also test ALL backup and recovery scenarios carefully. It is better to be save than sorry.
Regardless of your strategy, also remember to backup all required software libraries,
parameter files, password files, etc. If your database is in ARCGIVELOG mode, you also
need to backup archived log files.
What is the difference between online and offline backups? (for DBA)
A hot backup is a backup performed while the database is online and available for read/write.
Except for Oracle exports, one can only do on-line backups when running in ARCHIVELOG
mode.
A cold backup is a backup performed while the database is off-line and unavailable to its
users.
How does one backup a database using the export utility? (for DBA)
Oracle exports are "logical" database backups (not physical) as they extract data and logical
definitions from the database into a file. Other backup strategies normally back-up the
physical data files.
One of the advantages of exports is that one can selectively re-import tables, however one
cannot roll-forward from an restored export file. To completely restore a database from an
export file one practically needs to recreate the entire database.
Always do full system level exports (FULL=YES). Full exports include more information
about the database in the export file than user level exports.
What are the built_ins used the display the LOV?
Show_lov
List_values
What is the main diff. bet. Reports 2.0 & Reports 2.5?
Report 2.5 is object oriented.
What is a library?
A library is a collection of subprograms including user named procedures, functions and
packages.
What is an anchoring object & what is its use? What are the various sub events a mouse
double click event involves?
An anchoring object is a print condition object which used to explicitly or implicitly anchor
other objects to itself.
Use the add_group_column function to add a column to record group that was created
at a design time?
False
What are the various sub events a mouse double click event involves? What are the
various sub events a mouse double click event involves?
Double clicking the mouse consists of the mouse down, mouse up, mouse click, mouse down
& mouse up events.
What is the use of break group? What are the various sub events a mouse double click
event involves?
A break group is used to display one record for one group ones. While multiple related
records in other group can be displayed.
What tools/utilities does Oracle provide to assist with performance tuning? (for DBA)
Oracle provide the following tools/ utilities to assist with performance monitoring and tuning:
. TKProf
. UTLBSTAT.SQL and UTLESTAT.SQL - Begin and end stats monitoring
. Statspack
. Oracle Enterprise Manager - Tuning Pack
What is STATSPACK and how does one use it? (for DBA)
Statspack is a set of performance monitoring and reporting utilities provided by Oracle from
Oracle8i and above. Statspack provides improved BSTAT/ESTAT functionality, though the
old BSTAT/ESTAT scripts are still available. For more information about STATSPACK,
read the documentation in file $ORACLE_HOME/rdbms/admin/spdoc.txt.
Install Statspack:
cd $ORACLE_HOME/rdbms/admin
sqlplus "/ as sysdba" @spdrop.sql -- Install Statspack -
sqlplus "/ as sysdba" @spcreate.sql-- Enter tablespace names when prompted
Use Statspack:
sqlplus perfstat/perfstat
exec statspack.snap; -- Take a performance snapshots
exec statspack.snap;
o Get a list of snapshots
select SNAP_ID, SNAP_TIME from STATS$SNAPSHOT;
@spreport.sql -- Enter two snapshot id's for difference report
Other Statspack Scripts:
. sppurge.sql - Purge a range of Snapshot Id's between the specified begin and end Snap Id's
. spauto.sql - Schedule a dbms_job to automate the collection of STATPACK statistics
. spcreate.sql - Installs the STATSPACK user, tables and package on a database (Run as
SYS).
. spdrop.sql - Deinstall STATSPACK from database (Run as SYS)
. sppurge.sql - Delete a range of Snapshot Id's from the database
. spreport.sql - Report on differences between values recorded in two snapshots
. sptrunc.sql - Truncates all data in Statspack tables
What are the common RMAN errors (with solutions)? (for DBA)
Some of the common RMAN errors are:
RMAN-20242: Specification does not match any archivelog in the recovery catalog.
Add to RMAN script: sql 'alter system archive log current';
RMAN-06089: archived log xyz not found or out of sync with catalog
Execute from RMAN: change archivelog all validate;
How can you execute the user defined triggers in forms 3.0 ?
Execute Trigger (trigger-name)
When the form is running in DEBUG mode, If you want to examine the values of global
variables and other form variables, What package procedure command you would use
in your trigger text ?
Break.
SYSTEM VARIABLES
What is the difference between DBFile Sequential and Scattered Reads?(for DBA)
Both "db file sequential read" and "db file scattered read" events signify time waited for I/O
read requests to complete. Time is reported in 100's of a second for Oracle 8i releases and
below, and 1000's of a second for Oracle 9i and above. Most people confuse these events
with each other as they think of how data is read from disk. Instead they should think of how
data is read into the SGA buffer cache.
db file sequential read:
A sequential read operation reads data into contiguous memory (usually a single-block read
with p3=1, but can be multiple blocks). Single block I/Os are usually the result of using
indexes. This event is also used for rebuilding the control file and reading data file headers
(P2=1). In general, this event is indicative of disk contention on index reads.
db file scattered read:
Similar to db file sequential reads, except that the session is reading multiple data blocks and
scatters them into different discontinuous buffers in the SGA. This statistic is NORMALLY
indicating disk contention on full table scans. Rarely, data from full table scans could be
fitted into a contiguous buffer area, these waits would then show up as sequential reads
instead of scattered reads.
The following query shows average wait time for sequential versus scattered reads:
prompt "AVERAGE WAIT TIME FOR READ REQUESTS"
select a.average_wait "SEQ READ", b.average_wait "SCAT READ"
from sys.v_$system_event a, sys.v_$system_event b
where a.event = 'db file sequential read'
and b.event = 'db file scattered read';
If the maximum record retrieved property of the query is set to 10 then a summary
value will be calculated?
Only for 10 records.
What are the different objects that you cannot copy or reference in object groups?
Objects of different modules
Another object groups
Individual block dependent items
Program units.
What is an OLE?
Object Linking & Embedding provides you with the capability to integrate objects from
many Ms-Windows applications into a single compound document creating integrated
applications enables you to use the features form .
What are the return values of functions SQLCODE and SQLERRM ? What is Pragma
EXECPTION_INIT ? Explain the usage ?
SQLCODE returns the latest code of the error that has occurred.
SQLERRM returns the relevant error message of the SQLCODE.
Backups in RMAN
Oracle backups in RMAN are of the following type
RMAN complete backup OR RMAN incremental backup
These backups are of RMAN proprietary nature
IMAGE COPY
The advantage of uing Image copy is its not in RMAN proprietary format..
Backup Format
RMAN backup is not in oracle format but in RMAN format. Oracle backup comprises of
backup sets and it consists of backup pieces. Backup sets are logical entity In oracle 9i it gets
stored in a default location There are two type of backup sets Datafile backup sets,
Archivelog backup sets One more important point of data file backup sets is it do not include
empty blocks. A backup set would contain many backup pieces.
A single backup piece consists of physical files which are in RMAN proprietary format.
Restoring database
Restoring database has been made very simple in 9i .
It is just
Restore database..
RMAN has become intelligent to identify which datafiles has to be restored
and the location of backuped up file.
With the new DURATION option for the RMAN BACKUP command, DBAs can weigh
backup performance against system service level requirements. By specifying a duration,
RMAN will automatically calculate the appropriate backup rate; in addition, DBAs can
optionally specify whether backups should minimize time or system load.
New Features in Oem to identify RMAN related backup like backup pieces, backup sets and
image copy
Observation
Introduced in Oracle 8 it has become more powerful and simpler with newer version of
Oracle 9 and 10 g.
So if you really don't want to miss something critical please start using RMAN.
Explain UNION,MINUS,UNION ALL, INTERSECT ?
INTERSECT returns all distinct rows selected by both queries.MINUS - returns all distinct
rows selected by the first query but not by the second.UNION - returns all distinct rows
selected by either queryUNION ALL - returns all rows selected by either query, including all
duplicates.
Should the OEM Console be displayed at all times (when there are scheduled jobs)? (for
DBA)
When a job is submitted the agent will confirm the status of the job. When the status shows
up as scheduled, you can close down the OEM console. The processing of the job is managed
by the OIA (Oracle Intelligent Agent). The OIA maintains a .jou file in the agent's
subdirectory. When the console is launched communication with the Agent is established and
the contents of the .jou file (binary) are reported to the console job subsystem. Note that
OEM will not be able to send e-mail and paging notifications when the Console is not started.
What kind of jobs can one schedule with OEM? (for DBA)
OEM comes with pre-defined jobs like Export, Import, run OS commands, run sql scripts,
SQL*Plus commands etc. It also gives you the flexibility of scheduling custom jobs written
with the TCL language.
How does one backout events and jobs during maintenance slots? (for DBA)
Managemnet and data collection activity can be suspended by imposing a blackout. Look at
these examples:
agentctl start blackout # Blackout the entrire agent
agentctl stop blackout # Resume normal monitoring and management
agentctl start blackout ORCL # Blackout database ORCL
agentctl stop blackout ORCL # Resume normal monitoring and management
agentctl start blackout -s jobs -d 00:20 # Blackout jobs for 20 minutes
ROLESystem Control :
ALTER SYSTEM.
What is the Oracle Intelligent Agent? (for DBA)
The Oracle Intelligent Agent (OIA) is an autonomous process that needs to run on a remote
node in the network to make the node OEM manageable. The Oracle Intelligent Agent is
responsible for:
. Discovering targets that can be managed (Database Servers, Net8 Listeners, etc.);
. Monitoring of events registered in Enterprise Manager; and
. Executing tasks associated with jobs submitted to Enterprise Manager.
How does one start the Oracle Intelligent Agent? (for DBA)
One needs to start an OIA (Oracle Intelligent Agent) process on all machines that will to be
managed via OEM.
For OEM 9i and above:
agentctl start agent
agentctl stop agent
Where can one get more information about TCL? (for DBA)
One can write custom event checking routines for OEM using the TCL (Tool Command
Language) language. Check the following sites for more information about TCL:
. The Tcl Developer Xchange - download and learn about TCL
. OraTCL at Sourceforge - Download the OraTCL package
. Tom Poindexter's Tcl Page - Oratcl was originally written by Tom Poindexter
What is import/export and why does one need it? (for DBA)
The Oracle export (EXP) and import (IMP) utilities are used to perform logical database
backup and recovery. They are also used to move Oracle data from one machine, database or
schema to another.
The imp/exp utilities use an Oracle proprietary binary file format and can thus only be used
between Oracle databases. One cannot export data and expect to import it into a non-Oracle
database. For more information on how to load and unload data from files, read the
SQL*Loader FAQ.
The export/import utilities are also commonly used to perform the following tasks:
. Backup and recovery (small databases only)
. Reorganization of data/ Eliminate database fragmentation
. Detect database corruption. Ensure that all the data can be read.
. Transporting tablespaces between databases
. Etc.
What are the two ways to incorporate images into a oracle forms application?
Boilerplate Images
Image_items
Can one load variable and fix length data records? (for DBA)
Yes, look at the following control file examples. In the first we will load delimited data
(variable length):
LOAD DATA
INFILE *
INTO TABLE load_delimited_data
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
( data1,
data2
)
BEGINDATA
11111,AAAAAAAAAA
22222,"A,B,C,D,"
If you need to load positional data (fixed length), look at the following control file example:
LOAD DATA
INFILE *
INTO TABLE load_positional_data
( data1 POSITION(1:5),
data2 POSITION(6:15)
)
BEGINDATA
11111AAAAAAAAAA
22222BBBBBBBBBB
Can one skip header records load while loading?
Use the "SKIP n" keyword, where n = number of logical rows to skip. Look at this example:
LOAD DATA
INFILE *
INTO TABLE load_positional_data
SKIP 5
( data1 POSITION(1:5),
data2 POSITION(6:15)
)
BEGINDATA
11111AAAAAAAAAA
22222BBBBBBBBBB
Can one modify data as it loads into the database? (for DBA)
Data can be modified as it loads into the Oracle Database. Note that this only applies for the
conventional load path and not for direct path loads.
LOAD DATA
INFILE *
INTO TABLE modified_data
( rec_no "my_db_sequence.nextval",
region CONSTANT '31',
time_loaded "to_char(SYSDATE, 'HH24:MI')",
data1 POSITION(1:5) ":data1/100",
data2 POSITION(6:15) "upper(:data2)",
data3 POSITION(16:22)"to_date(:data3, 'YYMMDD')"
)
BEGINDATA
11111AAAAAAAAAA991201
22222BBBBBBBBBB990112
LOAD DATA
INFILE 'mail_orders.txt'
BADFILE 'bad_orders.txt'
APPEND
INTO TABLE mailing_list
FIELDS TERMINATED BY ","
( addr,
city,
state,
zipcode,
mailing_addr "decode(:mailing_addr, null, :addr, :mailing_addr)",
mailing_city "decode(:mailing_city, null, :city, :mailing_city)",
mailing_state
)
Can one load data into multiple tables at once? (for DBA)
Look at the following control file:
LOAD DATA
INFILE *
REPLACE
INTO TABLE emp
WHEN empno != ' '
( empno POSITION(1:4) INTEGER EXTERNAL,
ename POSITION(6:15) CHAR,
deptno POSITION(17:18) CHAR,
mgr POSITION(20:23) INTEGER EXTERNAL
)
INTO TABLE proj
WHEN projno != ' '
( projno POSITION(25:27) INTEGER EXTERNAL,
empno POSITION(1:4) INTEGER EXTERNAL
)
What is the difference between boiler plat images and image items?
Boiler plate Images are static images (Either vector or bit map) that you import from the file
system or database to use a graphical elements in your form, such as company logos and
maps. Image items are special types of interface controls that store and display either vector
or bitmap images. Like other items that store values, image items can be either base table
items(items that relate directly to database columns) or control items. The definition of an
image item is stored as part of the form module FMB and FMX files, but no image file is
actually associated with an image item until the item is populate at run time.
Can one selectively load only the records that one need? (for DBA)
Look at this example, (01) is the first character, (30:37) are characters 30 to 37:
LOAD DATA
INFILE 'mydata.dat' BADFILE 'mydata.bad' DISCARDFILE 'mydata.dis'
APPEND
INTO TABLE my_selective_table
WHEN (01) <> 'H' and (01) <> 'T' and (30:37) = '19991217'
(
region CONSTANT '31',
service_key POSITION(01:11) INTEGER EXTERNAL,
call_b_no POSITION(12:29) CHAR
)
Can one skip certain columns while loading data? (for DBA)
One cannot use POSTION(x:y) with delimited data. Luckily, from Oracle 8i one can specify
FILLER columns. FILLER columns are used to skip columns/fields in the load file, ignoring
fields that one does not want. Look at this example: -- One cannot use POSTION(x:y) as it is
stream data, there are no positional fields-the next field begins after some delimiter, not in
column X. -->
LOAD DATA
TRUNCATE INTO TABLE T1
FIELDS TERMINATED BY ','
( field1,
field2 FILLER,
field3
)
How can get SQL*Loader to COMMIT only at the end of the load file? (for DBA)
One cannot, but by setting the ROWS= parameter to a large value, committing can be
reduced. Make sure you have big rollback segments ready when you use a high value for
ROWS=.
How does one use SQL*Loader to load images, sound clips and documents? (for DBA)
SQL*Loader can load data from a "primary data file", SDF (Secondary Data file - for loading
nested tables and VARRAYs) or LOGFILE. The LOBFILE method provides and easy way to
load documents, images and audio clips into BLOB and CLOB columns. Look at this
example:
Given the following table:
CREATE TABLE image_table (
image_id NUMBER(5),
file_name VARCHAR2(30),
image_data BLOB);
Control File:
LOAD DATA
INFILE *
INTO TABLE image_table
REPLACE
FIELDS TERMINATED BY ','
(
image_id INTEGER(5),
file_name CHAR(30),
image_data LOBFILE (file_name) TERMINATED BY EOF
)
BEGINDATA
001,image1.gif
002,image2.jpg
What is the difference between the conventional and direct path loader? (for DBA)
The conventional path loader essentially loads the data by using standard INSERT
statements. The direct path loader (DIRECT=TRUE) bypasses much of the logic involved
with that, and loads directly into the Oracle data files. More information about the restrictions
of direct path loading can be obtained from the Utilities Users Guide.
Can you have two functions with the same name in a PL/SQL block ?
Yes.
Can you have two stored functions with the same name ?
Yes.
Can 2 functions have same name & input parameters but differ only by return datatype
?
No.
What is the maximum no. of statements that can be specified in a trigger statement ?
One.
Can views be specified in a trigger statement ?
No
What are cascading triggers? What is the maximum no of cascading triggers at a time?
When a statement in a trigger body causes another trigger to be fired, the triggers are said to
be cascading. Max = 32.
An insert statement followed by a create table statement followed by rollback ? Will the
rows be inserted ?
No.
Which symbol preceeds the path to the table in the remote database ?
@
If all the values from a cursor have been fetched and another fetch is issued, the output
will be : error, last record or first record ?
Last Record
A table has the following data : [[5, Null, 10]]. What will the average function return ?
7.5
Consider a sequence whose currval is 1 and gets incremented by 1 by using the nextval
reference we get the next number 2. Suppose at this point we issue an rollback and
again issue a nextval. What will the output be ?
3
Can database trigger written on synonym of a table and if it can be then what would be
the effect if original table is accessed.
Yes, database trigger would fire.
What is the effect of synonym and table name used in same Select statement ?
Valid
If any other table same as dual is created would it act similar to dual?
Yes
Assume that there are multiple databases running on one machine. How can you switch
from one to another ?
Changing the ORACLE_SID
What all important parameters of the init.ora are supposed to be increased if you want
to increase the SGA size ?
In our case, db_block_buffers was changed from 60 to 1000 (std values are 60, 550 & 3500)
shared_pool_size was changed from 3.5MB to 9MB (std values are 3.5, 5 & 9MB)
open_cursors was changed from 200 to 300 (std values are 200 & 300) db_block_size was
changed from 2048 (2K) to 4096 (4K) {at the time of database creation}.
The initial SGA was around 4MB when the server RAM was 32MB and The new SGA was
around 13MB when the server RAM was increased to 128MB.
If I have an execute privilege on a procedure in another users schema, can I execute his
procedure even though I do not have privileges on the tables within the procedure ?
Yes
If you insert a row in a table, then create another table and then say Rollback. In this
case will the row be inserted ?
Yes. Because Create table is a DDL which commits automatically as soon as it is executed.
The DDL commits the transaction even if the create statement fails internally (eg table
already exists error) and not syntactically.
What is a transaction ?
A transaction is a set of SQL statements between any two COMMIT and ROLLBACK
statements.
Which of the following is not a schema object : Indexes, tables, public synonyms,
triggers and packages ?
Public synonyms
What is PL/SQL?
PL/SQL is Oracle's Procedural Language extension to SQL. The language includes object
oriented programming techniques such as encapsulation, function overloading, information
hiding (all but inheritance), and so, brings state-of-the-art programming to the Oracle
database server and a variety of Oracle tools.
Can one use dynamic SQL within PL/SQL? OR Can you use a DDL in a procedure ?
How ?
From PL/SQL V2.1 one can use the DBMS_SQL package to execute dynamic SQL
statements.
Eg: CREATE OR REPLACE PROCEDURE DYNSQL
AS
cur integer;
rc integer;
BEGIN
cur := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(cur,'CREATE TABLE X (Y DATE)', DBMS_SQL.NATIVE);
rc := DBMS_SQL.EXECUTE(cur);
DBMS_SQL.CLOSE_CURSOR(cur);
END;