An index is a object which is used to improve performance during retrieval of records CREATE [UNIQUE] INDEX index_name ON employee[emp_id, emp_name,dept_id] [COMPUTE STATISTICS] The UNIQUE keyword is used when combined values of the index should be unique The COMPUTE STATISTICS during the creation of index optimizes the plan of execution of the SQL statement and improves performance
Technology problems
Search Results
1. What does cache and no cache options mean while creating a sequence?
Correct Answer: The CACHE option means how many sequences will be stored in memory for access by the application objects The performance is faster However in case of the database is down the data is memory is lost for the sequence The NO CACHE option means values are not stored in memory So there might be some performance issue
2. Define PL/SQL sequences and write syntax for a sequence
Correct Answer: A sequence is a database object that is used to generate sequential number CREATE SEQUENCE seqname [increment] [minimum value][maximum value][start][cache][cycle] Nextval and currval lets us get the next value and current value from the sequence
3. What is a PL/SQL package? what are its Advantages ?
Correct Answer: A package is a collection of related PL/SQL objects The package contains a body and a specification The package specification has the declaration which is public and can be used in the PL/SQL sub programs inside the package The package body holds the implementation of all the PL/SQL objects declared in the specification Example of a PL/SQL Package CREATE OR REPLACE PACKAGE emp_data AS PROCEDURE add_employee ( ename VARCHAR2, job VARCHAR2, mgr NUMBER, sal NUMBER, deptno NUMBER); END emp_actions; CREATE OR REPLACE PACKAGE BODY emp_data AS PROCEDURE add_employee ( ename VARCHAR2, job VARCHAR2, mgr NUMBER, sal NUMBER, deptno NUMBER) IS BEGIN INSERT INTO emp VALUES (empno_seqNEXTVAL, ename, job, mgr, SYSDATE, comm, deptno); END add_employee; END emp_data; Advantages of PL/SQL packages : Packages are easier for application designing, encapsulating data, additional functionality and better performance An application has various modules which can be placed in packages and handled easier
Correct Answer: PL/SQL exceptions are raised using the RAISE command This command is used when exceptions are defined by programmer and not implicit exceptions Example: Declare and raising an exception: DECLARE short_of_attendance EXCEPTION; min_attendance NUMBER(4); BEGIN IF min_attendance < 10 THEN RAISE short_of_attendance; END IF; EXCEPTION WHEN short_of_attendance THEN -- handle the error END;
5. Explain some of the commonly used Predefined PL/SQL Exceptions.
Correct Answer: 1)Divide by zero ? This is raised when any number is attempted to divide by zero 2)TOO MANY ROWS - A SELECT INTO statement returns more than one row 3)CASE_NOT_FOUND - No choice in the WHEN clause of a case statement is selected 4)LOGIN_DENIED - An attempt to login with an invalid username or password 5)PROGRAM_ERROR - An internal PL/SQL problem
Correct Answer: We need to first login to the data base as: SQLPLUS followed by user_name/password Then we need to execute the following query: CREATE USER user_name IDENTIFIED BY abcd; in this query a user_name suggest the user that is created which has a password abcd which is required for login in database
7. Could you explain the areas where tuning of database is required?
Correct Answer: The following are the areas of concern for tuning: - Memory Usage - Data Storage - Data Manipulation - Physical Storage - Logic Storage - Network Traffic Tuning Memory Usage: In Oracle 10g, we can use the Automatic Workload Repository (AWR) toolset to gather and manage statistical data but in case of Oracle 11g, we can use new initialization parameters such as MEMORY_TARGET to further control the overall memory used by Oracle It helps us to tune the database automatically when we don?t have time to read the AWR report Tuning Data Manipulation: There are two ways to tune Data manipulation in Oracle one way is through Conventional Path mode and second is Direct Path mode Tuning Physical Storage: We need to tune the physical storage because it limits the disk in database This can be done by: Distributing I/O, Striping and Mirroring
8. Oracle Server supports two different forms of replication: Basic and Advanced replication. Explain difference between these.
Correct Answer: Basic Replication : Basic replication is implemented using standard CREATE SNAPSHOT or CREATE MATERIALIZED VIEW statements It can only replicate data and not procedures, indexes replication is always one-way, and snapshot copies are read only Advanced Replication : Advanced replication supports various configurations of updatable snapshot, multi-master and update anywhere replication It is more difficult to configure but allows data and other database objects like indexes and procedures to be replicated Differences between Basic and Advanced replications: - With basic replication, data replicas provide read-only access to the table data whereas advanced replication features extend the capabilities of basic read-only replication by allowing applications to update table replicas throughout a replicated database system - With Basic Replication applications can query data from local data replicas On the other hand with advanced replication, data replicas anywhere in the system can provide both read and update access to a table's data
9. What is the Oracle HTTP Server? How does it work?
Correct Answer: Oracle HTTP Server is the Web server component of Oracle Database It is based on the Apache HTTP Server It is robust and reliable server due to following features: - Provide high availability infrastructure integration with Oracle Process Manager and Notification Server (OPMN), for process management, death detection and failover for Oracle HTTP Server processes - Provide Dynamic Monitoring Services (DMS) metrics that give runtime performance statistics for Oracle HTTP Server processes - Enable securing of transactions with Secure Sockets Layer (SSL) technology - Execute Perl scripts in the same process as the Oracle HTTP Server, or as CGI script
10. Explain how to start and stop the Oracle HTTP Server.
Correct Answer: Oracle HTTP Server is managed by OPMN which stands for Oracle Process Manager and Notification Server With the use of opmnctl utility we can start, stop and restart Oracle HTTP Server If we don?t use this utility the configuration management infrastructure cannot detect or communicate with the Oracle HTTP Server processes, and problems may occur The startproc command for the case of Windows is: ORACLE_HOME\opmn\bin> opmnctl [verbose] startproc ias-component=HTTP_Server To stop Oracle HTTP Server, use the stopproc command: Windows: ORACLE_HOME\opmn\bin> opmnctl [verbose] stopproc ias-component=HTTP_Server