This action might not be possible to undo. Are you sure you want to continue?
. Answer : Fact tables and dimension tables. A fact table contains measurements while dimension tables will contain data that will help describe the fact tables. How does one change the default Oracle passwords? Answer : Passwords for SYS/CHANGE_ON_INSTALL, SYSTEM/MANAGER, and SAPR3/SAP should be changed for security reasons. 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 / to change other Oracle user passwords. Is it better to put code in triggers or procedures? What is the difference? Answer : In earlier releases of Oracle it was better to put as much code as possible in procedures rather than triggers. At that stage procedures executed faster than triggers as triggers had to be re-compiled every time before executed (unless cached). In more recent releases both triggers and procedures are compiled when created (stored p-code) and one can add as much code as one likes in either procedures or triggers. What is a mutating and constraining table? Answer : “Mutating” means “changing”. A mutating table is a table that is currently being modified by an update, delete, or insert statement. When a trigger tries to reference a table that is in state of flux (being changed), it is considered “mutating” and raises an error since Oracle should not return data that has not yet reached its final state. 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. There are several restrictions in Oracle regarding triggers: 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: 1. 2. 3. 4. 5. 6. 7. 8. SELECT - retrieve data from the a database INSERT - insert data into a table UPDATE - updates existing data within a table DELETE - deletes all records from a table, the space for the records remain MERGE - UPSERT operation (insert or update) CALL - call a PL/SQL or Java subprogram EXPLAIN PLAN - explain access path to data LOCK TABLE - control concurrency
DCL is Data Control Language statements. Some examples: 1. GRANT - gives user’s access privileges to database 2. REVOKE - withdraw access privileges given with the GRANT command Transaction Control Manages the changes made by DML statements. These commands allow statements to be grouped together into logical transactions. 1. COMMIT - save work done 2. SAVEPOINT - identify a point in a transaction to which you can later roll back 3. ROLLBACK - restore database to original since the last COMMIT 4. SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use What’s the command to change the SQL prompt name? Answer : SQL> set sqlprompt “database-1 > ” database-1 > database-1 > What’s the command to see the current user name? Answer : Sql> show user; Explain the difference between $ORACLE_HOME and $ORACLE_BASE. Answer : ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where the oracle products reside. 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. How would you go about generating an EXPLAIN plan? Answer : Create a plan table with utlxplan.sql. Use the explain plan set statement_id = ‘tst1′ into plan_table for a SQL statement. Look at the explain plan with utlxplp.sql or utlxpls.sql 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 data block, an extent and a segment. Answer : 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. 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. What is a self join? Answer : Self join is just like any other join, except that two instances of the same table will be joined in the query. What is a join and explain different types of joins. Answer : Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. 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. What are triggers? How to invoke a trigger on demand? 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. What are cursors? Answer : Cursors allow row-by-row prcessing of the resultsets. Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See books online for more information. 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 the Large object types suported by Oracle? Answer : Blob and Clob What is the difference among “dropping a table”, “truncating a table” and “deleting all records” from a table. Answer : Dropping : (Table structure objects ,Drops the indexes + Data are deleted), Invalidates the dependent
(Data alone deleted), Performs an automatic commit, Faster than
Delete : (Data alone deleted), Doesn?t perform automatic commit What is GROUP BY? Answer : The GROUP BY keywords have been added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called. Without the GROUP BY functionality, finding the sum for each individual group of column values was not possible. How can I find the total number of records in a table? Answer : You could use the COUNT keyword , example SELECT COUNT(*) FROM emp WHERE age>40 How to get the results of a Query sorted in any order? Answer : You can sort the results and return the sorted results to your program by using ORDER BY keyword thus saving you the pain of carrying out the sorting yourself. The ORDER BY keyword is used for sorting. SELECT empname, age, city FROM emptable ORDER BY empname How could I get distinct entries from a table? Answer : The SELECT statement in conjunction with DISTINCT lets you select a set of distinct values from a table in a database. The values selected from the database table would of course depend on the various conditions that are specified in the SQL query. Example SELECT DISTINCT empname FROM emptable What is save point? Answer : For long transactions that contain many SQL statements, intermediate markers or savepoints can be declared which can be used to divide a transaction into smaller parts. This allows the option of later rolling back all work performed from the current point in the transaction to a declared savepoint within the transaction. What does rollback do? Answer : ROLLBACK retracts any of the changes resulting from the SQL statements in the transaction. What is execution plan? Answer : The combinations of the steps the optimizer chooses to execute a statement is called an execution plan. What is Function of Optimizer? Answer : The goal of the optimizer is to choose the most efficient way to execute a SQL statement.
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. What is Rule-based approach to optimization? Answer : Choosing an executing plan based on the access paths available and the ranks of these access paths. What are OPTIMIZER HINTS ? Answer : Specifies a hint string that Oracle Forms passes on to the RDBMS optimizer when constructing queries. Using the optimizer can improve the performance of database transactions. What is Cost-based approach to optimization? Answer : Considering available access paths and determining the most efficient execution plan based on statistics in the data dictionary for the tables accessed by the statement and their associated clusters and indexes. What is the use of Control File ? Answer : When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery. What is On-line Redo Log? Answer : The On-line Redo Log is a set of tow or more on-line redo files that record all committed changes made to the database. Whenever a transaction is committed, the corresponding redo entries temporarily stores in redo log buffers of the SGA are written to an on-line redo log file by the background process LGWR. The on-line redo log files are used in cyclical fashion. 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. What are the steps involved in Instance Recovery ? Answer : Rolling forward to recover data that has not been recorded in data files, yet has been recorded in the on-line redo log, including the contents of rollback segments. Rolling back transactions that have been explicitly rolled back or have not been committed as indicated by the rollback segments regenerated in step a. Releasing any resources (locks) held by transactions in process at the time of the failure. Resolving any pending distributed transactions undergoing a two-phase commit at the time of the instance failure. What is read line? Answer : READ LINE and READ CURRENT LINE – These statements are used to read data from the lines of existing list levels. These statements are closely connected to the HIDE technique. Explain the Memory Structures of the Oracle database ? Answer : Oracle creates and uses memeory sructures to complete several jobs. For example, memory is used to store program code being executed and data that is shared among users. Several basic memory structures are associated with Oracle; the system global area. ( which includes the database and redolog buffers, and the shared pool ) and the program global areas. a) System global area: The SGA is a shared memory region allocated by Oracle that data and information for one Oracle instance. An SGA and the Oracle backround processes constitute an Oracle Instance. The SGA is allocated when an instance starts and deallocated when the instance shuts down. Each instance that is started has its own SGA. 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. 1. Database Buffer Cache : 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. 2. Redo log buffer: 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: A cursor is a handle ( a name or pointer ) for the memory associated with a specific statement. Although most Oracle Users rely on the automatic handling of the Oracle Utilities, the programmatic interfaces offer application designers more control over cursors. b) Program Global Area: 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 is Log Switch ? Answer : The point at which ORACLE ends writing to one online redo log file and begins writing to another is called a log switch. What is the difference between a SYNONYM and a VIEW ? Answer : A SYNONYM is a name assigned to a table or view that may thereafter be used to refer it. If you access to another user’s table, you may create a synonym for it and refer to it by the synonym alone, without entering the user’s name as a qualifier. Difference: A View can be based on MULTIPLE Tables whereas a SYNONYM is based on a single object only. What is user Account in Oracle database? Answer : 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. What is a Database instance ? Explain Answer : 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.
Define Transaction ? Answer : A Transaction is a logical unit of work that comprises one or more SQL statements executed by a single user. What does COMMIT do ? Answer : COMMIT makes permanent the changes resulting from all SQL statements in the transaction. The changes made by the SQL statements of a transaction become visible to other user sessions transactions that start only after transaction is committed. 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. What is Tablespace Quota ? Answer : The collective amount of disk space available to the objects in a schema on a particular tablespace. What is default tablespace ? Answer : The Tablespace to contain schema objects created without specifying a tablespace name. What is the use of ANALYZE command ? Answer : 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. What are ORACLE PRECOMPILERS ? Answer : Using ORACLE PRECOMPILERS ,SQL statements and PL/SQL blocks can be contained inside 3GL programs written in C,C++,COBOL,PASCAL, FORTRAN,PL/1 AND ADA. The Precompilers are known as Pro*C,Pro*Cobol,… This form of PL/SQL is known as embedded pl/sql,the language in which pl/sql is embedded is known as the host language.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.