ORACLE Interview Questions and Answers
ORACLE Interview Questions and Answers
Oracle database is comprised of three types of files. One or more datafiles, two are more redo log files, and
one or more control files.
3. What is a tablespace?
A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related
logical structures together.
6. What is schema?
A schema is collection of database objects of a user.
19. 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.
23. Explain the relationship among Database, Tablespace and Data file.?
Each databases logically divided into one or more tablespaces one or more data files are explicitly created
for each tablespace
49. What is the effect of setting the value "ALL_ROWS" for OPTIMIZER_GOAL parameter of the
ALTER SESSION command ? What are the factors that affect OPTIMIZER in choosing an
Optimization approach ?
Answer The OPTIMIZER_MODE initialization parameter Statistics in the Data Dictionary the
OPTIMIZER_GOAL parameter of the ALTER SESSION command hints in the statement.
50. What is the effect of setting the value "CHOOSE" for OPTIMIZER_GOAL, parameter of the ALTER
SESSION Command ?
The Optimizer chooses Cost_based approach and optimizes with the goal of best throughput if statistics for
atleast one of the tables accessed by the SQL statement exist in the data dictionary. Otherwise the
OPTIMIZER chooses RULE_based approach.
53. What are the different approaches used by Optimizer in choosing an execution plan ?
Rule-based and Cost-based.
56. 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.
67. What are the basic element of Base configuration of an oracle Database ?
It consists of
one or more data files.
one or more control files.
two or more redo log files.
The Database contains
multiple users/schemas
one or more rollback segments
one or more tablespaces
Data dictionary tables
User objects (table,indexes,views etc.,)
The server that access the database consists of
SGA (Database buffer, Dictionary Cache Buffers, Redo log buffers, Shared SQL pool)
SMON (System MONito)
PMON (Process MONitor)
LGWR (LoG Write)
DBWR (Data Base Write)
ARCH (ARCHiver)
CKPT (Check Point)
RECO
Dispatcher
User Process with associated PGS
73. 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.
85. 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%';
86. Where are my TEMPFILES, I don't see them in V$DATAFILE or DBA_DATA_FILE? (for DBA
Tempfiles, unlike normal datafiles, are not listed in v$datafile or dba_data_files. Instead query v$tempfile or
dba_temp_files:
SELECT * FROM v$tempfile;
SELECT * FROM dba_temp_files;
90. 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
/
91. How does one get the view definition of fixed views/tables?
Query v$fixed_view_definition. Example: SELECT * FROM v$fixed_view_definition WHERE
view_name='V$SESSION';
92. What are the dictionary tables used to monitor a database spaces ?
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.
93. 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.
112. What are the Built-ins used for sending Parameters to forms?
You can pass parameter values to a form when an application executes the call_form, New_form,
Open_form or Run_product.
113. 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.
114. Is the After report trigger fired if the report execution fails?
Yes.
115. Does a Before form trigger fire when the parameter form is suppressed?
Yes.
120. 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.
121. What are clusters?
Clusters are groups of one or more tables physically stores together to share common columns and are
often used together.
126. What are the dictionary tables used to monitor a database space?
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.
129. What are the sql clauses supported in the link property sheet?
Where start with having.
136. 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.
137. 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.
138. What is the diff. when confine mode is on and when it is off?
When confine mode is on, an object cannot be moved outside its parent in the layout.
139. What are visual attributes?
Visual attributes are the font, color, pattern proprieties that you set for form and menu objects that appear in
your application interface.
141. What are the two types of views available in the object navigator(specific to report 2.5)?
View by structure and view by type .
144. How do you create a new session while open a new form?
Using open_form built-in setting the session option Ex. Open_form('Stocks ',active,session). when invoke
the mulitiple forms with open form and call_form in the same application, state whether the following are
true/False
145. What are the ways to monitor the performance of the report?
Use reports profile executable statement. Use SQL trace facility.
146. 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.
147. 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
149. 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.
160. 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
169. 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)
172. What are the different file extensions that are created by oracle reports?
Rep file and Rdf file.
173. 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.
174. What is the basic data structure that is required for creating an LOV?
Record Group.
175. 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> }
176. 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.
178. Which parameter can be used to set read level consistency across multiple queries?
Read only
180. From which designation is it preferred to send the output to the printed?
Previewer
181. 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.
184. With which function of summary item is the compute at options required?
percentage of total functions.
189.What are the two repeating frame always associated with matrix object?
One down repeating frame below one across repeating frame.
194. Does a grouping done for objects in the layout editor affect the grouping done in the data model
editor?
No.
195. How does one add users to a password file? (for DBA
One can select from the SYS.V_$PWFILE_USERS view to see which users are listed in the password file.
New users can be added to the password file by granting them SYSDBA or SYSOPER privileges, or by
using the orapwd utility. GRANT SYSDBA TO scott;
196. If a break order is set on a column would it affect columns which are under the column?
No
197. 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.
200. Is it possible to link two groups inside a cross products after the cross products group has
been created?
no
203. 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
204. 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
205. 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
206. What is the diff. bet. setting up of parameters in reports 2.0 reports2.5?
LOVs can be attached to parameters in the reports 2.5 parameter form.
207. What are the difference between lov & list item?
Lov is a property where as list item is an item. A list item can have only one column, lov can have one or
more columns.
215. 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.
220. What are the built-ins that are used for setting the LOV properties at runtime?
get_lov_property
set_lov_property
223. What are the built-in used for getting cell values?
Get_group_char_cell(function)
Get_groupcell(function)
Get_group_number_cell(function)
224. What are the built-ins used for Getting cell values?
GET_GROUP_CHAR_CELL (function)
GET_GROUPCELL(function)
GET_GROUP_NUMBET_CELL(function)
225. Atleast how many set of data must a data model have before a data model can be base on it?
Four
226. To execute row from being displayed that still use column in the row which property can be
used?
Format trigger.
232. What are the built-ins used for finding object ID functions?
Find_group(function)
Find_column(function)
233. What are the built-ins used for finding Object ID function?
FIND_GROUP(function)
FIND_COLUMN(function)
234. Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?
False
235. Use the Add_group_row procedure to add a row to a static record group 1. true or false?
False
236. 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
238. 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.
239. 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.
240. 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.
243. 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.
245. 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.
246. What are the built-ins used for Creating and deleting groups?
CREATE-GROUP (function)
CREATE_GROUP_FROM_QUERY(function)
DELETE_GROUP(procedure)
248. What are the different types of Delete details we can establish in Master-Details?
Cascade
Isolate
Non-isolate
251. 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.
252. How can values be passed bet. precompiler exits & Oracle call interface?
By using the statement EXECIAFGET & EXECIAFPUT.
253. How can a square be drawn in the layout editor of the report writer?
By using the rectangle tool while pressing the (Constraint) key.
254. 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.
256. 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.
257. How can a button be used in a report to give a drill down facility?
By setting the action associated with button to Execute pl/sql option and using the SRW.Run_report
function.
258. Can one import/export between different versions of Oracle? (for DBA
Different versions of the import utility is upwards compatible. This means that one can take an export file
created from an old export version, and import it using a later version of the import utility. This is quite an
effective way of upgrading a database from one release of Oracle to the next.
Oracle also ships some previous catexpX.sql scripts that can be executed as user SYS enabling older
imp/exp versions to work (for backwards compatibility). For example, one can run
$ORACLE_HOME/rdbms/admin/catexp7.sql on an Oracle 8 database to allow the Oracle 7.3 exp/imp
utilities to run against an Oracle 8 database.
260. Can one export to multiple files?/ Can one beat the Unix 2 Gig limit? (for DBA
From Oracle8i, the export utility supports multiple output files. This feature enables large exports to be
divided into files whose sizes will not exceed any operating system limits (FILESIZE= parameter). When
importing from multi-file export you must provide the same filenames in the same sequence in the FILE=
parameter. Look at this example:
exp SCOTT/TIGER FILE=D:\F1.dmp,E:\F2.dmp FILESIZE=10m LOG=scott.log
Use the following technique if you use an Oracle version prior to 8i:
Create a compressed export on the fly. Depending on the type of data, you probably can export up to 10
gigabytes to a single file. This example uses gzip. It offers the best compression I know of, but you can also
substitute it with zip, compress or whatever.
# create a named pipe
mknod exp.pipe p
# read the pipe - output to zip file in the background
gzip < exp.pipe > scott.exp.gz &
# feed the pipe
exp userid=scott/tiger file=exp.pipe ...
262. How can one improve Import/ Export performance? (for DBA
EXPORT:
. 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
264. What are the common Import/ Export problems? (for DBA
ORA-00001: Unique constraint (...) violated - You are importing duplicate rows. Use IGNORE=NO to skip
tables that already exist (imp will give an error if the object is re-created).
ORA-01555: Snapshot too old - Ask your users to STOP working while you are exporting or use parameter
CONSISTENT=NO
ORA-01562: Failed to extend rollback segment - Create bigger rollback segments or set parameter
COMMIT=Y while importing
IMP-00015: Statement failed ... object already exists... - Use the IGNORE=Y import parameter to ignore
these errors, but be careful as you might end up with duplicate rows.
265. Why is it preferable to create a fewer no. of queries in the data model?
Because for each query, report has to open a separate cursor and has to rebind, execute and fetch data.
266. Where is the external query executed at the client or the server?
At the server.
267. Where is a procedure return in an external pl/sql library executed at the client or at the server?
At the client.
269. What is the difference between OLE Server & Ole Container?
An Ole server application creates ole Objects that are embedded or linked in ole Containers ex. Ole servers
are ms_word & ms_excel. OLE containers provide a place to store, display and manipulate objects that are
created by ole server applications. Ex. oracle forms is an example of an ole Container.
272. At what point of report execution is the before Report trigger fired?
After the query is executed but before the report is executed and the records are displayed.
273. What are the built -ins used for Modifying a groups structure?
ADD-GROUP_COLUMN (function)
ADD_GROUP_ROW (procedure)
DELETE_GROUP_ROW(procedure)
276. My database was terminated while in BACKUP MODE, do I need to recover? (for DBA
If a database was terminated while one of its tablespaces was in BACKUP MODE (ALTER TABLESPACE
xyz BEGIN BACKUP;), it will tell you that media recovery is required when you try to restart the database.
The DBA is then required to recover the database and apply all archived logs to the database. However,
from Oracle7.2, you can simply take the individual datafiles out of backup mode and restart the database.
ALTER DATABASE DATAFILE '/path/filename' END BACKUP;
One can select from V$BACKUP to see which datafiles are in backup mode. This normally saves a
significant amount of database down time.
Thiru Vadivelu contributed the following:
From Oracle9i onwards, the following command can be used to take all of the datafiles out of hot backup
mode:
ALTER DATABASE END BACKUP;
The above commands need to be issued when the database is mounted.
280. 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
283. 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)
284. 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.
285. How does one create a RMAN recovery catalog? (for DBA
Start by creating a database schema (usually called rman). Assign an appropriate tablespace to it and grant
it the recovery_catalog_owner role. Look at this example:
sqlplus sys
SQL>create user rman identified by rman;
SQL> alter user rman default tablespace tools temporary tablespace temp;
SQL> alter user rman quota unlimited on tools;
SQL> grant connect, resource, recovery_catalog_owner to rman;
SQL> exit;
Next, log in to rman and create the catalog schema. Prior to Oracle 8i this was done by running the
catrman.sql script. rman catalog rman/rman
RMAN>create catalog tablespace tools;
RMAN> exit;
You can now continue by registering your databases in the catalog. Look at this example:
rman catalog rman/rman target backdba/backdba
RMAN> register database;
286. 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.
289. What are three panes that appear in the run time pl/sql interpreter?
1. Source pane.
2. interpreter pane.
3. Navigator pane.
290. What are the two panes that Appear in the design time pl/sql interpreter?
1. Source pane.
2. Interpreter pane
291. 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.
293. What are the default extensions of the files created by menu module?
.mmb,
.mmx
294. What are the default extensions of the files created by forms modules?
.fmb - form module binary
.fmx - form module executable
295. 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.
296. 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.
303. List the Optional Flexible Architecture (OFA) of Oracle database? or How can we organize the
tablespaces in Oracle database to have maximum performance ?
SYSTEM - Data dictionary tables.
DATA - Standard operational tables.
DATA2- Static tables used for standard operations
INDEXES - Indexes for Standard operational tables.
INDEXES1 - Indexes of static tables used for standard operations.
TOOLS - Tools table.
TOOLS1 - Indexes for tools table.
RBS - Standard Operations Rollback Segments,
RBS1,RBS2 - Additional/Special Rollback segments.
TEMP - Temporary purpose tablespace
TEMP_USER - Temporary tablespace for users.
USERS - User tablespace.
304. How to implement the multiple control files for an existing database ?
Shutdown the database Copy one of the existing control file to new location Edit Config ora file by adding
new control file. name Restart the database.
306. How will you force database to use particular rollback segment ?
SET TRANSACTION USE ROLLBACK SEGMENT rbs_name.
310. What is meant by Redo Log file mirroring ? How it can be achieved?
Process of having a copy of redo log files is called mirroring. This can be achieved by creating group of log
files together, so that LGWR will automatically writes them to all the members of the current on-line redo log
group. If any one group fails then database automatically switch over to next group. It degrades
performance.
311. Which parameter in Storage clause will reduce no. of rows per block?
PCTFREE parameter
Row size also reduces no of rows per block.
314. 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
316. 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!
317. 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.
320. How can one dump internal database structures? (for DBA
The following (mostly undocumented) commands can be used to obtain information about internal database
structures.
o Dump control file contents
alter session set events 'immediate trace name CONTROLF level 10'
/
o Dump file headers
alter session set events 'immediate trace name FILE_HDRS level 10'
/
o Dump redo log headers
alter session set events 'immediate trace name REDOHDR level 10'
/
o Dump the system state
NOTE: Take 3 successive SYSTEMSTATE dumps, with 10-minute intervals alter session set events
'immediate trace name SYSTEMSTATE level 10'
/
o Dump the process state
alter session set events 'immediate trace name PROCESSSTATE level 10'
/
o Dump Library Cache details
alter session set events 'immediate trace name library cache level 10'
/
o Dump optimizer statistics whenever a SQL statement is parsed (hint: change statement or flush pool) alter
session set events '10053 trace name context forever, level 1'
/
o Dump a database block (File/ Block must be converted to DBA address) Convert file and block number to
a DBA (database block address).
Eg: variable x varchar2;
exec :x := dbms_utility.make_data_block_address(1,12);
print x
alter session set events 'immediate trace name blockdump level 50360894'
/
322. 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
326. 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.
328. 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.
335. How will you estimate the space required by a non-clustered tables?
Calculate the total header size
Calculate the available dataspace per data block
Calculate the combined column lengths of the average row
Calculate the total average row size.
Calculate the average number rows that can fit in a block
Calculate the number of blocks and bytes required for the table.
After arriving the calculation, add 10 % additional space to calculate the initial extent size for a working table.
350. What is the difference between ON-VALIDATE-FIELD trigger and a POST-CHANGE trigger ?
When you changes the Existing value to null, the On-validate field trigger will fire post change trigger will not
fire. At the time of execute-query post-change trigger will fire, on-validate field trigger will not fire.
354. While specifying master/detail relationship between two blocks specifying the join condition is
a must ? True or False. ?
True
360. What is the difference between restricted and unrestricted package procedure ?
Restricted package procedure that affects the basic functions of SQL * Forms. It cannot used in all triggers
except key triggers. Unrestricted package procedure that does not interfere with the basic functions of SQL *
Forms it can be used in any triggers.
361. 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.
362. 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
369. Is a Key startup trigger fires as result of a operator pressing a key explicitly ?
No
371. Can we create two blocks with the same name in form 3.0 ?
No
374. Name the two files that are created when you generate the form give the filex extension ?
INP (Source File)
FRM (Executable File)
375. What package procedure used for invoke sql *plus from sql *forms ?
Host (E.g. Host (sqlplus))
378. 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.
384. 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.
385. 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.
386. Why is Oracle not using the damn index? (for DBA
This problem normally only arises when the query plan is being generated by the Cost Based Optimizer. The
usual cause is because the CBO calculates that executing a Full Table Scan would be faster than accessing
the table via the index.
Fundamental things that can be checked are:
. USER_TAB_COLUMNS.NUM_DISTINCT - This column defines the number of distinct values the column
holds.
. USER_TABLES.NUM_ROWS - If NUM_DISTINCT = NUM_ROWS then using an index would be
preferable to doing a FULL TABLE SCAN. As the NUM_DISTINCT decreases, the cost of using an index
increase thereby is making the index less desirable.
. USER_INDEXES.CLUSTERING_FACTOR - This defines how ordered the rows are in the index. If
CLUSTERING_FACTOR approaches the number of blocks in the table, the rows are ordered. If it
approaches the number of rows in the table, the rows are randomly ordered. In such a case, it is unlikely
that index entries in the same leaf block will point to rows in the same data blocks.
. Decrease the INIT.ORA parameter DB_FILE_MULTIBLOCK_READ_COUNT - A higher value will make
the cost of a FULL TABLE SCAN cheaper.
. Remember that you MUST supply the leading column of an index, for the index to be used (unless you use
a FAST FULL SCAN or SKIP SCANNING).
. There are many other factors that affect the cost, but sometimes the above can help to show why an index
is not being used by the CBO. If from checking the above you still feel that the query should be using an
index, try specifying an index hint. Obtain an explain plan of the query either using TKPROF with
TIMED_STATISTICS, so that one can see the CPU utilization, or with AUTOTRACE to see the statistics.
Compare this to the explain plan when not using an index.
388. What are the unrestricted procedures used to change the popup screen position during run
time ?
Anchor-view
Resize -View
Move-View.
389. What is an Alert ?
An alert is window that appears in the middle of the screen overlaying a portion of the current display.
390. Deleting a page removes information about all the fields in that page ? a. True. b. False?
a. True.
391. 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.
392. Classify the restricted and unrestricted procedure from the following.
a. Call
b. User-Exit
c. Call-Query
d. Up
e. Execute-Query
f. Message
g. Exit-From
h. Post
i. Break?
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.
403. Can you attach an lov to a field at run-time? if yes, give the build-in name.?
Yes. Set_item_proprety
407. What are the triggers associated with the image item?
When-Image-activated(Fires when the operator double clicks on an image Items)
When-image-pressed(fires when the operator selects or deselects the image item)
409. 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
410. 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.
413. 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
415. What built-in is used for showing the alert during run-time?
Show_alert.
416. What built-in is used for changing the properties of the window dynamically?
Set_window_property
Canvas-View
420. What are the menu items that oracle forms 4.0 supports?
Plain, Check,Radio, Separator, Magic
421. Give the equivalent term in forms 4.0 for the following. Page, Page 0?
Page - Canvas-View
Page 0 - Canvas-view null.
430. What is the built-in routine used to count the no of rows in a group?
Get_group _row_count
System Variables
432. 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.
433. List the built-in routine for controlling window during run-time?
Find_window,
get_window_property,
hide_window,
move_window,
resize_window,
set_window_property,
show_View
434. List the built-in routine for controlling window 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
435. What is the built-in function used for finding the alert?
Find_alert
Editors
441. 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
Oracle Assets: Ensures that an organization's property and equipment investment is accurate and
that the correct asset tax accounting strategies are chosen.
Oracle General Ledger: Offers a complete solution to journal entry, budgeting, allocations,
consolidation, and financial reporting needs.
Oracle Inventory: Helps an organization make better inventory decisions by minimizing stock and
maximizing cash flow.
Oracle Order Entry: Provides organizations with a sophisticated order entry system for managing
customer commitments.
Oracle Payables: Lets an organization process more invoices with fewer staff members and tighter
controls. Helps save money through maximum discounts, bank float, and prevention of duplicate
payment.
Oracle Personnel: Improves the management of employee- related issues by retaining and making
available every form of personnel data.
Oracle Purchasing: Improves buying power, helps negotiate bigger discounts, eliminates paper
flow, increases financial controls, and increases productivity.
Oracle Receivables:. Improves cash flow by letting an organization process more payments faster,
without off-line research. Helps correctly account for cash, reduce outstanding receivables, and
improve collection effectiveness.
Oracle Revenue Accounting Gives an organization timely and accurate revenue and flexible
commissions reporting.
Oracle Sales Analysis: Allows for better forecasting, planning. and reporting of sales information.
446. What is the most important module in Oracle Financials? (for DBA
The General Ledger (GL) module is the basis for all other Oracle Financial modules. All other modules
provide information to it. If you implement Oracle Financials, you should switch your current GL system
first.GL is relatively easy to implement. You should go live with it first to give your implementation team a
chance to be familiar with Oracle Financials.
447. What are the types of canvas-views?
Content View, Stacked View.
448. What is the MultiOrg and what is it used for? (for DBA
MultiOrg or Multiple Organizations Architecture allows multiple operating units and their relationships to be
defined within a single installation of Oracle Applications. This keeps each operating unit's transaction data
separate and secure.
Use the following query to determine if MuliOrg is intalled:
select multi_org_flag from fnd_product_groups;
449. What is the difference between Fields and FlexFields? (for DBA
A field is a position on a form that one uses to enter, view, update, or delete information. A field prompt
describes each field by telling what kind of information appears in the field, or alternatively, what kind of
information should be entered in the field.
A flexfield is an Oracle Applications field made up of segments. Each segment has an assigned name and a
set of valid values. Oracle Applications uses flexfields to capture information about your organization. There
are two types of flexfields: key flexfields and descriptive flexfields.
450. Explain types of Block in forms4.0?
Base table Blocks.
Control Blocks.
1. A base table block is one that is associated with a specific database table or view.
2. A control block is a block that is not associated with a database table. ITEMS
451. What is an Alert?
An alert is a modal window that displays a message notifies the operator of some application condition
455. 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
456 .What is a record Group?
A record group is an internal oracle forms data structure that has a similar column/row frame work to a
database table
457 What is a Navigable item?
A navigable item is one that operators can navigate to with the keyboard during default navigation, or that
Oracle forms can navigate to by executing a navigational built-in procedure.
458. What is a library in Forms 4.0?
A library is a collection of Pl/SQL program units, including user named procedures, functions & packages
460. How image_items can be populate to field in forms 4.0?
A fetch from a long raw database column PL/Sql assignment to executing the read_image_file built_in
procedure to get an image from the file system.
461. What is the content view and stacked view?
A content view is the "Base" view that occupies the entire content pane of the window in which it is
displayed. A stacked view differs from a content canvas view in that it is not the base view for the window to
which it is assigned
462. What is a Check Box?
A Check Box is a two state control that indicates whether a certain condition or value is on or off, true or
false. The display state of a check box is always either "checked" or "unchecked".
463. 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.
464. Explain the following file extension related to library?
.pll,.lib,.pld
The library pll files is a portable design file comparable to an fmb form file
The library lib file is a plat form specific, generated library file comparable to a fmx form file
The pld file is Txt format file and can be used for source controlling your library files Parameter
465. Explain the usage of WHERE CURRENT OF clause in cursors ?
WHERE CURRENT OF clause in an UPDATE,DELETE statement refers to the latest row fetched from a
cursor. Database Triggers
466. Name the tables where characteristics of Package, procedure and functions are stored ?
User_objects, User_Source and User_error.
467. Explain the two type of Cursors ?
There are two types of cursors, Implicit Cursor and Explicit Cursor. PL/SQL uses Implicit Cursors for
queries. User defined cursors are called Explicit Cursors. They can be declared and used.
468. What are two parts of package ?
The two parts of package are PACKAGE SPECIFICATION & PACKAGE BODY. Package Specification
contains declarations that are global to the packages and local to the schema. Package Body contains
actual procedures and local declaration of the procedures and cursor declarations.
469. 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.
470. What is Fine Grained Auditing? (for DBA
Fine Grained Auditing (DBMS_FGA) allows auditing records to be generated when certain rows are selected
from a table. A list of defined policies can be obtained from DBA_AUDIT_POLICIES. Audit records are
stored in DBA_FGA_AUDIT_TRAIL. Look at this example:
o Add policy on table with autiting condition...
execute dbms_fga.add_policy('HR', 'EMP', 'policy1', 'deptno > 10');
o Must ANALYZE, this feature works with CBO (Cost Based Optimizer)
analyze table EMP compute statistics;
select * from EMP where c1 = 11; -- Will trigger auditing
select * from EMP where c1 = 09; -- No auditing
o Now we can see the statments that triggered the auditing condition...
select sqltext from sys.fga_log$;
delete from sys.fga_log$;
471. What is a package ? What are the advantages of packages ? What is Pragma EXECPTION_INIT ?
Explain the usage ?
The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an
error message of a specific oracle error. e.g. PRAGMA EXCEPTION_INIT (exception name, oracle error
number)
481. Is it possible to use Transaction control Statements such a ROLLBACK or COMMIT in Database
Trigger ? Why ?
It is not possible. As triggers are defined for each table, if you use COMMIT of ROLLBACK in a trigger, it
affects logical transaction processing.
482. 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.
483. What are the modes of parameters that can be passed to a procedure ?
IN,OUT,IN-OUT parameters.
484. Where the Pre_defined_exceptions are stored ?
In the standard package.
Procedures, Functions & Packages ;
487. Explain how procedures and functions are called in a PL/SQL block ?
Function is called as part of an expression.
sal := calculate_sal ('a822');
procedure is called as a PL/SQL statement
calculate_bonus ('A822');
496. 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??
a. PACKAGE NAME.PROCEDURE NAME (parameters);
variable := PACKAGE NAME.FUNCTION NAME (arguments);
EXEC SQL EXECUTE
b.BEGIN
PACKAGE NAME.PROCEDURE NAME (parameters)
variable := PACKAGE NAME.FUNCTION NAME (arguments);
END;
END EXEC;
c. EXECUTE PACKAGE NAME.PROCEDURE if the procedures does not have any out/in-out parameters. A
function can not be called.
502. 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.
504. 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.
513. 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.
524. What are various privileges that a user can grant to another user?
-SELECT
-CONNECT
-RESOURCES
540. 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
541. What are different modes of parameters used in functions and procedures?
-IN -OUT -INOUT
543. 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.
547. How will you delete duplicating rows from a base table?
delete from table_name where rowid not in (select max(rowid) from table group by
duplicate_values_field_name); or delete duplicate_values_field_name dv from table_name ta where rowid
<(select min(rowid) from table_name tb where ta.dv=tb.dv);
555. What is the maximum buffer size that can be specified using the DBMS_OUTPUT.ENABLE
function?
1,000,00
557. There is a % sign in one field of a column. What will be the query to find it?
'' Should be used before '%'.
567. 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.
569. Explain Connect by Prior ?in a session before accessing next value ?
Retrieves rows in hierarchical order.e.g. select empno, ename from emp where.
570. 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.
573. 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.
574. 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.
577. 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.
578. 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.
580. 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.
584. 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.
587. 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
588. Use the ADD_GROUP_ROW procedure to add a row to a static record group? I) TRUE II)FALSE
I) FALSE
591. 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)
592. How you will avoid your query from using indexes?
SELECT * FROM emp
Where emp_no+' '=12345;
i.e you have to concatenate the column name with space within codes in the where condition.
SELECT /*+ FULL(a) */ ename, emp_no from emp
where emp_no=1234;
i.e using HINTS
600. 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.
601. What are the Various Master and Detail Relation ships.
The various Master and Detail Relationship are
a) NonIsolated :: The Master cannot be deleted when a child is exisiting
b) Isolated :: The Master can be deleted when the child is exisiting
c) Cascading :: The child gets deleted when the Master is deleted.
607. 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.
608. How does one enforce strict password control? (for DBA
By default Oracle's security is not extremely good. For example, Oracle will allow users to choose single
character passwords and passwords that match their names and userids. Also, passwords don't ever expire.
This means that one can hack an account for years without ever locking the user.
From Oracle8 one can manage passwords through profiles. Some of the things that one can restrict:
. FAILED_LOGIN_ATTEMPTS - failed login attempts before the account is locked
. PASSWORD_LIFE_TIME - limits the number of days the same password can be used for authentication
. PASSWORD_REUSE_TIME - number of days before a password can be reused
. PASSWORD_REUSE_MAX - number of password changes required before the current password can be
reused
. PASSWORD_LOCK_TIME - number of days an account will be locked after maximum failed login attempts
. PASSWORD_GRACE_TIME - number of days after the grace period begins during which a warning is
issued and login is allowed
. PASSWORD_VERIFY_FUNCTION - password complexity verification script
Look at this simple example:
CREATE PROFILE my_profile LIMIT
PASSWORD_LIFE_TIME 30;
ALTER USER scott PROFILE my_profile;
609. How does one switch to another user in Oracle? (for DBA
Users normally use the "connect" statement to connect from one database user to another. However, DBAs
can switch from one user to another without a password. Of course it is not advisable to bridge Oracle's
security, but look at this example: SQL> select password from dba_users where username='SCOTT';
PASSWORD
F894844C34402B67
SQL> alter user scott identified by lion;
User altered.
612. 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.)
624. What is the Difference between a post query and a pre query
A post query will fire for every row that is fetched but the pre query will fire only once.
642. 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
644. What are property classes ? Can property classes have trigger?
Property class inheritance is a powerful feature that allows you to quickly define objects that conform to your
own interface and functionality standards. Property classes also allow you to make global changes to
applications quickly. By simply changing the definition of a property class, you can change the definition of
all objects that inherit properties from that class.
Yes . All type of triggers .
645. 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.
646. What are record groups ? * Can record groups created at run-time?
A record group is an internal Oracle Forms data structure that has a column/row framework similar to a
database table. However, unlike database tables, record groups are separate objects that belong to the form
module in which they are defined. A record group can have an unlimited number of columns of type CHAR,
LONG, NUMBER, or DATE provided that the total number of columns does not exceed 64K. Record group
column names cannot exceed 30 characters.
Programmatically, record groups can be used whenever the functionality offered by a two-dimensional array
of multiple data types is desirable.
TYPES OF RECORD GROUP:
Query Record Group A query record group is a record group that has an associated SELECT statement.
The columns in a query record group derive their default names, data types, and lengths from the database
columns referenced in the SELECT statement. The records in a query record group are the rows retrieved
by the query associated with that record group.
Non-query Record Group A non-query record group is a group that does not have an associated query, but
whose structure and values can be modified programmatically at runtime.
Static Record Group A static record group is not associated with a query; rather, you define its structure and
row values at design time, and they remain fixed at runtime.
648. Can a button have icon and lable at the same time ?
-NO
655. Can you pass values to-and-fro from foreign function ? how ?
Yes . You obtain a return value from a foreign function by assigning the return value to an Oracle Forms
variable or item. Make sure that the Oracle Forms variable or item is the same data type as the return value
from the foreign function.
After assigning an Oracle Forms variable or item value to a PL/SQL variable, pass the PL/SQL variable as a
parameter value in the PL/SQL interface of the foreign function. The PL/SQL variable that is passed as a
parameter must be a valid PL/SQL data type; it must also be the appropriate parameter type as defined in
the PL/SQL interface.
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
664. 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 cursur state across transaction Open/close.
665. Can you replace default form processing ? How ?
679. Which parameter specified in the DEFAULT STORAGE clause of CREATE TABLESPACE cannot
be altered after creating the tablespace?
All the default storage parameters defined for the tablespace can be changed using the ALTER
TABLESPACE command. When objects are created their INITIAL and MINEXTENS values cannot be
changed.
683. 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.
684. What are the advantages of operating a database in ARCHIVELOG mode over operating it in NO
ARCHIVELOG mode ?
Complete database recovery from disk failure is possible only in ARCHIVELOG mode. Online database
backup is possible only in ARCHIVELOG mode.
682. 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
687. What are the minimum number of groups required for a matrix report
The minimum of groups required for a matrix report are 4 e -----
688.. What is a Synonym ?
A synonym is an alias for a table, view, sequence or program unit.
722. 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
723. Can a field be used in a report without it appearing in any data group?
Yes
724. The join defined by the default data link is an outer join yes or no?
Yes
727. Is it possible to insert comments into sql statements return in the data model editor?
Yes
728. Is it possible to disable the parameter from while running the report?
Yes
729. When a form is invoked with call_form, Does oracle forms issues a save point?
Yes
730. 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.
731. 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.
732. Explain the difference between a data block, an extent and a segment.
A data block is the smallest unit of logical storage for a database object. As objects grow they take chunks of
additional storage that are composed of contiguous data blocks. These groupings of contiguous data blocks
are called extents. All the extents that an object takes when grouped together are considered the segment of
the database object.
733. Give two examples of how you might determine the structure of the table DEPT.
Use the describe command or use the dbms_metadata.get_ddl package.
734. Where would you look for errors from the database engine?
In the alert log.
737. 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.
740. 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.
741. Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the
benefits and disadvantages to each.
ARCHIVELOG mode is a mode that you can put the database in for creating a backup of all transactions
that have occurred in the database so that you can recover to any point in time. NOARCHIVELOG mode is
basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any
point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an
archive log and thus increases the performance of the database slightly.
742. What command would you use to create a backup control file?
Alter database backup control file to trace.
743. 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
744. 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.
746. 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.
749. How would you determine the time zone under which a database was operating?
select DBTIMEZONE from dual;
755. Where in the Oracle directory tree structure are audit traces placed?
In unix $ORACLE_HOME/rdbms/audit, in Windows the event viewer
757. When a user process fails, what background process cleans up after it?
PMON
759. How would you determine what sessions are connected and what resources they are waiting
for?
Use of V$SESSION and V$SESSION_WAIT
762. Give two methods you could use to determine what DDL changes have been made.
You could use Logminer or Streams
764. What is the difference between a TEMPORARY tablespace and a PERMANENT tablespace?
A temporary tablespace is used for temporary objects such as sort structures while permanent tablespaces
are used to store those objects meant to be used as the true objects of the database.
769. What view would you use to look at the size of a data file?
DBA_DATA_FILES
770. What view would you use to determine free space in a tablespace?
DBA_FREE_SPACE
771. How would you determine who has added a row to a table?
Turn on fine grain auditing for the table.
774. You have just compiled a PL/SQL package but got errors, how would you view the errors?
SHOW ERRORS
777. What is the difference between the SQL*Loader and IMPORT utilities?
These two Oracle utilities are used for loading data into the database. The difference is that the import utility
relies on the data being produced by another Oracle utility EXPORT while the SQL*Loader utility allows data
to be loaded that has been produced by other utilities from different data sources just so long as it conforms
to ASCII formatted or delimited files.
781. Can one resize tablespaces and data files? (for DBA)
One can manually increase or decrease the size of a datafile from Oracle 7.2 using the command.
ALTER DATABASE DATAFILE 'filename2' RESIZE 100M;
Because you can change the sizes of datafiles, you can add more space to your database without adding
more datafiles. This is beneficial if you are concerned about reaching the maximum number of datafiles
allowed in your database.
Manually reducing the sizes of datafiles allows you to reclaim unused space in the database. This is useful
for correcting errors in estimations of space requirements.
Also, datafiles can be allowed to automatically extend if more space is required. Look at the following
command:
CREATE TABLESPACE pcs_data_ts
DATAFILE 'c:\ora_apps\pcs\pcsdata1.dbf' SIZE 3M
AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED
DEFAULT STORAGE (INITIAL 10240
NEXT 10240
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0)
ONLINE
PERMANENT;
786. What are the values that can be specified for OPTIMIZER_GOAL parameter of the ALTER
SESSION Command ? )
CHOOSE,ALL_ROWS,FIRST_ROWS and RULE.
788.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.
789. 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.
791. 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.
792. 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.
793. Why and when should I backup my database? (for DBA
Backup and recovery is one of the most important aspects of a DBAs job. If you lose your company's data,
you could very well lose your job. Hardware and software can always be replaced, but your data may be
irreplaceable!
Normally one would schedule a hierarchy of daily, weekly and monthly backups, however consult with your
users before deciding on a backup schedule. Backup frequency normally depends on the following factors:
. Rate of data change/ transaction rate
. Database availability/ Can you shutdown for cold backups?
. Criticality of the data/ Value of the data to the company
. Read-only tablespace needs backing up just once right after you make it read-only
. If you are running in archivelog mode you can backup parts of a database over an extended cycle of days
. If archive logging is enabled one needs to backup archived log files timeously to prevent database freezes
. Etc.
Carefully plan backup retention periods. Ensure enough backup media (tapes) are available and that old
backups are expired in-time to make media available for new backups. Off-site vaulting is also highly
recommended.
Frequently test your ability to recover and document all possible scenarios. Remember, it's the little things
that will get you. Most failed recoveries are a result of organizational errors and miscommunications.
794. 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.
795. 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.
796. What is the difference between restoring and recovering? (for DBA
Restoring involves copying backup files from secondary storage (backup media) to disk. This can be done to
replace damaged files or to copy/move a database to a new location.
Recovery is the process of applying redo logs to the database to roll it forward. One can roll-forward until a
specific point-in-time (before the disaster occurred), or roll-forward until the last transaction recorded in the
log files. Sql> connect SYS as SYSDBA
Sql> RECOVER DATABASE UNTIL TIME '2001-03-06:16:00:00' USING BACKUP CONTROLFILE;
797. 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.
798. What are the built_ins used the display the LOV?
Show_lov
List_values
799. How do you call other Oracle Products from Oracle Forms?
Run_product is a built-in, Used to invoke one of the supported oracle tools products and specifies the name
of the document or module to be run. If the called product is unavailable at the time of the call, Oracle Forms
returns a message to the operator.
800. What is the main diff. bet. Reports 2.0 & Reports 2.5?
Report 2.5 is object oriented.
805. What does the term panel refer to with regard to pages?
A panel is the no. of physical pages needed to print one logical page.
807.What is a library?
A library is a collection of subprograms including user named procedures, functions and packages.
808. 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.
809. Use the add_group_column function to add a column to record group that was created at a
design time?
False
810. 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
811. 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.
813. 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
814. 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
815. 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;
816. How can you execute the user defined triggers in forms 3.0 ?
Execute Trigger (trigger-name)
820. 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
828. How many minimum groups are required for a matrix report
The minimum number of groups in matrix report are 4
830. How does one manage Oracle database users? (for DBA
Oracle user accounts can be locked, unlocked, forced to choose new passwords, etc. For example, all
accounts except SYS and SYSTEM will be locked after creating an Oracle9iDB database using the DB
Configuration Assistant (dbca). DBA's must unlock these accounts to make them available to users.
Look at these examples:
ALTER USER scott ACCOUNT LOCK -- lock a user account
ALTER USER scott ACCOUNT UNLOCK; -- unlocks a locked users account
ALTER USER scott PASSWORD EXPIRE; -- Force user to choose a new password
831. How does one tune Oracle Wait events? (for DBA
Some wait events from V$SESSION_WAIT and V$SYSTEM_EVENT views:
Event Name: Tuning Recommendation:
db file sequential Tune SQL to do less I/O. Make sure all objects are analyzed. Redistribute I/O across
read disks.
Increase DB_CACHE_SIZE (DB_BLOCK_BUFFERS prior to 9i)/ Analyze contention
buffer busy waits
from SYS.V$BH
log buffer spaces Increase LOG_BUFFER parameter or move log files to faster disks
832. 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 controlfile and reading datafile 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';
836. How does one use ORADEBUG from Server Manager/ SQL*Plus? (for DBA
Execute the "ORADEBUG HELP" command from svrmgrl or sqlplus to obtain a list of valid ORADEBUG
commands. Look at these examples:
SQLPLUS> REM Trace SQL statements with bind variables
SQLPLUS> oradebug setospid 10121
Oracle pid: 91, Unix process pid: 10121, image: oracleorcl
SQLPLUS> oradebug EVENT 10046 trace name context forever, level 12
Statement processed.
SQLPLUS> ! vi /app/oracle/admin/orcl/bdump/ora_10121.trc
SQLPLUS> REM Trace Process Statistics
SQLPLUS> oradebug setorapid 2
Unix process pid: 1436, image: ora_pmon_orcl
SQLPLUS> oradebug procstat
Statement processed.
SQLPLUS>> oradebug TRACEFILE_NAME
/app/oracle/admin/orcl/bdump/pmon_1436.trc
SQLPLUS> REM List semaphores and shared memory segments in use
SQLPLUS> oradebug ipc
SQLPLUS> REM Dump Error Stack
SQLPLUS> oradebug setospid <pid>
SQLPLUS> oradebug event immediate trace name errorstack level 3
SQLPLUS> REM Dump Parallel Server DLM locks
SQLPLUS> oradebug lkdebug -a convlock
SQLPLUS> oradebug lkdebug -a convres
SQLPLUS> oradebug lkdebug -r <resource handle> (i.e 0x8066d338 from convres dump)
839. 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.
842. Is it possible to set a filter condition in a cross product group in matrix reports?
No
844. 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.
851. 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.
852. 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.
854. 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.
856. 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.
859. 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
Start the OEM console and create a new event. Select option "Enable Unsolicited Event". Select test
"Unsolicited Event". When entering the parameters, enter values similar to these:
Event Name: /oracle/script/myalert
Object: *
Severity: *
Message: *
One can now write the script and invoke the oemevent command to send alerts to the console. Look at this
example: oemevent /oracle/script/myalert DESTINATION alert "My custom error message" where
DESTINATION is the same value as entered in the "Monitored Destinations" field when you've registered
the event in the OEM Console.
860. 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
861. Are there any troubleshooting tips for OEM? (for DBA
. Create the OEM repository with a user (which will manage the OEM) and store it in a tablespace that does
not share any data with other database users. It is a bad practice to create the repository with SYS and
System.
. If you are unable to launch the console or there is a communication problem with the intelligent agent
(daemon). Ensure OCX files are registered. Type the following in the DOS prompt (the current directory
should be $ORACLE_HOME\BIN:
C:\Orawin95\Bin> RegSvr32 mmdx32.OCX
C:\Orawin95\Bin> RegSvr32 vojt.OCX
. If you have a problem starting the Oracle Agent
Solution A: Backup the *.Q files and Delete all the *.Q Files ($Oracle_home/network/agent folder)
Backup and delete SNMP_RO.ora, SNMP_RW.ora, dbsnmp.ver and services.ora files
($Oracle_Home/network/admin folder) Start the Oracle Agent service.
Solution B: Your version of Intelligent Agent could be buggy. Check with Oracle for any available patches.
For example, the Intelligent Agent that comes with Oracle 8.0.4 is buggy.
Sometimes you get a Failed status for the job that was executed successfully.
Check the log to see the results of the execution rather than relying on this status.
862. 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.
867. How does one use the import/export utilities? (for DBA
Look for the "imp" and "exp" executables in your $ORACLE_HOME/bin directory. One can run them
interactively, using command line parameters, or using parameter files. Look at the imp/exp parameters
before starting. These parameters can be listed by executing the following commands: "exp help=yes" or
"imp help=yes".
The following examples demonstrate how the imp/exp utilities can be used:
exp scott/tiger file=emp.dmp log=emp.log tables=emp rows=yes indexes=no
exp scott/tiger file=emp.dmp tables=(emp,dept)
imp scott/tiger file=emp.dmp full=yes
imp scott/tiger file=emp.dmp fromuser=scott touser=scott tables=dept
exp userid=scott/tiger@orcl parfile=export.txt
... where export.txt contains:
BUFFER=100000
FILE=account.dmp
FULL=n
OWNER=scott
GRANTS=y
COMPRESS=y
NOTE: If you do not like command line utilities, you can import and export data with the "Schema Manager"
GUI that ships with Oracle Enterprise Manager (OEM).
868. What are the types of visual attribute settings?
Custom Visual attributes Default visual attributes Named Visual attributes. Window
870. What are the two ways to incorporate images into a oracle forms application?
Boilerplate Images
Image_items
871. Can one monitor how fast a table is imported? (for DBA
If you need to monitor how fast rows are imported from a running import job, try one of the following
methods:
Method 1:
select substr(sql_text,instr(sql_text,'INTO "'),30) table_name,
rows_processed,
round((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60,1) minutes,
trunc(rows_processed/((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60)) rows_per_min
from sys.v_$sqlarea
where sql_text like 'INSERT %INTO "%'
and command_type = 2
and open_versions > 0;
For this to work one needs to be on Oracle 7.3 or higher (7.2 might also be OK). If the import has more than
one table, this statement will only show information about the current table being imported.
Contributed by Osvaldo Ancarola, Bs. As. Argentina.
Method 2:
Use the FEEDBACK=n import parameter. This command will tell IMP to display a dot for every N rows
imported.
876. How does one use the SQL*Loader utility? (for DBA
One can load data into an Oracle database by using the sqlldr (sqlload on some platforms) utility. Invoke the
utility without arguments to get a list of available parameters. Look at the following example:
sqlldr scott/tiger control=loader.ctl
This sample control file (loader.ctl) will load an external data file containing delimited data:
load data
infile 'c:\data\mydata.csv'
into table emp
fields terminated by "," optionally enclosed by '"'
( empno, empname, sal, deptno )
The mydata.csv file may look like this:
10001,"Scott Tiger", 1000, 40
10002,"Frank Naude", 500, 20
Another Sample control file with in-line data formatted as fix length records. The trick is to specify "*" as the
name of the data file, and use BEGINDATA to start the data section in the control file.
load data
infile *
replace
into table departments
( dept position (02:05) char(4),
deptname position (08:27) char(20)
)
begindata
COSC COMPUTER SCIENCE
ENGL ENGLISH LITERATURE
MATH MATHEMATICS
POLY POLITICAL SCIENCE
879. 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
880. 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
)
881.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
)
882. 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.
883. What are the triggers available in the reports?
Before report, Before form, After form , Between page, After report.
884. Why is a Where clause faster than a group filter or a format trigger?
Because, in a where clause the condition is applied during data retrievalthan after retrieving the data.
885. 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
)
886. 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
)
889. 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=.
891. 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
892. 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.
4.Can you have two functions with the same name in a PL/SQL block ?
Yes.
5.Can you have two stored functions with the same name ?
Yes.
10.Can 2 functions have same name & input parameters but differ only by return datatype
No.
17.What is the maximum no. of statements that can be specified in a trigger statement ?
One.
20.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.
34.What are the states of a rollback segment ? What is the difference between partly available and
needs recovery ?
The various states of a rollback segment are :
ONLINE, OFFLINE, PARTLY AVAILABLE, NEEDS RECOVERY and INVALID.
36.An insert statement followed by a create table statement followed by rollback ? Will the rows be
inserted ?
No.
50.Which symbol preceeds the path to the table in the remote database ?
@
53.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
54.A table has the following data : [[5, Null, 10]]. What will the average function return ?
7.5
56.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
67.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.
76.If content of dual is updated to some value computation takes place or not ?
Yes
77.If any other table same as dual is created would it act similar to dual?
Yes
79.Assume that there are multiple databases running on one machine. How can you switch from one
to another ?
Changing the ORACLE_SID
84.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.
85.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
88.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.
90.What is a transaction ?
A transaction is a set of SQL statements between any two COMMIT and ROLLBACK statements.
92.Which of the following is not a schema object : Indexes, tables, public synonyms, triggers and
packages ?
Public synonyms
94.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.
95.Is there a PL/SQL Engine in SQL*Plus?
No. Unlike Oracle Forms, SQL*Plus does not have a PL/SQL engine. Thus, all your PL/SQL are send
directly to the database engine for execution. This makes it much more efficient as SQL statements are not
stripped off and send to the database individually.
99.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;
What are the differences between database designing and database modeling?
If the large table contains thousands of records and the application is accessing 35% of the table
which method to use: index searching or full table scan?
In which situation whether peak time or off peak time you will execute the ANALYZE TABLE
command. Why?
How to check to memory gap once the SGA is started in Restricted mode?
All the users are complaining that their application is hanging. How you will resolve this situation in
OLTP?
If the SQL * Plus hangs for a long time, what is the reason?
Shall we create procedures to fetch more than one record?
How do you increase the performance of %LIKE operator?
You are regularly changing the package body part. How will you create or what will you do before
creating that package?
How can you see the source code of the package?
Dual table explain. Is any data internally storing in dual table. Lot of users are accessing select
sysdate from dual and they getting some millisecond differences. If we execute SELECT SYSDATE
FROM EMP; what error will we get. Why?
In exception handling we have some NOT_FOUND and OTHERS. In inner layer we have some
NOT_FOUND and OTHERS. While executing which one whether outer layer or inner layer will
check first?
What is mutated trigger, is it the problem of locks. In single user mode we got mutated error, as a
DBA how you will resolve it?
Schema A has some objects and created one procedure and granted to Schema B. Schema B has
the same objects like schema A. Schema B executed the procedure like inserting some records. In
this case where the data will be stored whether in Schema A or Schema B?
What is bulk SQL?
How to do the scheduled task/jobs in Unix platform?
If the entire disk is corrupted how will you and what are the steps to recover the database?
How will you monitor rollback segment status?
List the sequence of events when a large transaction that exceeds beyond its optimal value when
an entry wraps and causes the rollback segment to expand into another extend?
What is redo log file mirroring?
How can we plan storage for very large tables
When will be a segment released ?
What are disadvantages of having raw devices?
List the factors that can affect the accuracy of the estima?
What is the difference between $$DATE$$ & $$DBDATE$$$$DBDATE$$ retrieves the current
database date$$date$$ retrieves the current operating system
How to prevent unauthorized use of privileges granted to a Role ?
What is a deadlock and Explain?
What are the basic element of base configuration of an Oracle database?
What is an index and How it is implemented in Oracle database?
What is the use of redo log information?
What is a schema?
What is Parallel Server?
What is a database instance and Explain?
What is a datafile?
What is a temporary segment?
What are the uses of rollback segment
SQL
SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to
your database.
SQL*PLUS
SQL*PLUS is an application that recognizes & executes SQL commands & specialized SQL*Plus
commands that can customize reports, provide help & edit facility & maintain system variables.
NVL
NVL : Null value function converts a null value to a non-null value for the purpose of evaluating an
expression. Numeric Functions accept numeric I/P & return numeric values. They are MOD, SQRT,
ROUND, TRUNC & POWER.
Date Functions
Date Functions are ADD_MONTHS, LAST_DAY, NEXT_DAY, MONTHS_BETWEEN & SYSDATE.
Character Functions
Character Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional functions are
GREATEST & LEAST. Group Functions returns results based upon groups of rows rather than one result
per row, use group functions. They are AVG, COUNT, MAX, MIN & SUM.
COLUMN
COLUMN command define column headings & format data values.
BREAK
BREAK command clarify reports by suppressing repeated values, skipping lines & allowing for controlled
break points.
COMPUTE
command control computations on subsets created by the BREAK command.
SET
SET command changes the system variables affecting the report environment.
SPOOL
SPOOL command creates a print file of the report.
JOIN
JOIN is the form of SELECT command that combines info from two or more tables.
Types of Joins are Simple (Equijoin & Non-Equijoin), Outer & Self join.
Equijoin returns rows from two or more tables joined together based upon a equality condition in the
WHERE clause.
Non-Equijoin returns rows from two or more tables based upon a relationship other than the equality
condition in the WHERE clause.
Outer Join combines two or more tables returning those rows from one table that have no direct match in the
other table.
Self Join joins a table to itself as though it were two separate tables.
Union
Union is the product of two or more tables.
Intersect
Intersect is the product of two tables listing only the matching rows.
Minus
Minus is the product of two tables listing only the non-matching rows.
Correlated Subquery
Correlated Subquery is a subquery that is evaluated once for each row processed by the parent statement.
Parent statement can be Select, Update or Delete. Use CRSQ to answer multipart questions whose answer
depends on the value in each row processed by parent statement.
Multiple columns
Multiple columns can be returned from a Nested Subquery.
Sequences
Sequences are used for generating sequence numbers without any overhead of locking. Drawback is that
after generating a sequence number if the transaction is rolled back, then that sequence number is lost.
Synonyms
Synonyms is the alias name for table, views, sequences & procedures and are created for reasons of
Security and Convenience.
Two levels are Public - created by DBA & accessible to all the users. Private - Accessible to creator only.
Advantages are referencing without specifying the owner and Flexibility to customize a more meaningful
naming convention.
Indexes
Indexes are optional structures associated with tables used to speed query execution and/or guarantee
uniqueness. Create an index if there are frequent retrieval of fewer than 10-15% of the rows in a large table
and columns are referenced frequently in the WHERE clause. Implied tradeoff is query speed vs. update
speed. Oracle automatically update indexes. Concatenated index max. is 16 columns.
Data types
Max. columns in a table is 255. Max. Char size is 255, Long is 64K & Number is 38 digits.
Cannot Query on a long column.
Char, Varchar2 Max. size is 2000 & default is 1 byte.
Number(p,s) p is precision range 1 to 38, s is scale -84 to 127.
Long Character data of variable length upto 2GB.
Date Range from Jan 4712 BC to Dec 4712 AD.
Raw Stores Binary data (Graphics Image & Digitized Sound). Max. is 255 bytes.
Mslabel Binary format of an OS label. Used primarily with Trusted Oracle.
Transaction
Transaction is defined as all changes made to the database between successive commits.
Commit
Commit is an event that attempts to make data in the database identical to the data in the form. It involves
writing or posting data to the database and committing data to the database. Forms check the validity of the
data in fields and records during a commit. Validity check are uniqueness, consistency and db restrictions.
Posting
Posting is an event that writes Inserts, Updates & Deletes in the forms to the database but not committing
these transactions to the database.
Rollback
Rollback causes work in the current transaction to be undone.
Savepoint
Savepoint is a point within a particular transaction to which you may rollback without rolling back the entire
transaction.
Set Transaction
Set Transaction is to establish properties for the current transaction.
Locking
Locking are mechanisms intended to prevent destructive interaction between users accessing data. Locks
are used to achieve.
Consistency
Consistency : Assures users that the data they are changing or viewing is not changed until the are thro' with
it.
Integrity
Assures database data and structures reflects all changes made to them in the correct sequence. Locks
ensure data integrity and maximum concurrent access to data. Commit statement releases all locks. Types
of locks are given below.
Data Locks protects data i.e. Table or Row lock.
Dictionary Locks protects the structure of database object i.e. ensures table's structure does not change for
the duration of the transaction.
Internal Locks & Latches protects the internal database structures. They are automatic.
Exclusive Lock allows queries on locked table but no other activity is allowed.
Share Lock allows concurrent queries but prohibits updates to the locked tables.
Row Share allows concurrent access to the locked table but prohibits for a exclusive table lock.
Row Exclusive same as Row Share but prohibits locking in shared mode.
Shared Row Exclusive locks the whole table and allows users to look at rows in the table but prohibit others
from locking the table in share or updating them.
Share Update are synonymous with Row Share.
Deadlock
Deadlock is a unique situation in a multi user system that causes two or more users to wait indefinitely for a
locked resource. First user needs a resource locked by the second user and the second user needs a
resource locked by the first user. To avoid dead locks, avoid using exclusive table lock and if using, use it in
the same sequence and use Commit frequently to release locks.
Mutating Table
Mutating Table is a table that is currently being modified by an Insert, Update or Delete statement.
Constraining Table is a table that a triggering statement might need to read either directly for a SQL
statement or indirectly for a declarative Referential Integrity constraints. Pseudo Columns behaves like a
column in a table but are not actually stored in the table. E.g. Currval, Nextval, Rowid, Rownum, Level etc.
SQL*Loader
SQL*Loader is a product for moving data in external files into tables in an Oracle database. To load data
from external files into an Oracle database, two types of input must be provided to SQL*Loader : the data
itself and the control file. The control file describes the data to be loaded. It describes the Names and format
of the data files, Specifications for loading data and the Data to be loaded (optional). Invoking the loader
sqlload username/password controlfilename <options>.
1. The most important DDL statements in SQL are:
CREATE TABLE - creates a new database table
3. SELECT statements:
SELECT column_name(s) FROM table_name
SELECT DISTINCT column_name(s) FROM table_name
SELECT column FROM table WHERE column operator value
SELECT column FROM table WHERE column LIKE pattern
SELECT column,SUM(column) FROM table GROUP BY column
SELECT column,SUM(column) FROM table GROUP BY column HAVING SUM(column) condition value
Note that single quotes around text values and numeric values should not be enclosed in quotes. Double
quotes may be acceptable in some databases.
4. The SELECT INTO Statement is most often used to create backup copies of tables or for archiving
records.
SELECT column_name(s) INTO newtable [IN externaldatabase] FROM source
SELECT column_name(s) INTO newtable [IN externaldatabase] FROM source WHERE column_name
operator value
9. The IN operator may be used if you know the exact value you want to return for at least one of the
columns.
SELECT column_name FROM table_name WHERE column_name IN (value1,value2,..)
14. Which system table contains information on constraints on all the tables created?obtained?
USER_CONSTRAINTS.
17. State true or false. EXISTS, SOME, ANY are operators in SQL?
True.
20. What is the advantage of specifying WITH GRANT OPTION in the GRANT command?
The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.
22. What is the value of comm and sal after executing the following query if the initial value of sal is
10000
UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;?
sal = 11000, comm = 1000.
23. Which command displays the SQL command in the SQL buffer, and then executes it?
RUN.
24. What command is used to get back the privileges offered by the GRANT command?
REVOKE.
25. What will be the output of the following query? SELECT
DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );? NO.
Explanation : The query checks whether a given string is a numerical digit.
26. Which date function is used to find the difference between two dates?
MONTHS_BETWEEN.
28. What is the use of the DROP option in the ALTER TABLE command?
It is used to drop constraints specified on the table.
30. What are the privileges that can be granted on a table by a user to others?
Insert, update, delete, select, references, index, execute, alter, all.
31. Which function is used to find the largest integer less than or equal to a specific value?
FLOOR.
32. Which is the subset of SQL commands used to manipulate Oracle Database structures, including
tables?
Data Definition Language (DDL).
34. What command is used to create a table by copying the structure of another table?
CREATE TABLE .. AS SELECT command
Explanation:
To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement
as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new
table.
38. What is the parameter substitution symbol used with INSERT INTO command?
&
54. 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 the maximum length is 255 and 2000 for VARCHAR2.
55. 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 column is allowed. It is not possible to use LONG column in WHERE or ORDER BY clause.
56. What are the pre-requisites to modify datatype of a column and to add a column with NOT NULL
constraint?
- To modify the datatype of a column the column must be empty.
- To add a column with NOT NULL constrain, the table must be empty.
60. 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.
63. 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 and these tables are the base tables of a view, then the changes will be
reference on the view.
64. Which of the following statements is true about implicit cursors?
1. Implicit cursors are used for SQL statements that are not named.
2. Developers should use implicit cursors with great care.
3. Implicit cursors are used in cursor for loops to handle data processing.
4. Implicit cursors are no longer a feature in Oracle.
66. A developer would like to use referential datatype declaration on a variable. The variable name is
EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE, and LNAME,
respectively. How would the developer define this variable using referential datatypes?
1. Use employee.lname%type.
2. Use employee.lname%rowtype.
3. Look up datatype for EMPLOYEE column on LASTNAME table and use that.
4. Declare it to be type LONG.
68. If left out, which of the following would cause an infinite loop to occur in a simple loop?
1. LOOP
2. END LOOP
3. IF-THEN
4. EXIT
69. Which line in the following statement will produce an error?
1. cursor action_cursor is
2. select name, rate, action
3. into action_record
4. from action_table;
5. There are no errors in this statement.
71. What happens when rows are found using a FETCH statement
1. It causes the cursor to close
2. It causes the cursor to open
3. It loads the current row values into variables
4. It creates the variables to hold the current row values
The trigger code should only execute when the column, COST_PER_TICKET, is greater than $3. Which
trigger information will you add?
77. For which trigger timing can you reference the NEW and OLD qualifiers?
1. Statement and Row 2. Statement only 3. Row only 4. Oracle Forms trigger
v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget
INTO v_yearly_budget
FROM studio
WHERE id = v_studio_id;
RETURN v_yearly_budget;
END;
Which set of statements will successfully invoke this function within SQL*Plus?
1. VARIABLE g_yearly_budget NUMBER
EXECUTE g_yearly_budget := GET_BUDGET(11);
2. VARIABLE g_yearly_budget NUMBER
EXECUTE :g_yearly_budget := GET_BUDGET(11);
3. VARIABLE :g_yearly_budget NUMBER
EXECUTE :g_yearly_budget := GET_BUDGET(11);
4. VARIABLE g_yearly_budget NUMBER
You are about to add an argument to CALCULATE_BUDGET. What effect will this have?
1. The GET_BUDGET function will be marked invalid and must be recompiled before the next execution.
2. The SET_BUDGET function will be marked invalid and must be recompiled before the next execution.
3. Only the CALCULATE_BUDGET procedure needs to be recompiled.
4. All three procedures are marked invalid and must be recompiled.
82. The CHECK_THEATER trigger of the THEATER table has been disabled. Which command can
you issue to enable this trigger?
1. ALTER TRIGGER check_theater ENABLE;
2. ENABLE TRIGGER check_theater;
3. ALTER TABLE check_theater ENABLE check_theater;
4. ENABLE check_theater;
This trigger must fire before each DELETE of the GROSS_RECEIPT table. It should fire only once for the
entire DELETE statement. What additional information must you add?
1. BEFORE DELETE ON gross_receipt
2. AFTER DELETE ON gross_receipt
3. BEFORE (gross_receipt DELETE)
4. FOR EACH ROW DELETED FROM gross_receipt
84. Examine this function:
61. CREATE OR REPLACE FUNCTION set_budget
62. (v_studio_id IN NUMBER, v_new_budget IN NUMBER) IS
63. BEGIN
64. UPDATE studio
65. SET yearly_budget = v_new_budget
WHERE id = v_studio_id;
IF SQL%FOUND THEN
RETURN TRUEl;
ELSE
RETURN FALSE;
END IF;
COMMIT;
END;
86. Procedure and Functions are explicitly executed. This is different from a database trigger. When
is a database trigger executed?
1. When the transaction is committed
2. During the data manipulation statement
3. When an Oracle supplied package references the trigger
4. During a data manipulation statement and when the transaction is committed
87. Which Oracle supplied package can you use to output values and messages from database
triggers, stored procedures and functions within SQL*Plus?
1. DBMS_DISPLAY 2. DBMS_OUTPUT 3. DBMS_LIST 4. DBMS_DESCRIBE
88. What occurs if a procedure or function terminates with failure without being handled?
1. Any DML statements issued by the construct are still pending and can be committed or rolled back.
2. Any DML statements issued by the construct are committed
3. Unless a GOTO statement is used to continue processing within the BEGIN section, the construct
terminates.
4. The construct rolls back any DML statements issued and returns the unhandled exception to the calling
environment.
89. Examine this code
71. BEGIN
72. theater_pck.v_total_seats_sold_overall := theater_pck.get_total_for_year;
73. END;
90 A stored function must return a value based on conditions that are determined at runtime.
Therefore, the SELECT statement cannot be hard-coded and must be created dynamically when the
function is executed. Which Oracle supplied package will enable this feature?
1. DBMS_DDL
2. DBMS_DML
3. DBMS_SYN
4. DBMS_SQL
90 A stored function must return a value based on conditions that are determined at runtime.
Therefore, the SELECT statement cannot be hard-coded and must be created dynamically when the
function is executed. Which Oracle supplied package will enable this feature?
1. DBMS_DDL
2. DBMS_DML
3. DBMS_SYN
4. DBMS_SQL
Will give you a zero if it is a number or greater than zero if not numeric (actually gives the count of non
numeric characters)
Method 2:
select instr(translate('wwww',
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')
FROM dual;
Here N = 10
The following query has a Problem of performance in the execution of the following query where the table
ter.ter_master have 22231 records. So the results are obtained after hours.
What are steps required tuning this query to improve its performance?
-Be sure to get familiar with EXPLAIN PLAN. This can help you determine the execution path that Oracle
takes. If you are using Cost Based Optimizer mode, then be sure that your statistics on TER_MASTER are
up-to-date. -Also, you can change your SQL to:
SELECT a.*
FROM ter.ter_master a
WHERE NOT EXISTS (SELECT b.repno FROM ermast b
WHERE a.repno=b.repno) AND
(a.brepno = 'ALL' or a.repno > a.brepno)
ORDER BY a.repno;
93 What is the difference between Truncate and Delete interms of Referential Integrity?
DELETE removes one or more records in a table, checking referential Constraints (to see if there are
dependent child records) and firing any DELETE triggers. In the order you are deleting (child first then
parent) There will be no problems.
TRUNCATE removes ALL records in a table. It does not execute any triggers. Also, it only checks for the
existence (and status) of another foreign key Pointing to the table. If one exists and is enabled, then you will
get The following error. This is true even if you do the child tables first.
ORA-02266: unique/primary keys in table referenced by enabled foreign keys
You should disable the foreign key constraints in the child tables before issuing the TRUNCATE command,
then re-enable them afterwards.
CLIENT/SERVER
97. In a client server environment, what would be the major work that the client deals with ?
The client deals with the user interface part of the system.
116. In a Client/Server context, what does API (Application Programming Interface) refer to ?
An API, in a Client/Server context, is a specification of a set of functions for communication between the
client and the server.
121. What is the difference between file server and a database server ?
A file server just transfers all the data requested by all its client and the client processes the data while a
database server runs the query and sends only the query output.
PL/SQL Questions:
1. Describe the difference between a procedure, function and anonymous pl/sql block.
Candidate should mention use of DECLARE statement, a function must return a value while a procedure
doesn?t have to.
2. What is a mutating table error and how can you get around it?
This happens with triggers. It occurs because the trigger is trying to update a row it is currently using. The
usual fix involves either use of views or temporary tables so the database is selecting from one while
updating the other.
4. What packages (if any) has Oracle provided for use by developers?: Oracle provides the DBMS_
series of packages.
There are many which developers should be aware of such as DBMS_SQL, DBMS_PIPE,
DBMS_TRANSACTION, DBMS_LOCK, DBMS_ALERT, DBMS_OUTPUT, DBMS_JOB, DBMS_UTILITY,
DBMS_DDL, UTL_FILE. If they can mention a few of these and describe how they used them, even better. If
they include the SQL routines provided by Oracle, great, but not really what was asked.
7. In what order should a open/fetch/loop set of commands in a PL/SQL block be implemented if you
use the %NOTFOUND cursor variable in the exit when statement? Why?
OPEN then FETCH then LOOP followed by the exit when. If not specified in this order will result in the final
return being done twice because of the way the %NOTFOUND is handled by PL/SQL.
8. What are SQLCODE and SQLERRM and why are they important for PL/SQL developers?
SQLCODE returns the value of the error number for the last error encountered. The SQLERRM returns the
actual error message for the last error encountered. They can be used in exception handling to report, or,
store in an error log table, the error that occurred in the code. These are especially useful for the WHEN
OTHERS exception.
7. You want to group the following set of select returns, what can you group on?
Max(sum_of_cost), min(sum_of_cost), count(item_no), item_no
The only column that can be grouped on is the "item_no" column, the rest have aggregate functions
associated with them.
8. What special Oracle feature allows you to specify how the cost based system treats a SQL
statement?
The COST based system allows the use of HINTs to control the optimizer path selection. If they can give
some example hints such as FIRST ROWS, ALL ROWS, USING INDEX, STAR, even better.
9. You want to determine the location of identical rows in a table before attempting to place a unique
index on the table, how can this be done?
Oracle tables always have one guaranteed unique column, the rowid column. If you use a min/max function
against your rowid and then select against the proposed primary key you can squeeze out the rowids of the
duplicate rows pretty quick. For example:
select rowid from emp e
where e.rowid > (select min(x.rowid)
from emp x
where x.emp_no = e.emp_no);
In the situation where multiple columns make up the proposed key, they must all be used in the where
clause.
11. You are joining a local and a remote table, the network manager complains about the traffic
involved, how can you reduce the network traffic?
Push the processing of the remote data to the remote instance by using a view to pre-select the information
for the join. This will result in only the data required for the join being sent across.
15. How do you set the number of lines on a page of output? The width?
The SET command in SQLPLUS is used to control the number of lines generated per page and the width of
those lines, for example SET PAGESIZE 60 LINESIZE 80 will generate reports that are 60 lines long with a
line width of 80 characters. The PAGESIZE and LINESIZE options can be shortened to PAGES and LINES.
This document lists the order in which triggers fire in Oracle Forms 4.5:
o The first column, Action, describes the function to be performed
(e.g. deleting a record).
o The second column, Trigger Firing Order, describes the order
in which triggers fire after a function is performed.
o The third column, Level, describes the level (form, block, item)
at which the trigger fires. This was accomplished by creating a form
with all the triggers invoked. If a trigger could fire at all levels,
it was included at all levels. Such a trigger fires at the lowest level
at which it is defined.
Key triggers and triggers which fire via buttons or check boxes are
not included.
This bulletin does not cover every contingency and covers only the
most commonly used actions.
***********
Enter Query 1. Post-Text-Item Item
2. Post-Record Block
3. When-Clear-Block Block
4. When-New-Record-Instance Block
5. When-New-Item-Instance Item
Note: If you define the Key-ENTQRY trigger, this is the only trigger
which fires in an Enter Query situation.
*****************
Execute Query
After Enter Query 1. Pre-Query Block
2. Pre-Select Block
3. On-Select Block
4. When-Clear-Block Block
5. Post-Select Block
6. On-Fetch Block
7. On-Close Form
8. When-Clear-Block Block
Note: If you define the Key-EXEQRY trigger, this is the only trigger
which fires in an Execute Query situation.
*************
Execute Query
Without Enter
Query 1. Post-Text-Item Block
2. Pre-Query Block
3. Pre-Select Block
4. On-Select Block
5. Post-Select Block
6. On-Fetch Block
7. On-Close Form
8. When_Create_Record Block
9. Pre-Record Block
10. Pre-Text-Item Item
11. When-New-Record-Instance Block
12. When-New-Item-Instance Item
****
Exit 1. Post-Text-Item Item
2. Post-Record Block
3. Post-Block Block
4. Post-Form Form
5. On-Rollback Form
6. Pre-Logout Form
7. On-Logout Form
8. Post-Logout Form
**************
Next Field and
Previous field 1. When-New-Item-Instance Item
***************
Next Record and
Previous Record 1. When-New-Record-Instance Block
2. When-New-Item-Instance Item
**************
Next Block and
Previous Block 1. Post-Text-Item Item
2. Post-Record Block
3. Post-Block Block
4. When-Create-Record Block
5. Pre-Block Block
6. Pre-Record Block
7. Pre-Text-Item Block
8. When-New-Block-Instance Block
9. When-New-Record-Instance Block
10. When-New-Item-Instance Form
*******************
Records Are Queried 1. Post-Query Block
2. Post-Change Block
3. Post-Change Item
4. Post-Change Block
5. Post-Change Block
Go back to Post-Query
**********************
No Records Are Queried 1. When-New-Record-Instance Block
2. When-New-Item-Instance Item
The two triggers listed above, the Enter Query triggers, and
the Execute Query triggers fire.
*************
Create Record 1. Post-Change Block
2. When-Validate-Item Block
3. Post-Text-Item Block
4. When-Validate-Record Block
5. Post-Record Block
6. Post-Block Block
7. On-Savepoint Form
8. Pre-Commit Form
9. Pre-Insert Block
10. On-Insert Form
11. Post-Insert Block
12. Post-Forms-Commit Form
13. On-Commit Form
14. Post-Database-Commit Form
15. Pre-Block Block
16. Pre-Record Block
17. Pre-Text-Item Block
18. When-New-Item-Instance Form
*************
Update Record 1. When-Database-Record Block
2. Post-Change Block
3. When-Validate-Item Block
4. Post-Text-Item Block
5. When-Validate-Record Block
6. Post-Record Block
7. Post-Block Block
8. On-Savepoint Form
9. Pre-Commit Form
10. Pre-Update Block
11. On-Update Block
12. Post-Update Block
13. Post-Forms-Commit Form
14. On-Commit Form
a. Execute a query.
b. Change a value.
c. Choose Action->Save from the menu.
d. Record the triggers from that point.
*************
Delete Record 1. On-Lock Block
2. When-Remove-Record Block
3. Post-Change Block
4. Post-Change Block
5. Post-Change Block
6. Post-Change Block
7. Post-Change Block
8. Post-Change Block
9. Post-Change Item
10. Post-Query Block
11. Post-Text-Item Block
12. Post-Record Block
13. Pre-Record Block
14. Pre-Text-Item Block
15. When-New-Record-Instance Block
16. When-New-Item-Instance Form
Commit processing
The processing flow when a Commit occurs always seems to cause confusion. The basics of the Commit processing are
as follows.