Basic to Know in Oracle
Short Description
Download Basic to Know in Oracle...
Description
THINGS TO KNOW IN ORACLE -----------------------------1. Default location for alert logs? a)Normally it is under $ORACLE_HOME/rdbms/logs, OR b)show parameter background_dump_dest (after login sqlplus / as sysdba). [NOTE : $ORACLE_HOME/rdbms/trace for trace files] 2. explain unmount, mount, and open? in nomount-instance is started in mount - database started but datafile inaccessible in open - datafiles put in accessible mode 3.purpose of a pfile/spfile? to allocate system memory to point to control/admin file locations for the database 4. is it possible to change location of admin/control file with database in mount state? it aint possible because changing location requires changing pfile/spfile which have already been used by the time the database gets to MOUNT mode. 5. difference between obsolete and expired backup? EXPIRED: Displays backup sets, proxy copies, and image copies marked in the repository as expired, that is, "not found."To ensure that LIST EXPIRED shows upto-date output, issue a CROSSCHECK command periodically. When you issue a CROSSCHECK command, RMAN searches on disk and tape for the backups and copies recorded in the repository. If it does not find them, then it updates their repository records to status EXPIRED. OBSOLETE: 6. default location for spfile/pfile? $ORACLE_HOME/dbs 7. default location for oracle password file? $ORACLE_HOME/database 8. how do you set the oracle database to use a password file? create an oracle password and you are up and running #orapwd file=PWDdb1.ora password=sys entries=6 9. how do you unset the database recovery area? 10. difference between a trace and an alert file? Each server and background process can write to an associated trace file. When an internal error is detected by a process, it dumps information about the error to its trace file. Some of the information written to a trace file is intended for the database administrator, while other information is for Oracle Support Services. Trace file information is also used to tune applications and instances. The alert file, or alert log, is a special trace file. The alert log of a database is a chronological log of messages and errors. 11. what does the alert file capture? An alert log file stores information about the deadlocks occuring in a database, examples are; *Data Corruption errors, Dead Lock information, Run out of space, Adding new space, Database in backup mode, Command issues to change Database configuration, Database stuck due to archive log directory full, Database startup/shutdown time. 12.what are the key environment variables? ORACLE_HOME and ORACLE_SID ....PATH and ORACLE_BASE 13. how do you start and stop a listener? lsnrctl [start, stop, status] 14.what are the key oracle file?
tnsnames, sqlnet, listener 15.Difference between sqlnet, tnsnames and listener? tnsnames > list of database connection info for client/server, This is a text file contains the information about the oracle databases.For each database, it must contains the db server name, db listener port number, and instance name. sqlnet > communication parameter setup listener > list of databases to listen for on the machine 16.How do i see the pl/sql procedure output? SET SERVEROUTPUT ON; 17.how do i execute a SQL file? @filename.sql 18.how to see who is currently connected? SELECT username, program FROM v$session WHERE username IS NOT NULL; 19.how do i recompile invalid objects? @?/rdbms/admin/utlrp.sql 20.how do i tell which database am in? SELECT name from v$database; OR SELECT instance_name, host_name from v$instance; 21. how do u export and import in oracle? > make sure you run the script $ORACLE_HOME/rdbms/admin/catexp.sql >import and export use IMP/EXP utilities which are both located in $ORACLE_HOME/bin directory > c:\>EXP HELP=Y > c:\>EXP USERID=scott/tiger OWNER=scott FILE=scott.dmp > c:\>IMP USERID=scott/tiger FILE=scott.dmp FULL=Y (which moves the dmp file) 22.how to add different service to one oracle default listener? Just edit the SID_LIST ie; 23.default location of tnsnames, sqlnet and listener? $ORACLE_HOME\network\admin 24.Steps to moving admin and controlfiles? ***************MOVING A CONTRROLFILE -shutdown database -copy controlfile to new location -edit pfile/spfile pointing to new controlfile location -restart instance ***************MOVING ADMIN FILES -you can do the same as for controlfile -OR-Use the ALTER SYSTEM command [ALTER SYSTEM set background_dump_dest='' SCOPE='spfile'] 25.steps to partial movement of log/data files by renaming them? ******************** -shutdown the database -copy logfiles to the desired new location -start the database in mount mode -issue the ALTER DATABASE RENAME FILE '' TO ''; -Open the database -OR-put particular tablespace offline [alter tablespace INDS offline] -use OS to move files to new location -rename files [alter tablespace INDS rename datafile '' to ''; -put tablespace back online [alter tablespace INDS onnline] 26.steps to full movement of log/data files by controlfile recreation? ******************* -backup the controlfile to trace and edit it according to the new desired location
tnsnames, sqlnet, listener 15.Difference between sqlnet, tnsnames and listener? tnsnames > list of database connection info for client/server, This is a text file contains the information about the oracle databases.For each database, it must contains the db server name, db listener port number, and instance name. sqlnet > communication parameter setup listener > list of databases to listen for on the machine 16.How do i see the pl/sql procedure output? SET SERVEROUTPUT ON; 17.how do i execute a SQL file? @filename.sql 18.how to see who is currently connected? SELECT username, program FROM v$session WHERE username IS NOT NULL; 19.how do i recompile invalid objects? @?/rdbms/admin/utlrp.sql 20.how do i tell which database am in? SELECT name from v$database; OR SELECT instance_name, host_name from v$instance; 21. how do u export and import in oracle? > make sure you run the script $ORACLE_HOME/rdbms/admin/catexp.sql >import and export use IMP/EXP utilities which are both located in $ORACLE_HOME/bin directory > c:\>EXP HELP=Y > c:\>EXP USERID=scott/tiger OWNER=scott FILE=scott.dmp > c:\>IMP USERID=scott/tiger FILE=scott.dmp FULL=Y (which moves the dmp file) 22.how to add different service to one oracle default listener? Just edit the SID_LIST ie; 23.default location of tnsnames, sqlnet and listener? $ORACLE_HOME\network\admin 24.Steps to moving admin and controlfiles? ***************MOVING A CONTRROLFILE -shutdown database -copy controlfile to new location -edit pfile/spfile pointing to new controlfile location -restart instance ***************MOVING ADMIN FILES -you can do the same as for controlfile -OR-Use the ALTER SYSTEM command [ALTER SYSTEM set background_dump_dest='' SCOPE='spfile'] 25.steps to partial movement of log/data files by renaming them? ******************** -shutdown the database -copy logfiles to the desired new location -start the database in mount mode -issue the ALTER DATABASE RENAME FILE '' TO ''; -Open the database -OR-put particular tablespace offline [alter tablespace INDS offline] -use OS to move files to new location -rename files [alter tablespace INDS rename datafile '' to ''; -put tablespace back online [alter tablespace INDS onnline] 26.steps to full movement of log/data files by controlfile recreation? ******************* -backup the controlfile to trace and edit it according to the new desired location
-shutdown the database 27.steps to manually create an oracle database? -create directories -create pfile -startup nomount using pfile -run create database script -execute the catproc and catalog scripts -alter database put it in mount and open mode 28.steps to restore rman backup to a different node? -define the directories for the files -connect to NODE 1 using rman and backup database to an accessible location -Move the following files to the NODE 2 (+The database backup pieces, +Controlfile backup piece,+The parameter file i.e init.ora file) -Edit the PFILE on NODE 2 to change the environment specific parameters like.(user_dump_dest=,background_dump_dest=,control_files=) -Once the PFILE is suitably modified invoke Rman on the NODE 2 after setting the Oracle environment variables and start the database in nomount mode: -Restore the controlfile from the backup piece. -Mount the database. RMAN> alter database mount ; -Now catalog the backup pieces that were shipped from NODE 1. RMAN> catalog backuppiece '/home/oracle/test/backup/o1_mf_annnn_TAG20070213T002925_2x21m6ty_.bkp'; -Get to know the last sequence available in the archivelog backup using the following command. RMAN > list backup of archivelog all; -Rename the Redologfiles,so that they can be created in new locations when opened the database is opened in resetlogs. SQL> alter database rename file '/u01/oracle/product/oradata/ora10g/log/redo01.log' to '/home/oracle/test/log/redo01.log';.............. -execute script to restore datafiles to new node and recover RMAN> run { set until sequence set newname for datafile 1 to '/home/oracle/test/data/sys01.dbf'; set newname for datafile 2 to '/home/oracle/test/data/undotbs01.dbf'; set newname for datafile 3 to '/home/oracle/test/data/sysaux01.dbf'; set newname for datafile 4 to '/home/oracle/test/data/users01.dbf'; set newname for datafile 5 to '/home/oracle/test/data/1.dbf'; set newname for datafile 6 to '/home/oracle/test/data/sysaux02.dbf'; set newname for datafile 7 to '/home/oracle/test/data/undotbs02.dbf'; restore database; switch datafile all; recover database; alter database open resetlogs; } 29.steps to creating and running rman backup scripts? 30.steps to manual database cloning with controlfile recreation? -create directories for the database you are to clone -create init file for the clone with pointers to the locations of the new
desired controlfile -backup controlfile of database to clone, edit the backed up controlfile into a script pointing to the location of new datafiles and logfiles. -shutdown database to clone and move the datafiles and redolog files to their desired new location -startup the instance using a created pfile that points to the location of the controlfiles for the clone but startup should be in NOMOUNT mode. -Now execute the controlfile script to create the controlfiles. -open database with a RESETLOGS to avoid errors that may arise as a result of SCN number difference/change. 31.steps to manual database cloning without controlfile recreation? 32.difference between cloned and duplicate database? 33.steps to connect to rman using the catalog/auxilliary? 34.steps to recreating a lost controlfile? 35.why do we use a resetlog option when recreating a controlfile? 36.steps to manually upgrade a database? -connect to database to be upgraded as sysdba -Analyse the database to be upgraded [by executing the script /rdbms/utlu10.sql which is located in oracle_home for new version --sript is executed from the old environment, execute a sql>spool info.log, execute the script utlulu10.sql, turn off spool sql>spool off, read the info.log for information about the database and what needs to be upgraded] -Backup the database to be upgraded while in old environment [sign on to RMAN: rman "target / nocatalog", issue backup command:RUN { ALLOCATE CHANNEL chan_name TYPE DISK; BACKUP DATABASE FORMAT �some_backup_directory%U � TAG before_upgrade; BACKUP CURRENT CONTROLFILE TO �save_controlfile_location �; } ] -shutdown instances -copy configuration files [spfile, password file] from old environment to your new home and then edit the pfiles accordingly] -make sure Oracle services are stopped -set your environment variables to the new release ie [oracle_home, path, oracle_base,Ld_library_path and oracle_sid] -start sqlplus connecting with SYSDBA in your new release environment -startup upgrade with pfile [sql>startup upgrade pfile=''] -create the SYSAUX tablespace - dont forget to specify [CREATE TABLESPACE sysaux DATAFILE '/u01/oradata/sysaux01.dbf' SIZE 700M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;] 'cause if extent management and segment space management are not set, sysaux tablespace cannot be created. -spool upgrade log [sql>spool upgrade.log] -Run the upgrade script[sql>@catupgrd.sql (this determines which upgrade scripts need to be run and then runs eac necessary script, according to your old release, this creates and upgrades data dictionary tables) -Put spool off -Run [sql>@utlu101s.sql TEXT], this specifies the status of the database components in the upgraded database. -shutdown and restart the instance -run [sql>@utlrp.sql], this recompiles any remaining stored PL/SQL and java code and also recompiles any invalid objects. -YOUR DATABASE IS NOW UPGRADED. ***************In case you need recovery -sign on to RMAN [rman "target / nocatalog"] -issue the recovery command
STARTUP NOMOUNT RUN { REPLICATE CONTROLFILE FROM �save_controlfile_location �; ALTER DATABASE MOUNT; RESTORE DATABASE FROM TAG before_upgrade ALTER DATABASE OPEN RESETLOGS; } ************************************************* 37.explain steps for database backup and recovery using the O.S? 38.explain steps for database backup and recovery using RMAN? 39.what do u do incase of a mssing lib in oracle? copy it to the directory where it's required and then execute [RELINK] $ORACLE_HOME/bin/relink all OR bin# ./relink all 40.Explain differences between a hot backup and a cold/closed backup and the benefits of 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. 41.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. 42.what is an oracle instance? 43.Describe what redo logs are & their advantage? Redo logs are logical and physical structures that are designed to hold all the changes made to a database and are intended to aid in the recovery of a database. 44.what are the background processes in oracle? 44.why set db_block size to 8192? 8192 size is the default size but not the most recommended, because it has to be bigger when it comes to dataware houses. 45. what are the default ports? for oracle net listener and em repository port:1521/1526 [commonly used listener ports: 1522-1540] for em: oracle names server:1575 oracle connection manager:1630 http server listen port:80 EM Agent port:1831 EM reporting port:3339 iSQL plus: 5560/5580 46.how do you start? em > emctl start dbconsole isqlplus>isqlplus ctl [start/stop] 47.what is the difference between NoMOUNT, MOUNT, OPEN?
IN NOMOUNT> instant starts but doesnt utilise the controlfile yet IN MOUNT>control file is in use but datafiles are not open IN OPEN>datafiles can be accessed 48.What �s the benefit of �dbms_stats � over �analyze �? 49.41. How would you configure your networking files to connect to a database by the name of DSS which resides in domain icallinc.com? 50.Explain the concept of the DUAL table? A single row table provided by oracle for selecting values and expressions. 51.What are the ways tablespaces can be managed and how do they differ? 52.From the database level, how can you tell under which time zone a database is operating? select DBTIMEZONE from dual; 53.How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example? 54.You have found corruption in a tablespace that contains static tables that are part of a database that is in NOARCHIVE log mode. How would you restore the tablespace without losing new data in the other tablespaces? 55.Typically, where is the conventional directory structure chosen for Oracle binaries to reside? 56.Explain undo retention? 57.How does Oracle guarantee data integrity of data changes? 58.Which environment variables are absolutely critical in order to run the OUI? 59.Explain how you would restore a database using RMAN to Point in Time? 60.Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracle �s. What database recovery options are available? Database is in archive log mode? 61.What query tells you how much space a tablespace named �test � is taking up, and how much space is remaining? SQL>select sum(bytes/(1024*1024)) mb from dba_free_space where tablespace_name='TEST' 62.Which dictionary tables and/or views would you look at to diagnose a locking issue? 63.What is theh difference between an spfile and a pfile? 63.would an oracle instance start incase you lost the controlfile? Yes it would but database wouldnt open because controlfile points to location of the physical files. 64.Explain the use of setting GLOBAL_NAMES equal to TRUE. Setting GLOBAL_NAMES dictates how you might connect to a database. This variable is either TRUE or FALSE and if it is set to TRUE it enforces database links to have the same name as the remote database to which they are linking. 65. What command would you use to encrypt a PL/SQL application? WRAP 66.Explain the difference between a FUNCTION, PROCEDURE and PACKAGE. A function and procedure are the same in that they are intended to be a collection of PL/SQL code that carries a single task. While a procedure does not have to return any values to the calling application, a function will return a single value. A package on the other hand is a collection of functions and procedures that are grouped together based on their commonality to a business function or application. 67.Name three advisory statistics you can collect. Buffer Cache Advice, Segment Level Statistics, & Timed Statistics 68.Where in the Oracle directory tree structure are audit traces placed by default? In unix $ORACLE_HOME/rdbms/audit, in Windows the event viewer 69.Explain materialized views and how they are used. Materialized views are objects that are reduced sets of information that have been summarized, grouped, or aggregated from base tables. They are typically used in
data warehouse or decision support systems. 70.When a user process fails, what background process cleans up after it? PMON 71.What background process refreshes materialized views? The Job Queue Processes. 72.How would you determine what sessions are connected and what resources they are waiting for? Use of V$SESSION and V$SESSION_WAIT 73.How would you force a log switch? ALTER SYSTEM SWITCH LOGFILE; 74.Give two methods you could use to determine what DDL changes have been made. You could use Logminer or Streams 75.Explain steps in configuring your database for auditing? 76.What does coalescing a tablespace do? Coalescing is only valid for dictionary-managed tablespaces and de-fragments space by combining neighboring free extents into large single extents. 77.Name a tablespace automatically created when you create a database. The SYSTEM tablespace. 78.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. 79.How do you add a data file to a tablespace? ALTER TABLESPACE ADD DATAFILE SIZE 80.How do you resize a data file? ALTER DATABASE DATAFILE RESIZE ; 81.What view would you use to look at the size of a data file? DBA_DATA_FILES 82.What view would you use to determine free space in a tablespace? DBA_FREE_SPACE 83.How would you determine who has added a row to a table? Turn on fine grain auditing for the table. 84. Explain steps to setting a database for fine grain auditing? 85.How can you rebuild an index? ALTER INDEX REBUILD; 86.Explain what partitioning is and what its benefit is. Partitioning is a method of taking large tables and indexes and splitting them into smaller, more manageable pieces. 87.You have just compiled a PL/SQL package but got errors, how would you view the errors? SHOW ERRORS
88.How can you gather statistics on a table? The ANALYZE command. 89.How can you enable a trace for a session? Use the DBMS_SESSION.SET_SQL_TRACE or Use ALTER SESSION SET SQL_TRACE = TRUE; 90.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. 91.Name two files used for network connection to a database. TNSNAMES.ORA and SQLNET.ORA Technical - UNIX 92.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 retrieval than after retrieving the data. 93.What is the difference between TRUNCATE and DELETE? The delete command will log the data changes in the log file where as the truncate will simply remove the data without it. Hence data removed by DELETE command can be rolled back but not the data removed by TRUNCATE. Truncate is a DDL statement whereas DELETE is a DML statement. 94. What is user Account in Oracle database? A 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. 95. 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. 96. What are the dictionary tables used to monitor a database space? DBA_FREE_SPACE DBA_SEGMENTS DBA_DATA_FILES. 97. What is OCI. What are its uses? OCI is Oracle Call Interface. When applications developers demand the most powerful interface to the Oracle Database Server, they call upon the Oracle Call Interface(OCI). OCI provides the most comprehensive access to all the Oracle Database functionality. The newest performance, scalability and security features appear first in the OCI API. If you write applications for the Oracle Database, you likely already depend on OCI. Some types of applications that depend upon OCI
ar (PL/SQL apps executing SQL, C++ apps using OCCI, Java Apps using OCI-based JDBC driver, C Apps using ODBC driver, Pro*C apps, distributed SQL, VB apps using OLEDB driver) 98. What is Multi Node System? Multi node system in oracle Applications 11i means you have Applications 11i component on more than one system. Typical example is database, concurrent Manager on one machine and forms, webserver on second machine is example of two node system. 99.What is a pseudo column. Give examples? information such as row numbers and row descriptions ae automatically stored by oracle and is directly accessible i.e not through tables. This information is contained within pseudo columns. These pseudo columns can be retrieved in queries. These pseudo columns can be included in queries within select data from tables.[A pseudocolumn behaves like a table column, but is not actually stored in the table. You can select from pseudocolumns, but you cannot insert, update, or delete their values.] Availables pseudo columns are ROWNUM - order number in which a row values is retrieved ROWID-physical row(memory or disk address) location i.e the unique row identification, SYSDATE-system or today's date, UID - user identification number indicating the current user, USER - name of current logged in user. 100. What is TWO_TASK in oracle Database? TWO_TASK mocks your tns alias which you are going to use to connect to database. Lets assume you ave database client with tns alias defined as PROD to connect to database PROD on machine teachmeoracle.com listening on port 1521. The usual way to connect is sqlplus username/passwd@PROD; now if you dont want to use @PROD then you set TWO_TASK=PROD and then can simply use sqlplus username/passwd then sql will check that it has to connect to tnsalias define by value PROD i.e TWO_TASK. 101. What is the difference between unique and primary key? A unique key can have null whereas primary key is always not null. both bear unique names. 102.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. 103.What are disadvantages of having raw devices ? We should depend on export/import utility for backup/recovery (fully reliable) The tar command cannot be used for physical file backup, instead we can use dd command which is less flexible and has limited recoveries. 104.What is the use of INCTYPE option in EXP command ? Type export should be performed COMPLETE,CUMULATIVE,INCREMENTAL. List the sequence of events when a large transaction that exceeds beyond its optimal value when an entry wraps and causes the rollback segment toexpand into anotion Completes. e. will be written. 105.What is the use of FILE option in IMP command ? The name of the file from which import should be performed. 106.What is a Shared SQL pool? The data dictionary cache is stored in an area in SGA called the Shared SQL Pool. This will allow sharing of parsed SQL statements among concurrent users. 107.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. 108.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. 109.What is advantage of having disk shadowing/ Mirroring ? Shadow set of disks save as a backup in the event of disk failure. In most Operating System if any disk failure occurs it automatically switchover to place of failed disk. Improved performance because most OS support volume shadowing can direct file I/O request to use the shadow set of files instead of the main set of files. This reduces I/O load on the main set of disks. 110.How will you force database to use particular rollback segment ? SET TRANSACTION USE ROLLBACK SEGMENT rbs_name. 111.Why query fails sometimes ? Rollback segment dynamically extent to handle larger transactions entry loads. A single transaction may wipeout all available free space in the Rollback Segment Tablespace. This prevents other user using Rollback segments. 112.What is the use of RECORD LENGTH option in EXP command ? Record length in bytes. 113.How will you monitor rollback segment status ? Querying the DBA_ROLLBACK_SEGS view IN USE - Rollback Segment is on-line. AVAILABLE - Rollback Segment available but not on-line. OFF-LINE - Rollback Segment off-line INVALID - Rollback Segment Dropped. NEEDS RECOVERY - Contains data but need recovery or corupted. PARTLY AVAILABLE - Contains data from an unresolved transaction involving a distributed database. 114.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. 115.Which parameter in Storage clause will reduce no. of rows per block? PCTFREE parameter Row size also reduces no of rows per block. 116.What is meant by recursive hints ? Number of times processes repeatedly query the dictionary table is called recursive hints. It is due to the data dictionary cache is too small. By increasing the SHARED_POOL_SIZE parameter we can optimize the size of Data Dictionary Cache. 117.What is the use of PARFILE option in EXP command ? Name of the parameter file to be passed for export. 118.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.ora for each instance) semmni = number of instances running simultaneously; semmsl = semmns 119.What is a logical backup? Logical backup involves reading a set of database records and writing them into a file. Export utility is used for taking backup and Import utility is used to recover from backup. 120.What is a Rollback segment entry ? It is the set of before image data blocks that contain rows that are modified by a transaction. Each Rollback Segment entry must be completed within one rollback segment. A single rollback segment can have multiple rollback segment entries. 121.What database events can be set? (for DBA) The following events are frequently used by DBAs and Oracle Support to diagnose problems: " 10046 trace name context forever, level 4 Trace SQL statements and show bind variables in trace output. " 10046 trace name context forever, level 8 This shows wait events in the SQL trace files " 10046 trace name context forever, level 12 This shows both bind variable names and wait events in the SQL trace files " 1401 trace name errorstack, level 12 1401 trace name errorstack, level 4 1401 trace name processstate Dumps out trace information if an ORA-1401 "inserted value too large for column" error occurs. The 1401 can be replaced by any other Oracle Server error code that you want to trace. " 60 trace name errorstack level 10 Show where in the code Oracle gets a deadlock (ORA-60), and may help to diagnose the problem. The following lists of events are examples only. They might be version specific, so please call Oracle before using them: " 10210 trace name context forever, level 10 10211 trace name context forever, level 10 10231 trace name context forever, level 10 These events prevent database block corruptions " 10049 trace name context forever, level 2 Memory protect cursor " 10210 trace name context forever, level 2 Data block check " 10211 trace name context forever, level 2 Index block check " 10235 trace name context forever, level 1 Memory heap check " 10262 trace name context forever, level 300 Allow 300 bytes memory leak for connections Note: You can use the Unix oerr command to get the description of an event. On Unix, you can type "oerr ora 10053" from the command prompt to get event details. 122.What are the different kind of export backups? Full back - Complete database Incremental - Only affected tables from last incremental date/full backup date. Cumulative backup - Only affected table from the last cumulative date/full backup date. 123.How does Space allocation table place within a block ? Each block contains entries as follows Fixed block header Variable block header Row Header,row date (multiple rows may exists) PCTEREE (% of free space for row updation in future) 124.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 DATWhat is dictionary cache ? Dictionary cache is information about the databse objects stored in a data dictionary table.ABASE. 125.What is dictionary cache ? Dictionary cache is information about the databse objects stored in a data dictionary table. 126.What is Database Buffers ? Database buffers are cache in the SGA used to hold the data blocks that are read from the data segments in the database such as tables, indexes and clusters DB_BLOCK_BUFFERS parameter in INIT.ORA decides the size. 127.What is a Control file ? Database overall physical architecture is maintained in a file called control file. It will be used to maintain internal consistency and guide recovery operations. Multiple copies of control files are advisable. 128.How will you create multiple rollback segments in a database ? Create a database which implicitly creates a SYSTEM Rollback Segment in a SYSTEM tablespace. Create a Second Rollback Segment name R0 in the SYSTEM tablespace. Make new rollback segment available (After shutdown, modify init.ora file and Start database) Create other tablespaces (RBS) for rollback segments. Deactivate Rollback Segment R0 and activate the newly created rollback segments. 130.What is cold backup? What are the elements of it? Cold backup is taking backup of all physical files after normal shutdown of database. We need to take. - All Data files. - All Control files. - All on-line redo log files. - The init.ora file (Optional) 131.What is meant by redo log buffer ? Changes made to entries are written to the on-line redo log files. So that they can be used in roll forward operations during database recoveries. Before writing them into the redo log files, they will first brought to redo log buffers in SGA and LGWR will write into files frequently. LOG_BUFFER parameter will decide the size. 132.How will you monitor the space allocation ? By querying DBA_SEGMENT table/view. 133.What is meant by free extent ? A free extent is a collection of continuous free blocks in tablespace. When a segment is dropped its extents are reallocated and are marked as free. 134.What are the different methods of backing up oracle database ? - Logical Backups - Cold Backups - Hot Backups (Archive log) 135.The database instance crashed because of power failure. The database files are not affected by the crash. Which files will be used for the instance recovery at the next database instance startup? (Choose all that apply) Data files Control file Redo log files 136.The database instance is started using SPFILE and the database is in MOUNT state. Which two operations can you perform in the MOUNT state of the database? (Choose two) Renaming the data files Configuring the database in the ARCHIVELOG mode AND NEVER NEVER Creating new tablespace, Adding the database user 137.Which two statements are true about the Flashback technology? (Choose two)
The restoration of files is not required for accomplishing the recovery. The unsolicited or wrongly committed transactions can be recovered. AND NEVER NEVER The accidental loss of schema can be recovered, The accidental loss of tablespace can be recovered. 138. Which statement is true for the database configured in the ARCHIVELOG mode? You can take backup of the database without shutting down the database. AND NEVER NEVER Archiving information is written to the data files and redo log files, Flash recovery area must be used to store the archived redo log files,The online redo log files must be multiplexed before putting the database in the ARCHIVELOG mode. 139.The abnormal termination of the database background process causes the database instance to shut down without synchronizing the database files. Arrange the steps required for instance recovery? i) SMON applies redo to the database ii) The database opens iii)Uncommitted transactions are rolled back by SMON NB:Perform recovery manually AND SMON reads the archived redo log files and online redo log files are not required. 140.The database is running and users are connected to the database instance using the LSNR1 listener. You observe that LSNR1 has stopped. Which two statements are true in this situation? (Choose all that apply) -New connections are not allowed and -The connected sessions are not affected 141.UNDO_RETENTION is set to 900 in your database, but undo retention guarantee is not enabled. Which statement is true in this scenario? Undo data is overwritten if no space is available for the new undo data AND NEVER NEVER Undo data is retained even if no space is available and new undo generated is stored in the temporary tablespace, Undo data becomes obsolete if a long-running transaction takes more time than that specified by UNDO_RETENTION, All undo data is purged if no space is available to accommodate new undo generated 142.What is a 2 Phase Commit? Two Phase commit is used in distributed data base systems. This is useful to maintain the integrity of the database so that all the users see the same values. It contains DML statements or Remote Procedural calls that reference a remote object. There are basically 2 phases in a 2 phase commit. a) Prepare Phase : Global coordinator asks participants to prepare b) Commit Phase : Commit all participants to coordinator to Prepared, Read only or abort Reply 143.What are mutating tables? When a table is in state of transition it is said to be mutating. eg : If a row has been deleted then the table is said to be mutating and no operations can be done on the table except select. 144.Can U disable database trigger? How? Yes. With respect to table ALTER TABLE TABLE [[ DISABLE all_trigger ]] 145.How many columns can table have? The number of columns in a table can range from 1 to 254. 146.Is space acquired in blocks or extents ? In extents . 147.What are attributes of cursor? %FOUND , %NOTFOUND , %ISOPEN,%ROWCOUNT 148.What are the various types of Exceptions ? User defined and Predefined Exceptions. 149.Can we define exceptions twice in same block ? No. 150.Can you have two functions with the same name in a PL/SQL block ? Yes.
151.Can you have two stored functions with the same name ? Yes. 152.What are the various types of parameter modes in a procedure ? IN, OUT AND INOUT. 153.What is Over Loading and what are its restrictions ? OverLoading means an object performing different functions depending upon the no. of parameters or the data type of the parameters passed to it. 154.Can functions be overloaded ? Yes. 155.Can two functions have same name & input parameters but differ only by return datatype No. 156.What are the constructs of a procedure, function or a package ? The constructs of a procedure, function or a package are : variables and constants cursors exceptions 157.Why Create or Replace and not Drop and recreate procedures ? So that Grants are not dropped. 158.Can you pass parameters in packages ? How ? Yes. You can pass parameters to procedures or functions in a package. 159.What are the parts of a database trigger ? The parts of a trigger are: A triggering event or statement A trigger restriction A trigger action 160.What are the various types of database triggers ? There are 12 types of triggers, they are combination of : Insert, Delete and Update Triggers. Before and After Triggers. Row and Statement Triggers. (3*2*2=12) 161.What is the advantage of a stored procedure over a database trigger ? We have control over the firing of a stored procedure but we have no control over the firing of a trigger. 162.What is the maximum no. of statements that can be specified in a trigger statement? One. 163.Can views be specified in a trigger statement ? No 164.What are the values of :new and :old in Insert/Delete/Update Triggers ? INSERT : new = new value, old = NULL DELETE : new = NULL, old = old value UPDATE : new = new value, old = old value 165.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. 166.What are mutating triggers ? A trigger giving a SELECT on the table on which the trigger is written. 167.Describe Oracle database's physical and logical structure ? Physical : Data files, Redo Log files, Control file. Logical : Tables, Views, Tablespaces, etc. 168.Can you increase the size of a tablespace ? How ? Yes, by adding datafiles to it. 169.What are constraining triggers ? A trigger giving an Insert/Updat e on a table having referential integrity constraint on the triggering table.
170.What is the use of Control files ? Contains pointers to locations of various data files, redo log files, etc. 171.What is the use of Data Dictionary ? Used by Oracle to store information about various physical and logical Oracle structures e.g. Tables, Tablespaces, datafiles, et 172.What are the disadvantages of clusters ? The time for Insert increases. 173.What are the advantages of clusters ? Access time reduced for joins. 174.What are the min. extents allocated to a rollback extent ? Two 175.An insert statement followed by a create table statement followed by rollback ? Will the rows be inserted ? No. 176.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. 177.What is the significance of the & and && operators in PL SQL ? The & operator means that the PL SQL block requires user input for a variable. The && operator means that the value of this variable should be the same as inputted by the user previously for this same variable. If a transaction is very large, and the rollback segment is not able to hold the rollback information, then will the transaction span across different rollback segments or will it terminate ? It will terminate (Please check ). 178.Can you pass a parameter to a cursor ? Explicit cursors can take parameters, as the example below shows. A cursor parameter can appear in a query wherever a constant can appear. CURSOR c1 (median IN NUMBER) IS SELECT job, ename FROM emp WHERE sal > median; 179.What are the various types of RollBack Segments ? Public Available to all instances Private Available to specific instance 180.Can you use %RowCount as a parameter to a cursor ? Yes 181.What is Optimal Flexible Architecture? A directory structure. It is a standard or a set of configuration guidelines created to ensure fast and reliable oracle databases that require little maintenance. The main purposes thereof are -organising large amounts of complicated software and data on disk to prevent hardware bottlenecks and poor performance, facilitating routine administrative tasks that are highly vvulnerable to data corruption, facilitating switching between databases, managing the database growth, avoiding fragmentation of free space in the data dictionary, minimizing resource contention. In short oracle has designed the OFA as a file system directory structure that helps in maintaining multiple versions of multiple oracle products. 182. Which other protocols can oracle Net in 11g use? In release 11g Oracle's network support is limited to TCP, TCP with secure socket,the newer Sockets Direct Protocol SDP and Windows Named Pipes(or WNP) 183.Explain is ORACLE NET Oracle Net is a software component that enables connectivity between two oracle networks. It can also be defined as a suite of networking components that provide enterprise-wide connectivity solutions in distributed and heterogeneous computing environments. Oracle Net Services consists of -Oracle Net, Listener, Oracle Connection Manager, Oracle Net configuration Assistant, Oracle Net Manager. 184. Explain DBUA?
Database Upgrade Assistant is a GUI tool used to upgrade an existing database. Oracle recommends using DBUA while upgrading a database and DBCA while creating a database. 185. Explain DBCA? Database Configuration Assistant is a GUI-based oracle tool, which can run as part of OUI or as a standalone application and is used to create, configure, manage and delete a database. DBCA runs during database installation when the create a database option is selected. The DBCA utility is able to examine database settings. It is also optionally used to export the current data of a database. DBCA stores templates in a file with a .dbc extension, variables such as ORACLE_BASE and DB_NAME allow DBCA to install files into an appropriate directory for an oracle installation. While exporting data from the database, DBCA creates a zip file having extension .dfj, which consists of raw images of each data file. These images are automatically written directly to disk instead of using SQL statements. Therefore, it is appropriate to use .dfj files for database creation, and not as a backup. 186. Explain OEM? Oracle Enterprise Manager is a graphical system management tool that is used to manage components of Oracle and administer databases. OEM comprises a graphical console, management server, Oracle Intelligent Agent, repository database, and tools to provide an intergrated and comprehensive system management platform for managing oracle products. Tools intergrated with OEM can be used to examine the performance of an Oracle database and tune the database accordingly. 187.Scenario: you work as a DBA for Infotech Inc. The company used Oracle as its database. You have opened the database to perform update. Which files if lost can cause the database to crash? Datafile from the SYSTEM tablespace and controlfile. Remember - if any of the control files and a datafile from the SYSTEM tablespace is missing, the instance will immediately abort reason being that these files are responsible for a database to remain in the MOUNT mode. AND NEVER NEVER archivelog file or datafile from SYSAUX reason being the instance can take the datafile from the SYSAUX tablespace offline automatically, and therefore is capable to remain open even if it is lost. and also if anything happened to an archived log file, it cannot have any effect on the instance. 188.Why do you have to open the database with RESETLOGS after recreating a controlfile? 189.which views are available in NOMOUNT mode? It's the V$INSTANCE and V$SESSION AND NEVER NEVER and view prefixed with DBA_ are the data dictionary views which are only seen in OPEN mode and also YOU CAN NEVER find V$DATABASE and V$DATAFILE because V$_ views are dynamic views that are populated from the control file and therefore are only available in mount mode or Open mode 190.Explain parameters? USER_DUMP_DEST- an init parameter that specifies the destination in which the use processes inclusinve of background and foreground processes will write trace files. BACKGROUND_DUMP_DEST - specifies location for trace files of background processes to be written and also location for the alert.log file DB_CREATE_FILE_DEST- parameter to specify the default location for Oracle managed datafiles with properties [parameter type:string, syntax:DB_CREATE_FILE_DEST=directory|disk group, default value: No default value, Modifiable:ALTER SESSION, ALTER SYSTEM], if DB_CREATE_ONLINE_LOG_DEST_n init parameter is not specified then DB_CREATE_FILE_DEST is considered as the default location for oracle managed control files and online redo logs. REMEMBER: there is no such parameter as background_trace_dest 191. Give types of segments? Table, Data dictionary,index, cluster 192.Explain the concept of segments, datablock, extent?
SEGMENT: is a set of extents allocated for a specific database object such as mentioned above, each time a database object is created, oracle allocates a segment to it, this segment contains atleast one extent that intun contains atleast one block. A single segment holds all the data of the corresponding database object. A segment can belong to only one tablespace, but can be associated to multiple datafiles. Extents allocated to a segment can belong to multiple datafiles but datablocks allocated to an extent can belong to only one datafile. 193.which command is used to exit from the Listener command utility without saving changes to the listener.ora file? The QUIT command 194.Explain the Listener utility? The LSNRCTL utility enables a database administrator to manage one or more listeners. It cannot be used to create or configure listeners. It only proides commands to control various listener functions listener functions such as starting, stopping and getting status of listeners plus also changing parameter settings in the listener.ora file START-starts a listener STOP-stops a listener STATUS-sees status of a listener SERVICES-checks services offered by the listener VERSION-shows version of a listener RELOAD-forces a listener to re-read its entry in listener.ora file SAVE_CONFIG-used to write any changes made online to the listener TRACE-enables tracing of a listener's activity CHANGE_PASSWORD-sets password for a listener's administration EXIT-used to exit from the tool and save changes to the listener.ora file QUIT-used to exit the tool without saving changes made to the listener.ora file SET-used to set various options such as tracing and timeouts SHOW-used to show options that have been set for a listener SERVICE and STATUS commands are used to see the status of a listener. REMEMBER - ABORT is not a listener command 195.Explain the Data pump utility and the files belonging to it? Data pump is a new feature introduced in Oracle 10g to moev data between databases and to or from operating system files very efficiently. It provides parallel import and export utilities(impdb, expdp) on the command-line as well as the web-based oracle enterprise manager export/import interface. It is ideally beneficial for large databases and data waehousing environments. Oracle data pump facility runs on the server. some of the functions performed by oracle data pump are; - it is used to copy data from one schema to another between two databases or within a single database and also it can be used to extract a logical copy of the entire database, a list of tablespaces and a list of schemas or a list of tables. Types of files managed by the data pump are; -dump files:containing the data and metadata that is being moved, Log files:these record messages associated with an operation, SQL files:these record the output of a SQLFILE operation. a SQLFILE operation is invoked using the Data pump import SQLFILE parameter and results in all of the SQL DDL that import wil be executing based on other parameters, being writtent o a SQL file. The Data pupm utility uses the export parameter CONTENT to filter the exported objects such as data, metedata or both. 196.Explain SQL*Loader? 197.When the SGA_TARGET is set to a non-zero value, apart from shared pool, buffer cache and Large pool which other memory structures are cconfigured as part of the Automatic Shared Memory Management feature in oracle? It is the Java pool and Streams pool, because if SGA is specified then the memory pools that are automatically sized are Buffer cache(DB_CACHE_SIZE), share
pool(SHARED_POOL_SIZE), large pool(LARGE_POOL_SIZE), java pool(JAVA_POOL_SIZE), streams pool(STREAMS_POOL_SIZE) NOTE: Streams pool is an optional SGA structure 198.Explain the flash_recovery_area? The flash recovery area is a specific location on disk that stores and manages files for backup and recovery purposes. It is an automatic feature available in Oracle 10g. Oracle Managed Files(OMF) configures the flash recovery area and utilises the disk resources managed by Automatic Storage Management(ASM). RMAN performs the task of automatic cleaning up. The flash recovery area acts as a cache area for the backup components that are to be copied to the tape. The flash recovery area contains the following database file: Control files, archive log files, flashback logs, control file and SPFILE auto-backups, and datafile image copies. It is necessary to configure the flash recovery area when the database is set up for the very first time. 199.When database is in noarchielog mode and you used RMAN to take backup. which types of backups are possible? Only closed and Incremental backups INCREMENTAL BACKUP is an RMAN backup in which only data blocks that were modified since the last incremental backup are backed up. Incremental backup are classified by levels. The baseline backup for an incremental backup is a level 0 incremental backup. A level 0 incremental backup, like a full backup, backs up all data blocks that have ever been used. However, a full backup cannot be used as the baseline backup for subsequent incremental backups. Incremental backups at levels greater than 0 back up only data blocks modified since the last incremental backup. Forexample, a level 1 incremental backup will only backup only those data blocks that have changed since the level 0 incremental backup. furthermore, a level 2 incremental backup will back up only those data blocks that have changed since teh level 1 incremental backup. Incremental backups are quicker, and they occupy less space because they do not contain all data blocks. Incremental backups can be applied to the baseline backup, wen required to form a complete backup. A closed backup is a backup of one or more database files, which is taken while the database is closed. Usually, a closed backup is also a whole database backup(a backup of the control file and all datafiles of the database). A closed backup can be either consistent or inconsistent, A backup of a closed database that was cleanly sutdown(NORMAL, IMMEDIATE, TRANSACTIONAL) is a closed consistent backup. On the other hand, if a database is shutdown using the ABORT command or the associated instance terminates abnormally before the backup is taken, the backup will be a closed inconsistent backup. A closed backup is also called a cold backp and is the only type of backup that can be taken for a database running in NOARCHIVELOG mode. NOTE: that an open or online backup is one done while the datafiles are open and is always an inconsistent one that requires recovery(application of redo data) before it can be made consistent. 200.which files are created by default at database create command even if not specified? -control file, online redo log files, SYSAUX tablespace datafile and SYSTEM tablespace datafile. 201.Explain Normalisation? NOTE: Many-to-many is cardinality that is avoided in the normalisation technique 202.Which background process is used to write dirty blocks to disk? DBWn (it doesnt change) 203.How long does it take for MMON to gather a snapshot and launch the ADDM? 60 minutes. 204.Which view shows all the tables in a database? it is the DBA_TABLE AND NEVER NEVER user_tables, all_tables, dba_views 205.what is an aggregate function?
206.How do you convert a date to a string? To_char. A bonus would be that they always include a format mask. 207.Describe the block structure of PLSQL? Declaration, Begin, exception, end. 208.What is an anonymous block? Unnamed PL/SQL block. 209.Why would you choose to use a package versus straight procedures and functions? I look for maintenance, grouping logical functionality, dependency management, etc. I want to believe that they believe using packages is a �good thing�. 210.Explain what happens when you issue a commit command? 211.Your developers asked you to create an index on the PROD_ID column of the SALES_HISTORY table, which has 100million rows. The table has approximately 2 million rows of new data loaded on the first day of every mont. For the remainder of the month, the table is only queried. Most reports are generated according to the PROD_ID, which has 96 distinct values. Which type of index would be appropriate? 212.You examine the alert log file and notice that errors are being generated from an SQL*Plus session. Which files are best for providing you with more information about the nature of the problem? 213.Users pward and psmith have left the company. You nolonger want them to have access to the database. You need to make sure that the objects they created in the database remain. What do you need to do? 214.which two actions cause a log switch? 215.which facts do you know about a shared pool? 216.You need to create an index on the PASSPORT_RECORDS table. It contains 10 million rows of data. The key columns have low cardinality. The queries generated against this table use a combination of multiple WHERE conditions involving the OR operator. Which type of index would be best for this type of table? 217.Explain the concept of locally managed tablespace? 218.You decided to use multiple buffer pools in the database buffer cache of your database, You set the sizes of the buffer pools with the DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE parameters and restarted your instance. What else must you do to enable the use of the buffer pools? 219.How do you create a hierarchical query? By using a CONNECT BY. 220.How would you generate XML from a query? The answer here is �A lot of different ways �. They should know that there are SQL functions: XMLELEMENT, XMLFOREST, etc and PL/SQL functions: DBMS_XMLGEN, DBMS_XMLQUERY, etc. 221.How can you tell if a SELECT returned no rows? By uisng the NO_DATA_FOUND exception. 222.What is an autonomous transaction? Identified by pragma autonomous. A child transaction separate from the parent that MUST be committed or rolled back. 223.The DBA has decreased LOG_CHECKPOINT_INTERVAL to 6000 and changed LOG_CECKPOINT_TIMEOUT from 0 to 5. What best identifies the impact of these settings on the oracle database? 224.which SQL*loader parameters enables you to load a specified number of records stored in the data file? 225.You are attempting to create a robust backup and recovery strategy using Oracle Enterprise Manager 2.0. which two tools allow you to start and stop the Oracle Instance? 226.What are the things that Oracle 10g improved against 9i and also that 11g
improved against 10g? Oracle 9i didnt have recovery_file_dest so had no flash recoevry area, no SYSAUX tablespace in 9i which is important for recovery. 227.Which roles must be granted to the recovery catalog owner in order for RMAN to work properly when you create a recovery catalog for a production database? 228.Explain rman commands? How you connect to an auxilliary and catalog database? sql>rman connect target sys/pwd@db1 CATALOG rman/pwd@catdb sql>rman connect target sys/pwd@db1 AUXILLIARY sys/pwd@auxdb 229.You are backing up an oracle database on the UNIX platform while the database is still open. Before issuing the tar command, which of statements should be issued? 230.You are evaluating the complexity of an existing recovery strategy in your organisation. Offline backups on OARCHIVELOG mode databases offer which of the following benefits over offline backups on ARCHIVELOG databases? 231.when a DBA attempts to backup the oracle database control file. after issuing the ALTER DATABASE BACKUP CONTROLFILE TO TRACE command, where can the DBA find the backup control file creation materials Oracle created for him? 232.You are trying to determine the status of a database backup. In order to determine the data files involved in the backup, which queries are appropriate? SELECT file# from V$BACKUP where STATUS='ACTIVE'; this lists files being backed up(in backup progress) 233.You are attempting to identify synchronisation between files on a mounted database that was just backed up. Which dictionary view may offer assistance in this task? 234.which background process does an oracle database use to ensure the detection of the need for database recovery by checking for synchronisation? 235.Explain base tables? A table used to define a view 236.Explain the concept of a large pool? The large pool is created to avoid contention in the shared pool in the cae of shard server environment. The UGA process takes place in the shared pool in the case of shared server environment so to avoid contentions all the user processes are shifted 237.The DBA is configuring use of RMAN with a recovery catalog. When using a recovery catalog in conjuction with RMAN, where can be the actual backup copies of database information found? 238.The DBA is assessing maintenance of recovery catalog creation. Once created, where does the recovery catalog draw much of its information from when maintenance is performed on it? [options:production database file, recovery catalog control file, production database control file, archived redo logs] 239.The DBA is configuring RMAN for use as the backup/recovery tool for the oracle database. After creating the production database and the recovery catalog, which command is used for establishing the baseline information required in the recovery catalog for proper RMAN usage? [options:RESET, REGISTER, RESYNC, REPORT] 240.The DBA has shutdown the database and made copies of all datafiles manually as a benchmark backup for stress testing. Which of the following RMAN commands will make that backup usable in the context of the rest of the contents of the recovery catalog? [options:RESYNC, CATALOG, REPORT, LIST] 241.The DBA needs to identify available backups for the sys03.dbf datafile belonging to the SYSTEM tablespace. Which command would be most appropriate for this process? 242.The DBA is developing scripts in RMAN. In order to store but not process commands in a scipt in RMAN for database backup, which of the following command choices are appropriate?
[options:RUN{..}, EXECUTE SCRIPT{...}, CREATE SCRIPT{...}, ALLOCATE CHANNEL{...}] 243.The DBA is developing a script for backups that will ensure that no block corruption is permitted in a datafile. Which of the following commands is appropriate for that script? [options:SET MAXCORRUPT 0, SET DBVERIFY ON, SET LOG_BLOCK_CHECKSUM ON] 244.Explain the trade-off a DBA makes when considering dropping and re-creating indexes using the NOLOGGING vs LOGGING? 245.What are the factors that would significantly contribute to a rapid recovery time when backing up an ARCHIVELOG database? [options: (frequency of backups, size of datafiles & I/O speed),(available memory, I/O speed and size of datafiles),(available memory),(number of multiplexed control files)] 246.The DBA has just finished making OS copies of dtafiles for the backup. Which of the following choices identifies how the DBA should complete the backup? Take tablespaces out of backup mode, backup control file to trace, witch online redo logs (OR THE REVERSE) 247.which priviledge has to be given to users to select data dictionary? sql>grant select_catalog_role to user; 248.Difference between TEST/DEV/PROD oracle databases? 249.Why is the instance started in NOMOUNT mode when manually creating a database? The reason is, there are no controlfiles for the database to be in OPEN mode, and you cannot even use MOUNT mode, because at mount mode, controlfile has already pointed to the location of the redologs and datafiles but just that access to them is not granted yet, so we start instance in NOMOUNT because we dont have control files yet but memory usage should be defined. 250.The different ways of restoring a controlfile? *********************Restore of the Control File From a Known Location RMAN> RESTORE CONTROLFILE from 'filename'; *********************Restore of the Control File to a New Location RESTORE CONTROLFILE TO '/tmp/my_controlfile'; *********************Restore from autobackup RMAN> SET DBID 320066378; RMAN> RUN { SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'autobackup_format'; RESTORE CONTROLFILE FROM AUTOBACKUP; } RMAN> RESTORE CONTROLFILE TO '/tmp/ctl_file.ctl' FROM AUTOBACKUP; NOTE: to restore controlfile from autobackup, the database must be in NOMOUNT mode and you must first set the DBID. After restoring controlfile from autobackup, you must run RECOVER DATABASE and also perform an OPEN RESETLOGS on the database. 251.Different ways of restoring spfiles? *********************Restore the server parameter file for autobackup RMAN> RESTORE SPFILE FROM AUTOBACKUP; RMAN> RESTORE SPFILE TO '/tmp/spfileTEMP.ora' FROM AUTOBACKUP; 252.Steps for recovery? *********************tablespace -connect to the target database -take affected tablespace offline [alter database INDS offline immediate] -run SHOW ALL to see current configurations -restore tablespace or datafile with RESTORE & RECOVER command RMAN>SQL 'alter tablespace users offline immediate'; RMAN>restore tablespace users; RMAN>recover tablespace users;
RMAN>sql 'alter tablespace users online; ********************database with current controlfile available -RMAN>startup mount;[best recover for database/datafile when in mount mode] -RMAN>restore database; -RMAN>recover database; -RMAN>alter database open; 253.Restore and Recover of Datafiles to a New Location The procedure shown here is a convenient way to restore a datafile to a new location and perform media recovery on it. RUN { SET NEWNAME FOR DATAFILE 3 to 'new_location'; RESTORE DATAFILE 3; SWITCH DATAFILE 3; RECOVER DATAFILE 3; } 254.what is the default location of portlist and PUPBLD.SQL? **********portlist.ini is located int $ORACLE_HOME/install/portlist.ini *********PUPBLD.sql is located in $ORACLE_HOME/sqlplus/admin/PUPBLD.SQL 255.How to backup incremental with block change tracking SQL> alter database enable block change tracking using file �/home/oracle/bc.ora �; This command brings up the background process Change Tracking Writer (CTWR), that maintains a change tracking file. This file will contain the database block adresses of Oracle Blocks, modified after the next level 0 Full Backup. Because of this file, RMAN no longer has to scan all productive datafiles and compare their blocks with the blocks of the level 0 backup in order to determine which blocks have changed. That was a very time consuming process before 10g. Now we will invoke RMAN with the following command: 256.What is the default password for the sys user in Oracle? Ans : CHANGE_ON_INSTALL 257.What would be the first thing you would do if an end user complains that performance is poor? 258.Explain different startups? STARTUP NOMOUNT Starts the instance but does not mount the database. * STARTUP MOUNT Starts the instance and mounts the database but does not open the database. * STARTUP OPEN Starts the instance and mounts and opens the database. * STARTUP RESTRICT Starts the instance, mounts and opens the database; however, access is restricted to users with restricted session privileges. * STARTUP RECOVER Starts the instance but leaves the database closed and begins recovery for whatever failure scenario occurred. *
STARTUP FORCE Forces the instance to shutdown abort and immediately startup open. This option should only be used for instances having problems either starting or stopping. 259.How do you create a TEMPORARY tablespace using Oracle-Managed File (OMF) technique? First, connect to SQL*Plus as the system/manager user. SQL> CONNECT system/manager@school AS SYSDBA Define a create file destination Let's first make sure that the DB_CREATE_FILE_DEST value is set to a valid sub-directory. SQL> ALTER SYSTEM SET db_create_file_dest='c:' / Create a temporary tablespace (OMF) Now, create a temporary tablespace with Oracle-Managed Files (OMF). Users create temporary segments in a tablespace when a disk sort is required to support their use of select statements containing the GROUP BY, ORDER BY, DISTINCT, or UNION, or the CREATE INDEX statements. SQL> CREATE TEMPORARY TABLESPACE mytemp 260.Give one method for transferring a table from one schema to another: Level:Intermediate Expected Answer: There are several possible methods, export-import, CREATE TABLE... AS SELECT, or COPY. 261. What is the purpose of the IMPORT option IGNORE? What is it?s default setting? Level: Low Expected Answer: errors. If it is it is specified, default value is
The IMPORT IGNORE option tells import to ignore "already exists" not specified the tables that already exist will be skipped. If the error is ignored and the tables data will be inserted. The N.
263. You have a rollback segment in a version 7.2 database that has expanded beyond optimal, how can it be restored to optimal? Level: Low Expected answer: Use the ALTER TABLESPACE ..... SHRINK command. 264. If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE USER command what happens? Is this bad or good? Why? Level: Low Expected answer: The user is assigned the SYSTEM tablespace as a default and temporary tablespace. This is bad because it causes user objects and temporary segments to be placed into the SYSTEM tablespace resulting in fragmentation and improper table placement (only data dictionary objects and the system rollback segment should be in SYSTEM).
265. What are some of the Oracle provided packages that DBAs should be aware of? Level: Intermediate to High Expected answer: Oracle provides a number of packages in the form of the DBMS_ packages owned by the SYS user. The packages used by DBAs may include: DBMS_SHARED_POOL, DBMS_UTILITY, DBMS_SQL, DBMS_DDL, DBMS_SESSION, DBMS_OUTPUT and DBMS_SNAPSHOT. They may also try to answer with the UTL*.SQL or CAT*.SQL series of SQL procedures. These can be viewed as extra credit but aren?t part of the answer. 266. What happens if the constraint name is left out of a constraint clause? Level: Low Expected answer: The Oracle system will use the default name of SYS_Cxxxx where xxxx is a system generated number. This is bad since it makes tracking which table the constraint belongs to or what the constraint does harder. 267. What happens if a tablespace clause is left off of a primary key constraint clause? Level: Low Expected answer: This results in the index that is automatically generated being placed in then users default tablespace. Since this will usually be the same tablespace as the table is being created in, this can cause serious performance problems. 268. What is the proper method for disabling and re-enabling a primary key constraint? Level: Intermediate Expected answer: You use the ALTER TABLE command for both. However, for the enable clause you must specify the USING INDEX and TABLESPACE clause for primary keys. 269. What happens if a primary key constraint is disabled and then enabled without fully specifying the index clause? Level: Intermediate Expected answer: The index is created in the user?s default tablespace and all sizing information is lost. Oracle doesn?t store this information as a part of the constraint definition, but only as part of the index definition, when the constraint was disabled the index was dropped and the information is gone. 270. (On UNIX) When should more than one DB writer process be used? How many should be used? Level: High Expected answer: If the UNIX system being used is capable of asynchronous IO then only one is required, if the system is not capable of asynchronous IO then up to twice the number of disks used by Oracle number of DB writers should be specified by use of the db_writers initialization parameter. 271. You are using hot backup without being in archivelog mode, can you recover in
the event of a failure? Why or why not? Level: High Expected answer: You can?t use hot backup without being in archivelog mode. So no, you couldn?t recover. 272. What causes the "snapshot too old" error? How can this be prevented or mitigated? Level: Intermediate Expected answer: This is caused by large or long running transactions that have either wrapped onto their own rollback space or have had another transaction write on part of their rollback space. This can be prevented or mitigated by breaking the transaction into a set of smaller transactions or increasing the size of the rollback segments and their extents. 273. How can you tell if a database object is invalid? Level: Low Expected answer: By checking the status column of the DBA_, ALL_ or USER_OBJECTS views, depending upon whether you own or only have permission on the view or are using a DBA account. 274. A user is getting an ORA-00942 error yet you know you have granted them permission on the table, what else should you check? Level: Low Expected answer: You need to check that the user has specified the full name of the object (select empid from scott.emp; instead of select empid from emp;) or has a synonym that points to the object (create synonym emp for scott.emp;) 275. A developer is trying to create a view and the database won?t let him. He has the "DEVELOPER" role which has the "CREATE VIEW" system privilege and SELECT grants on the tables he is using, what is the problem? Level: Intermediate Expected answer: You need to verify the developer has direct grants on all tables used in the view. You can?t create a stored object with grants given through views. 276. If you have an example table, what is the best way to get sizing data for the production table implementation? Level: Intermediate Expected answer: The best way is to analyze the table and then use the data provided in the DBA_TABLES view to get the average row length and other pertinent data for the calculation. The quick and dirty way is to look at the number of blocks the table is actually using and ratio the number of rows in the table to its number of blocks against the number of expected rows. 277. How can you find out how many users are currently logged into the database? How can you find their operating system id?
Level: high Expected answer: There are several ways. One is to look at the v$session or v$process views. Another way is to check the current_logins parameter in the v$sysstat view. Another if you are on UNIX is to do a "ps -ef|grep oracle|wc -l? command, but this only works against a single instance installation. 278. A user selects from a sequence and gets back two values, his select is: SELECT pk_seq.nextval FROM dual; What is the problem? Level: Intermediate Expected answer: Somehow two values have been inserted into the dual table. This table is a single row, single column table that should only have one value in it. 279. How can you determine if an index needs to be dropped and rebuilt? Level: Intermediate Expected answer: Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3. 280. A tablespace has a table with 30 extents in it. Is this bad? Why or why not. Level: Intermediate Expected answer: Multiple extents in and of themselves aren?t bad. However if you also have chained rows this can hurt performance. 281. How do you set up tablespaces during an Oracle installation? Level: Low Expected answer: You should always attempt to use the Oracle Flexible Architecture standard or another partitioning scheme to ensure proper separation of SYSTEM, ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEX segments. 282. You see multiple fragments in the SYSTEM tablespace, what should you check first? Level: Low Expected answer: Ensure that users don?t have the SYSTEM tablespace as their TEMPORARY or DEFAULT tablespace assignment by checking the DBA_USERS view. 283. What are some indications that you need to increase the SHARED_POOL_SIZE parameter? Level: Intermediate
Expected answer: Poor data dictionary or library cache hit ratios, getting error ORA-04031. Another indication is steadily decreasing performance with all other tuning parameters the same. 284. What is the general guideline for sizing db_block_size and db_multi_block_read for an application that does many full table scans? Level: High Expected answer: Oracle almost always reads in 64k chunks. The two should have a product equal to 64 or a multiple of 64. 285. What is the fastest query method for a table? Level: Intermediate Expected answer: Fetch by rowid 286. Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output? Level: High Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output. 287. When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it? Level: Intermediate Expected answer: If you get excessive disk sorts this is bad. This indicates you need to tune the sort area parameters in the initialization files. The major sort are parameter is the SORT_AREA_SIZe parameter. 288. When should you increase copy latches? What parameters control copy latches? Level: high Expected answer: When you get excessive contention for the copy latches as shown by the "redo copy" latch hit ratio. You can increase copy latches via the initialization parameter LOG_SIMULTANEOUS_COPIES to twice the number of CPUs on your system. 289. Where can you get a list of all initialization parameters for your instance? How about an indication if they are default settings or have been changed? Level: Low Expected answer: You can look in the init.ora file for an indication of manually set parameters. For all parameters, their value and whether or not the current value is the default value, look in the v$parameter view.
290. Describe hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio and which should be used for tuning? Level: Intermediate Expected answer: The hit ratio is a measure of how many times the database was able to read a value from the buffers verses how many times it had to re-read a data value from the disks. A value greater than 80-90% is good, less could indicate problems. If you simply take the ratio of existing parameters this will be a cumulative value since the database started. If you do a comparison between pairs of readings based on some arbitrary time span, this is the instantaneous ratio for that time span. Generally speaking an instantaneous reading gives more valuable data since it will tell you what your instance is doing for the time it was generated over. 291. Discuss row chaining, how does it happen? How can you reduce it? How do you correct it? Level: high Expected answer: Row chaining occurs when a VARCHAR2 value is updated and the length of the new value is longer than the old value and won?t fit in the remaining block space. This results in the row chaining to another block. It can be reduced by setting the storage parameters on the table to appropriate values. It can be corrected by export and import of the effected table. 292. When looking at the estat events report you see that you are getting busy buffer waits. Is this bad? How can you find what is causing it? Level: high Expected answer: Buffer busy waits could indicate contention in redo, rollback or data blocks. You need to check the v$waitstat view to see what areas are causing the problem. The value of the "count" column tells where the problem is, the "class" column tells you with what. UNDO is rollback segments, DATA is data base buffers. 293. If you see contention for library caches how can you fix it? Level: Intermediate Expected answer: Increase the size of the shared pool. 294. If you see statistics that deal with "undo" what are they really talking about? Level: Intermediate Expected answer: Rollback segments and associated structures. 295. If a tablespace has a default pctincrease of zero what will this cause (in relationship to the smon process)? Level: High Expected answer: The SMON process won?t automatically coalesce its free space fragments. 296. If a tablespace shows excessive fragmentation what are some methods to
defragment the tablespace? (7.1,7.2 and 7.3 only) Level: High Expected answer: In Oracle 7.0 to 7.2 The use of the 'alter session set events 'immediate trace name coalesce level ts#';? command is the easiest way to defragment contiguous free space fragmentation. The ts# parameter corresponds to the ts# value found in the ts$ SYS table. In version 7.3 the ?alter tablespace coalesce;? is best. If the free space isn?t contiguous then export, drop and import of the tablespace contents may be the only way to reclaim non-contiguous free space. 297. How can you tell if a tablespace has excessive fragmentation? Level: Intermediate If a select against the dba_free_space table shows that the count of a tablespaces extents is greater than the count of its data files, then it is fragmented. 298. You see the following on a status report: redo log space requests 23 redo log space wait time 0 Is this something to worry about? What if redo log space wait time is high? How can you fix this? Level: Intermediate Expected answer: Since the wait time is zero, no. If the wait time was high it might indicate a need for more or larger redo logs. 299. What can cause a high value for recursive calls? How can this be fixed? Level: High Expected answer: A high value for recursive calls is cause by improper cursor usage, excessive dynamic space management actions, and or excessive statement reparses. You need to determine the cause and correct it By either relinking applications to hold cursors, use proper space management techniques (proper storage and sizing) or ensure repeat queries are placed in packages for proper reuse. 300. If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a problem? If so, how do you fix it? Level: Intermediate Expected answer: This indicate that the shared pool may be too small. Increase the shared pool size. 301. If you see the value for reloads is high in the estat library cache report is this a matter for concern? Level: Intermediate Expected answer: Yes, you should strive for zero reloads if possible. If you see
excessive reloads then increase the size of the shared pool. 302. You look at the dba_rollback_segs view and see that there is a large number of shrinks and they are of relatively small size, is this a problem? How can it be fixed if it is a problem? Level: High Expected answer: A large number of small shrinks indicates a need to increase the size of the rollback segment extents. Ideally you should have no shrinks or a small number of large shrinks. To fix this just increase the size of the extents and adjust optimal accordingly. 303. You look at the dba_rollback_segs view and see that you have a large number of wraps is this a problem? Level: High Expected answer: A large number of wraps indicates that your extent size for your rollback segments are probably too small. Increase the size of your extents to reduce the number of wraps. You can look at the average transaction size in the same view to get the information on transaction size. 304. In a system with an average of 40 concurrent users you get the following from a query on rollback extents: ROLLBACK CUR EXTENTS --------------------- -------------------------R01 11 R02 8 R03 12 R04 9 SYSTEM 4 You have room for each to grow by 20 more extents each. Is there a problem? Should you take any action? Level: Intermediate Expected answer: No there is not a problem. You have 40 extents showing and an average of 40 concurrent users. Since there is plenty of room to grow no action is needed. 305. You see multiple extents in the temporary tablespace. Is this a problem? Level: Intermediate Expected answer: As long as they are all the same size this isn?t a problem. In fact, it can even improve performance since Oracle won?t have to create a new extent when a user needs one. 306. Define OFA.
Level: Low Expected answer: OFA stands for Optimal Flexible Architecture. It is a method of placing directories and files in an Oracle system so that you get the maximum flexibility for future tuning and file placement. 307. How do you set up your tablespace on installation? Level: Low Expected answer: The answer here should show an understanding of separation of redo and rollback, data and indexes and isolation os SYSTEM tables from other tables. An example would be to specify that at least 7 disks should be used for an Oracle installation so that you can place SYSTEM tablespace on one, redo logs on two (mirrored redo logs) the TEMPORARY tablespace on another, ROLLBACK tablespace on another and still have two for DATA and INDEXES. They should indicate how they will handle archive logs and exports as well. As long as they have a logical plan for combining or further separation more or less disks can be specified. 308. What should be done prior to installing Oracle (for the OS and the disks)? Level: Low Expected Answer: adjust kernel parameters or OS tuning parameters in accordance with installation guide. Be sure enough contiguous disk space is available. 309. You have installed Oracle and you are now setting up the actual instance. You have been waiting an hour for the initialization script to finish, what should you check first to determine if there is a problem? Level: Intermediate to high Expected Answer: Check to make sure that the archiver isn?t stuck. If archive logging is turned on during install a large number of logs will be created. This can fill up your archive log destination causing Oracle to stop to wait for more space. 310. When configuring SQLNET on the server what files must be set up? Level: Intermediate Expected answer: INITIALIZATION file, TNSNAMES.ORA file, SQLNET.ORA file 311. When configuring SQLNET on the client what files need to be set up? Level: Intermediate Expected answer: SQLNET.ORA, TNSNAMES.ORA 312. What must be installed with ODBC on the client in order for it to work with Oracle? Level: Intermediate Expected answer: SQLNET and PROTOCOL (for example: TCPIP adapter) layers of the transport programs.
313. You have just started a new instance with a large SGA on a busy existing server. Performance is terrible, what should you check for? Level: Intermediate Expected answer: The first thing to check with a large SGA is that it isn?t being swapped out. 314. What OS user should be used for the first part of an Oracle installation (on UNIX)? Level: low Expected answer: You must use root first. 315. When should the default values for Oracle initialization parameters be used as is? Level: Low Expected answer: Never 316. How many control files should you have? Where should they be located? Level: Low Expected answer: At least 2 on separate disk spindles. Be sure they say on separate disks, not just file systems. 317. How many redo logs should you have and how should they be configured for maximum recoverability? Level: Intermediate Expected answer: You should have at least three groups of two redo logs with the two logs each on a separate disk spindle (mirrored by Oracle). The redo logs should not be on raw devices on UNIX if it can be avoided. 318. You have a simple application with no "hot" tables (i.e. uniform IO and access requirements). How many disks should you have assuming standard layout for SYSTEM, USER, TEMP and ROLLBACK tablespaces? Expected answer: At least 7, see disk configuration answer above. 319. Describe third normal form? Level: Low Expected answer: Something like: In third normal form all attributes in an entity are related to the primary key and only to the primary key 320. Is the following statement true or false: "All relational databases must be in third normal form", Why or why not? Level: Intermediate Expected answer: False. While 3NF is good for logical design most databases, if they have more than just a few tables, will not perform well using full 3NF. Usually some entities will be denormalized in the logical to physical transfer process.
321. What is an ERD? Level: Low Expected answer: An ERD is an Entity-Relationship-Diagram. It is used to show the entities and relationships for a database logical model. 322. Why are recursive relationships bad? How do you resolve them? Level: Intermediate A recursive relationship (one where a table relates to itself) is bad when it is a hard relationship (i.e. neither side is a "may" both are "must") as this can result in it not being possible to put in a top or perhaps a bottom of the table (for example in the EMPLOYEE table you couldn?t put in the PRESIDENT of the company because he has no boss, or the junior janitor because he has no subordinates). These type of relationships are usually resolved by adding a small intersection entity. 323. What does a hard one-to-one relationship mean (one where the relationship on both ends is "must")? Level: Low to intermediate Expected answer: This means the two entities should probably be made into one entity. 324. How should a many-to-many relationship be handled? Level: Intermediate Expected answer: By adding an intersection entity table 325. What is an artificial (derived) primary key? When should an artificial (or derived) primary key be used? Level: Intermediate Expected answer: A derived key comes from a sequence. Usually it is used when a concatenated key becomes too cumbersome to use as a foreign key. 326. When should you consider denormalization? Level: Intermediate Expected answer: Whenever performance analysis indicates it would be beneficial to do so without compromising data integrity. UNIX Interview Questions 327. How can you determine the space left in a file system? Level: Low Expected answer: There are several commands to do this: du, df, or bdf 328. How can you determine the number of SQLNET users logged in to the UNIX system?
Level: Intermediate Expected answer: SQLNET users will show up with a process unique name that begins with oracle, if you do a ps -ef|grep oracle|wc -l you can get a count of the number of users. 329. What command is used to type files to the screen? Level: Low Expected answer: cat, more, pg 330. What command is used to remove a file? Level: Low Expected answer: rm 331. Can you remove an open file under UNIX? Level: Low Expected answer: yes 332. How do you create a decision tree in a shell script? Level: intermediate Expected answer: depending on shell, usually a case-esac or an if-endif or fi structure 333. What is the purpose of the grep command? Level: Low Expected answer: grep is a string search command that parses the specified string from the specified file or files 334. The system has a program that always includes the word nocomp in its name, how can you determine the number of processes that are using this program? Level: intermediate Expected answer: ps -ef|grep *nocomp*|wc -l 335. What is an inode? Level: Intermediate Expected answer: an inode is a file status indicator. It is stored in both disk and memory and tracts file status. There is one inode for each file on the system. 336. The system administrator tells you that the system hasn?t been rebooted in 6 months, should he be proud of this? Level: High Expected answer: Maybe. Some UNIX systems don?t clean up well after themselves.
Inode problems and dead user processes can accumulate causing possible performance and corruption problems. Most UNIX systems should have a scheduled periodic reboot so file systems can be checked and cleaned and dead or zombie processes cleared out. 337. What is redirection and how is it used? Level: Intermediate Expected answer: redirection is the process by which input or output to or from a process is redirected to another process. This can be done using the pipe symbol "|", the greater than symbol ">" or the "tee" command. This is one of the strengths of UNIX allowing the output from one command to be redirected directly into the input of another command. 338. How can you find dead processes? Level: Intermediate Expected answer: ps -ef|grep zombie -- or -- who -d depending on the system. 339. How can you find all the processes on your system? Level: Low Expected answer: Use the ps command 340. How can you find your id on a system? Level: Low Expected answer: Use the "who am i" command. 341. What is the finger command? Level: Low Expected answer: The finger command uses data in the passwd file to give information on system users. 342. What is the easiest method to create a file on UNIX? Level: Low Expected answer: Use the touch command 343. What does >> do? Level: Intermediate Expected answer: The ">>" redirection symbol appends the output from the command specified into the file specified. The file must already have been created. 344. If you aren?t sure what command does a particular UNIX function what is the best way to determine the command? Expected answer: The UNIX man -k command will search the man pages for the value specified. Review the results from the command to find the command of interest.
Oracle Troubleshooting Interview Questions 345. How can you determine if an Oracle instance is up from the operating system level? Level: Low Expected answer: There are several base Oracle processes that will be running on multi-user operating systems, these will be smon, pmon, dbwr and lgwr. Any answer that has them using their operating system process showing feature to check for these is acceptable. For example, on UNIX a ps -ef|grep dbwr will show what instances are up. 346. Users from the PC clients are getting messages indicating : Level: Low ORA-06114: (Cnct err, can't get err txt. See Servr Msgs & Codes Manual) What could the problem be? Expected answer: The instance name is probably incorrect in their connection string. 347. Users from the PC clients are getting the following error stack: Level: Low ERROR: ORA-01034: ORACLE not available ORA-07318: smsget: open error when opening sgadef.dbf file. HP-UX Error: 2: No such file or directory What is the probable cause? Expected answer: The Oracle instance is shutdown that they are trying to access, restart the instance. 348. How can you determine if the SQLNET process is running for SQLNET V1? How about V2? Level: Low Expected answer: For SQLNET V1 check for the existence of the orasrv process. You can use the command "tcpctl status" to get a full status of the V1 TCPIP server, other protocols have similar command formats. For SQLNET V2 check for the presence of the LISTENER process(s) or you can issue the command "lsnrctl status". 349. What file will give you Oracle instance status information? Where is it located? Level: Low Expected answer: The alert.ora log. It is located in the directory specified by the background_dump_dest parameter in the v$parameter table.
350. Users aren?t being allowed on the system. The following message is received: Level: Intermediate ORA-00257 archiver is stuck. Connect internal only, until freed What is the problem? Expected answer: The archive destination is probably full, backup the archive logs and remove them and the archiver will re-start. 351. Where would you look to find out if a redo log was corrupted assuming you are using Oracle mirrored redo logs? Level: Intermediate Expected answer: There is no message that comes to the SQLDBA or SRVMGR programs during startup in this situation, you must check the alert.log file for this information. 352. You attempt to add a datafile and get: Level: Intermediate ORA-01118: cannot add anymore datafiles: limit of 40 exceeded What is the problem and how can you fix it? Expected answer: When the database was created the db_files parameter in the initialization file was set to 40. You can shutdown and reset this to a higher value, up to the value of MAX_DATAFILES as specified at database creation. If the MAX_DATAFILES is set to low, you will have to rebuild the control file to increase it before proceeding. 353. You look at your fragmentation report and see that smon hasn?t coalesced any of you tablespaces, even though you know several have large chunks of contiguous free extents. What is the problem? Level: High Expected answer: Check the dba_tablespaces view for the value of pct_increase for the tablespaces. If pct_increase is zero, smon will not coalesce their free space. 354. Your users get the following error: Level: Intermediate ORA-00055 maximum number of DML locks exceeded What is the problem and how do you fix it? Expected answer: The number of DML Locks is set by the initialization parameter DML_LOCKS. If this value is set to low (which it is by default) you will get this error. Increase the value of DML_LOCKS. If you are sure that this is just a temporary problem, you can have them wait and then try again later and the error should clear. 355. You get a call from you backup DBA while you are on vacation. He has
corrupted all of the control files while playing with the ALTER DATABASE BACKUP CONTROLFILE command. What do you do? Level: High Expected answer: As long as all datafiles are safe and he was successful with the BACKUP controlfile command you can do the following: CONNECT INTERNAL STARTUP MOUNT (Take any read-only tablespaces offline before next step ALTER DATABASE DATAFILE .... OFFLINE;) RECOVER DATABASE USING BACKUP CONTROLFILE ALTER DATABASE OPEN RESETLOGS; (bring read-only tablespaces back online) Shutdown and backup the system, then restart If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO TRACE; command, they can use that to recover as well. If no backup of the control file is available then the following will be required: CONNECT INTERNAL STARTUP NOMOUNT CREATE CONTROL FILE .....; However, they will need to know all of the datafiles, logfiles, and settings for MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES for the database to use the command 261.How do i know when the database was up? SQL> SELECT instance_name, version, to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "DB Startup Time" FROM v$instance; 262.How do i know when the database was created? SQL>select name,created,log_mode from v$database; 263.What happens if archivelog_dest is full? If the archive log file system is full, your database will hang (ora-00257) and no one can login the database until you move the archive logs to some other file systems. 264.How do i know if an oracle account has been locked and how to unlock it? SQL>select username, lock_date from dba_users where lock_date is not null; SQL>alter user scott account unlock; [You can unlock the account with the above command] 265.How do i know all the database user names? SQL>select username from dba_users order by username; 267.How to find out what objects are in a particular tablespace? SQL>select segment_name, segment_type, bytes/(1024) kb from dba_segments where tablespace_name = 'EXAMPLE'; 268.How to find out what tablespace the object is belong to? SQL>select segment_name, tablespace_name, bytes/(1024) kb from dba_segments where segment_name = 'SALES';
View more...
Comments