Professional Documents
Culture Documents
Oracle 2
Oracle 2
The easiest way to change them is using the R3INST program. The only negative
consequence when SYSTEM’s password is changed is that sapdba will request a
password to perform most actions.
You can use command ’sapdba -sapr3 ‘ to change the SAPR3 user password. This
also updates the SAPUSER table entry. There is also a ommand
sapdba -alter_user /
Another way this error can occur is if the trigger has statements to change the
primary, foreign or unique key columns of the table off which it fires. If you
must have triggers on tables that have referential constraints, the workaround
is to enforce the referential integrity through triggers as well.
1. A row-level trigger cannot query or modify a mutating table. (Of course, NEW
and OLD still can be accessed by the trigger).
2. A statement-level trigger cannot query or modify a mutating table if the
trigger is fired as the result of a CASCADE delete.
What are the difference between DDL, DML and DCL commands?
Answer :
DDL (Data Definition Language) statements are used to define the database
structure or schema. Some examples:
1. CREATE - to create objects in the database
2. ALTER - alters the structure of the database
3. DROP - delete objects from the database
4. TRUNCATE - remove all records from a table, including all spaces allocated
for the records are removed
5. COMMENT - add comments to the data dictionary
6. RENAME - rename an object
DML (Data Manipulation Language) statements are used for managing data within
schema objects. Some examples:
Transaction Control
Manages the changes made by DML statements. These commands allow statements to
be grouped together into logical transactions.
Explain an ORA-01555.
Answer :
You get this error when you get a snapshot too old within rollback. It can
usually be solved by increasing the undo retention or increasing the size of
rollbacks. You should also look at the logic involved in the application getting
the error message.
How would you go about increasing the buffer cache hit ratio?
Answer :
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.
What column differentiates the V$ views to the GV$ views and how?
Answer :
The INST_ID column which indicates the instance in a RAC environment the
information came from.
Give the stages of instance startup to a usable state where normal users may
access it
Answer :
STARTUP NOMOUNT - Instance startup. STARTUP MOUNT - The database is mounted.
STARTUP OPEN - The database is opened
Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the
benefits and disadvantages to each.
Answer :
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.
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?
Answer :
Disable the foreign key constraint to the parent, drop the table, re-create the
table, enable the foreign key constraint.
Explain the difference between a hot backup and a cold backup and the benefits
associated with each.
Answer :
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.
Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further
classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
Answer :
Triggers are special kind of stored procedures that get executed automatically
when an INSERT, UPDATE or DELETE operation takes place on a table.
Triggers can’t be invoked on demand. They get triggered only when an associated
action (INSERT, UPDATE, DELETE) happens on the table on which they are defined.
Triggers are generally used to implement business rules, auditing. Triggers can
also be used to extend the referential integrity checks, but wherever possible,
use constraints for this purpose, instead of triggers, as constraints are much
faster.
Disadvantages of cursors: Each time you fetch a row from the cursor, it results
in a network roundtrip, where as a normal SELECT query makes only one
rowundtrip, however large the resultset is. Cursors are also costly because they
require more resources and temporary storage (results in more IO operations).
Furthere, there are restrictions on the SELECT statements that can be used with
some types of cursors.
Most of the times, set based operations can be used instead of cursors.
What are database files, control files and log files. How many of these files
should a database have at least? Why?
Answer :
Database Files The database files hold the actual data and are typically the
largest in size. Depending on their sizes, the tables (and other objects) for
all the user accounts can go in one database file—but that’s not an ideal
situation because it does not make the database structure very flexible for
controlling access to storage for different users, putting the database on
different disk drives, or backing up and restoring just part of the database.
You must have at least one database file but usually, more than one files are
used. In terms of accessing and using the data in the tables and other objects,
the number (or location) of the files is immaterial.
The database files are fixed in size and never grow bigger than the size at
which they were created
Control Files The control files and redo logs support the rest of the
architecture. Any database must have at least one control file, although you
typically have more than one to guard against loss. The control file records the
name of the database, the date and time it was created, the location of the
database and redo logs, and the synchronization information to ensure that all
three sets of files are always in step. Every time you add a new database or
redo log file to the database, the information is recorded in the control files.
Redo Logs Any database must have at least two redo logs. These are the journals
for the database; the redo logs record all changes to the user objects or system
objects. If any type of failure occurs, the changes recorded in the redo logs
can be used to bring the database to a consistent state without losing any
committed transactions. In the case of non-data loss failure, Oracle can apply
the information in the redo logs automatically without intervention from the
DBA.
The redo log files are fixed in size and never grow dynamically from the size at
which they were created.
The data in the SGA is shared among the users currently connected to the
database. For optimal performance , the entire SGA should be as large as
possible to store as much data as possible in memory and minimise disk I/O.
The information stored within the SGA is divided into several types of memory
structures, including the database buffers, redo log buffers and the shared
pool. These area have fixed size and are created during instance startup.
Database buffers of the SGA store the most recently used blocks of database
data; the set of database buffers in an instance is the database buffer cache.
These buffers can contain modified data that has not yet been written to disk.
Because the most recently used data is kept in memory, less disk I/O is
necessary and performance is increased.
The redo log buffer of the SGA stores redo entries - a log of changes made to
the database. The redo entries stored in the redo log buffers are written to an
online redo log file, which is used if database recovery is necessary. Its size
is static.
3. Shared Pool:
The shared pool is a portion of the SGA that contains shared SQL constructs such
as shared SQL areas. A shared SQL area is required to process every unique SQL
statement submitted in a database.
A shared SQL area contains information such as the parse tree and execution plan
for the coressponding statement. A single shared SQL area is used by multiple
application that issue the same statement leaving more control over cursors.
4. Cursors:
The PGA is a memory buffer that contains data and control information for a
server process. A PGA is created by Oracle when a server process is started. The
information in a PGA depends on the configuration of Oracle.
What are the different modes of mounting a Database with the Parallel Server ?
Answer :
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.