Oracle

Oracle Interview Questions – Part 3

Q.What is default tablespace ?

The Tablespace to contain schema objects created without specifying a tablespace name.

Q.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.

Q.What is Statement Auditing ?

Statement auditing is the auditing of the powerful system privileges without regard to specifically named objects.

Q.What are the database administrators utilities available ?

SQL * DBA – This allows DBA to monitor and control an ORACLE database. SQL * Loader – It loads data from standard operating system files (Flat files) into ORACLE database tables. Export (EXP) and Import (imp) utilities allow you to move existing data in ORACLE format to and from ORACLE database.

Q.What is the use of ANALYZE command ?

To perform one of these function on an index, table, or cluster:
-To collect statistics about object used by the optimizer and store them in the data dictionary.
-To delete statistics about the object used by object from the data dictionary.
-To validate the structure of the object.
-To identify migrated and chained rows of the table or cluster.

Q.What is Auditing?

Monitoring of user access to aid in the investigation of database use.

Q.What are roles? How can we implement roles?

Roles are the easiest way to grant and manage common privileges needed by different groups of database users. Creating roles and assigning provides to roles. Assign each role to group of users. This will simplify the job of assigning privileges to individual users.

Q.What are Roles?

Roles are named groups of related privileges that are granted to users or other roles.

Q.What are the use of Roles?

REDUCED GRANTING OF PRIVILEGES – Rather than explicitly granting the same set of privileges to many users a database administrator can grant the privileges for a group of related users granted to a role and then grant only the role to each member of the group.
DYNAMIC PRIVILEGE MANAGEMENT – When the privileges of a group must change, only the privileges of the role need to be modified. The security domains of all users granted the group’s role automatically reflect the changes made to the role.
SELECTIVE AVAILABILITY OF PRIVILEGES – The roles granted to a user can be selectively enable (available for use) or disabled (not available for use). This allows specific control of a user’s privileges in any given situation.
APPLICATION AWARENESS – A database application can be designed to automatically enable and disable selective roles when a user attempts to use the application.

Q.What is Tablespace Quota?

The collective amount of disk space available to the objects in a schema on a particular tablespace.

Q.What are the different Levels of Auditing?

Statement Auditing, Privilege Auditing and Object Auditing.

Q.What is a Database instance ? Explain

A database instance (Server) is a set of memory structure and background processes that access a set of database files.
The process can be shared by all users. The memory structure that are used to store most queried data from database. This helps up to improve database performance by decreasing the amount of I/O performed against data file.

Q.What is Privilege Auditing?

Privilege auditing is the auditing of the use of powerful system privileges without regard to specifically named objects.

Q.What is Object Auditing?

Object auditing is the auditing of accesses to specific schema objects without regard to user.

Each database user is assigned a Profile that specifies limitations on various system resources available to the user.

Q.What dynamic data replication?
Updating or Inserting records in remote database through database triggers. It may fail if remote database is having any problem.

Q.How will you enforce security using stored procedures?

Don’t grant user access directly to tables within the application. Instead grant the ability to access the procedures that access the tables. When procedure executed it will execute the privilege of procedures owner. Users cannot access tables except via the procedure.

Q.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/

Q.What is a SQL * NET?

SQL *NET is ORACLE’s mechanism for interfacing with the communication protocols used by the networks that facilitate distributed processing and distributed databases. It is used in Clint-Server and Server-Server communications.

Q.What are the dictionary tables used to monitor a database spaces ?
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.

Q.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.

Q.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';

Q.What is user Account in Oracle database?

An user account is not a physical structure in Database but it is having important relationship to the objects in the database and will be having certain privileges.

Q.When will the data in the snapshot log be used?

We must be able to create a after row trigger on table (i.e., it should be not be already available) After giving table privileges. We cannot specify snapshot log name because oracle uses the name of the master table in the name of the database objects that support its snapshot log. The master table name should be less than or equal to 23 characters. (The table name created will be MLOGS_tablename, and trigger name will be TLOGS name).

Q.How can you enable automatic archiving?

Shut the database
Backup the database
Modify/Include LOG_ARCHIVE_START_TRUE in init.ora file.
Start up the database.

Q.How can you Enforce Referential Integrity in snapshots?

Time the references to occur when master tables are not in use. Peform the reference the manually immdiately locking the master tables. We can join tables in snopshots by creating a complex snapshots that will based on the master tables.

Q.What is Two-Phase Commit?

Two-phase commit is mechanism that guarantees a distributed transaction either commits on all involved nodes or rolls back on all involved nodes to maintain data consistency across the global distributed database. It has two phase, a Prepare Phase and a Commit Phase.