MY ORACLE QA v1

Embed Size (px)

Citation preview

  • 8/7/2019 MY ORACLE QA v1

    1/33

    1. What is Instance Recovery?

    When the database is started (at the startup) Oracle automaticallycarries out automatic recovery operation internally.

    It is important to understand how an Oracle instance starts up andwhat kinds of failures can occur at each startup phase. Understandingthe startup phases is important because some types of recoveryoperations must occur in a particular phase. Once a database isstarted, the instance will fail under a number of conditions that we willdescribe in detail.

    Understanding Instance StartupStarting up a database involves several phases, from being shut downto being open and available to users. If certain prerequisites are notpresent, database startup halts, and you must take some kind of

    remedial action to permit startup to proceed. In the following list arethe four basic database states along with their prerequisites after youtype the STARTUP command at the SQL*Plus prompt.

    SHUTDOWNNo background processes are active. A STARTUP command is usedwhen the database is in this state; the STARTUP command fails if youare in any other state unless you are using STARTUP FORCE to restartan instance.

    NOMOUNT

    Also known as the STARTED state, the instance must be able to accessthe initialization parameter file, either as a text-based init.ora file or anSPFILE.

    MOUNTIn this state, the instance checks that all control files listed in theinitialization parameter file are present and identical. Even if one of themultiplexed control files is unavailable or corrupted, the instance doesnot enter the MOUNT state and stays in the NOMOUNT state.

    OPEN

    Most of the time spent in instance startup occurs during this phase. Allredo log groups must have at least one member available, and alldatafiles that are marked as online must be available.You are notified in a number of ways that a redo log group member ismissing or a datafile is missing. If a datafile is missing or corrupted,you will get a message while you are running the STARTUP command,as in this example:

  • 8/7/2019 MY ORACLE QA v1

    2/33

    SQL> startupORACLE instance started.Total System Global Area 197132288 bytesFixed Size 778076 bytesVariable Size 162537636 bytes

    Database Buffers 33554432 bytesRedo Buffers 262144 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 4 see DBWR trace fileORA-01110: data file 4: '/u05/oradata/ord/users01.dbf'SQL>The message in SQL*Plus shows only the first datafile that needsattention. You will have to use the dynamic performance viewV$RECOVER_FILE to display a list of all files that need attention. Here isa query against the view V$RECOVER_FILE and a second query joiningV$RECOVER_ FILE and V$DATAFILE given the previous STARTUP

    command:SQL> select file#, error from v$recover_file;FILE# ERROR--------- ---------------------------------------------4 FILE NOT FOUND11 FILE NOT FOUNDSQL> select file#, name from2 v$datafile join v$recover_file using (file#);FILE# NAME--------- ----------------------------------------4 /u05/oradata/ord/users01.dbf

    11 /u08/oradata/ord/idx02.dbfSQL>If a datafile is offline or taken offline, the instance can still start as longas the datafile does not belong to the SYSTEM or UNDO tablespace.Once the instance is started, you can proceed to recover the missing orcorrupted datafile and subsequently bring it online. If all files areavailable, but out of synch, automatic instance recovery is performedas long as the online redo log files can bring all datafiles to the sameSCN. Otherwise, media recovery is required using archived redo logfiles.

    If a redo log group member is missing, a message is generated in thealert log, but the database will still open.

    KEEPING AN INSTANCE FROM FAILING

    Media failures are not always critical, depending on which type ofdatafile is lost.

  • 8/7/2019 MY ORACLE QA v1

    3/33

    If any of the multiplexed copies of the control file are lost, an entireredo log group, or any datafile from the SYSTEM or UNDO tablespace,the instance will fail.

    In some cases, the instance becomes unavailable to users but will not

    shut down; in this case, you can use SHUTDOWN ABORT to force theinstance to shut down without resynchronizing the datafiles with thecontrol file. The next time the instance is started, instance recoverywill be performed. If you plan on starting up the instance right afterusing SHUTDOWN ABORT, you can instead use STARTUP FORCE asshorthand for a SHUTDOWN ABORT and a STARTUP.Later in this chapter, we will show you how to recover from the loss ofa control file, a redo log file member, or one or more datafiles.

    RECOVERING FROM INSTANCE FAILUREAs we discussed earlier in this chapter in the section "Instance

    Failures," an instance failure is any kind of failure that prevents thesynchronization of the databases datafiles and control file before theinstance is shut down.Oracle automatically recovers from instance failure during instancerecovery. Instance recovery is initiated by simply starting up thedatabase with the

    STARTUP command.Instance recovery is also known as crash recovery.During a STARTUP operation, Oracle first attempts to read theinitialization file, and then it mounts the control file and attempts

    to open the datafiles referenced in the control files. If the data filesare not synchronized, instance recovery is initiated.We discussed instance startup phases in the section "UnderstandingInstance Startup" earlier in this chapter.Instance recovery occurs in two distinct phases: the first phase usesthe online redo log files to restore the datafiles to the state beforeinstance failure in a roll forward operation [cache recovery]; after thisstep is completed, Oracle uses the undo tablespace to roll backanyuncommitted transactions. The roll forward operation includes data inthe undo tablespace; without a consistent undo tablespace, the rollback operation cannot succeed. Once the roll forward operation

    completes, the database is open to users while the roll back operationcompletes. After the roll back phase, the datafiles contain onlycommitted data.

    TUNING INSTANCE RECOVERYBefore a user receives a "Commit complete" message, the new orchanged data must first be successfully written to a redo log file. Atsome point in the future, the same information must be used to update

  • 8/7/2019 MY ORACLE QA v1

    4/33

    the datafiles; this operation usually lags behind the redo log file writebecause sequential writes to the redo log file are by nature faster thanrandom writes to one or more datafiles on disk.As we discussed in Chapter 10, checkpoints keep track of what stillneeds to be written from the redo log files to the datafiles. Any

    transactions not yet written to the datafiles are at an SCN after the lastcheckpoint.The amount of time required for instance recovery depends on howlong it takes to bring the datafiles up-to-date from the last checkpointposition to the latest SCN in the control file. To prevent performanceproblems, the distance between the checkpoint position and the end ofthe redo log group cannot be more than 90 percent of the size of theredo log group.You can tune instance recovery by setting an MTTR target, in seconds,using the initialization parameter FAST_START_MTTR_TARGET. Thedefault value for this parameter is zero; the maximum is 3,600 seconds

    (1 hour).With a setting of zero, which disables the target, the likelihood thatwrites to the redo logs wait for writes to the datafiles is reduced.However, ifFAST_START_MTTR_TARGET is set to a low nonzero value, writes to theredo logs most likely wait for writes to the datafiles. Although thisreduces the amount of time it takes to recover the instance in the caseof an instance failure, it affects performance and response time.Setting this value too high can result in an unacceptable amount oftime needed to recover the instance after an instance failure.

    Two other parameters control instance recovery time:

    LOG_CHECKPOINT_TIMEOUTThis is the maximum number of seconds that any new or modifiedblock in the buffer cache waits until it is written to disk.

    FAST_START_IO_TARGETThis is similar to FAST_START_MTTR_TARGET, except that therecovery operation is specified as the number of I/Os instead of thenumber of seconds to finish instance recovery.

    Setting either of these parameters overridesFAST_START_MTTR_TARGET. As part of the enhanced manageabilityfeatures introduced with Oracle9i, settingFAST_START_MTTR_TARGET is the easiest and most straightforwardway to define your databases recovery time given the time-basedconstraints included in most typical service-level agreements (SLAs).

    The EM Database Control interface makes it easy to adjust

  • 8/7/2019 MY ORACLE QA v1

    5/33

    FAST_START_MTTR_TARGET from the Advisor Central screen,accessible at the bottom of the Database Control home page, clickMTTR Advisor. In the example you adjust the desired MTTR value to 60seconds on the Configure Recovery Settings screen.When you click the Apply button, the new value for

    FAST_START_MTTR_TARGET goes into effect immediately and stays ineffect when the instance is restarted.

    Using the SQL*Plus command line, you can accomplish this task byusing the ALTER SYSTEM command, as in this example:SQL> alter system set fast_start_mttr_target=60 scope=both;System altered.Using SCOPE=BOTH, the new value of the parameter takes effectimmediately and stays in effect the next time the instance is restarted.

    Recovering from User Errors

    Earlier in this chapter, in the section "User Error Failures," wepresented a number of scenarios in which a users data wasinadvertently changed or deleted or a table was dropped. In thefollowing sections, well show you how to use Flashback Query toretrieve selected rows from a previous state of a table, how to recovera table using Flashback Drop and a tablespaces recycle bin, how tobring back an entire table and its dependent objects (such as indexes)back to a point of time in the past using Flashback Table, and queryprevious transactions in the online and archived redo logs using theLogMiner utility.

    Source:http://ora10g.com/8_2_instancerecovery.html

    2. What is Log Miner?http://ora10g.com/8_4_logminer.html

    3. What is the use of UNDO RETENTION?The use of undo retention is that u get information that after how muchtime the snapshot too old error will be effective, this error dependupon undo_retention.

    4. What is Database Refresh?

    5. Explain the concept of the Dual Table?Dual table is a dummy table maintained by oracle server, you can useit to see current date and time etc.

    6. How to know how many instances are up?

    http://ora10g.com/8_2_instancerecovery.htmlhttp://ora10g.com/8_4_logminer.htmlhttp://ora10g.com/8_2_instancerecovery.htmlhttp://ora10g.com/8_4_logminer.html
  • 8/7/2019 MY ORACLE QA v1

    6/33

    Select * from v$instance;

    7. When we are taking the hot backup then what is thebackground process?CKPT is the background process.

    8. Explain the difference between a hot backup and a cold backupand the benefitsAssociated with each. A hot backup is basically taking a backup of the database while it isstill up and running and it must be in archive log mode. The benefit oftaking a hot backup is that the database is still available for use whilethe backup is occurring and you can recover the database to any pointin time.

    A cold backup is taking a backup of the database while it is shut downand does not require being in archive log mode. The benefit of taking acold backup is that it is typically easier to administer the backup andrecovery process. In addition, since you are taking cold backups thedatabase does not require being in archive log mode and thus therewill be a slight performance gain as the database is not cutting archivelogs to disk.

    9. What is Control file?Database's overall physical architecture is maintained in a file calledcontrol file. It will be used to maintain internal consistency and guide

    recovery operations. Multiple copies of control files are advisable.

    10. How to implement the multiple control files for an existingdatabase?

    Shutdown the database

    Copy one of the existing control file to new location

    Edit Config ora file by adding new control filename

    Restart the database.

    11. You have just had to restore from backup and do not have anycontrol files. HowWould you go about bringing up this database?I would create a text based backup control file, stipulating where ondisk all the data files where and then issue the recover command withthe using backup control file clause.

    12. What is a database instance? Explain.

  • 8/7/2019 MY ORACLE QA v1

    7/33

    A database instance (Server) is a set of memory structure andbackground processes that access a set of database files. Theprocesses can be shared by all of the users.

    If a computer has two databases on it and each of these has its own

    SGA and a separate set of Oracle server processes, then there are twoinstances of the database. Each instance is identified by what is knownas the SID system identifier. This is set by the variable calledORACLE_SID on most UNIX computers. Say a database called trgexists. The processes related to the trg database would be namedora_trg_dbwr, ora_trg_pmon, ora_trg_smon and ora_trg_lgwr.

    The memory structure that is used to store the most queried data fromdatabase. This helps up to improve database performance bydecreasing the amount of I/O performed against data file.

    13. What is Parallel Server?Multiple instances accessing the same database (only in multi-CPUenvironments)

    14. What is the basic element of base configuration of an Oracledatabase?It consists of one or more data files.

    One or more control files.

    Two or more redo log files.The Database contains

    Multiple users/schemas

    One or more rollback segments One or more tablespaces

    Data dictionary tables

    User objects (table, indexes, views etc.,)The server that access the database consists of SGA (Database buffer,Dictionary Cache Buffers, Redo log buffers, Shared SQL pool)

    SMON (System monitor)

    PMON (Process monitor)

    LGWR (Log writer)

    DBWR (Data Base Writer)

    ARCH (Archiver) CKPT (Check Point)

    RECO

    Dispatcher

    User Process with associated PGS

    15. What is a deadlock? Explain.

  • 8/7/2019 MY ORACLE QA v1

    8/33

    Two processes waiting to update the rows of a table, which are lockedby other processes then deadlock arises.

    In a database environment this will often happen because of notissuing the proper row lock commands. Poor design of front-end

    application may cause this situation and the performance of server willreduce drastically. These locks will be released automatically when acommit/rollback operation performed or any one of this process beingkilled externally.

    16. How many memory layers are in the shared pool?There are three layers in shared poolI) Library cacheii) Data dictionary cacheiii) Control structuresControl structures will consists of locks and latches

    17. What is PGA?PGA is an area of memory that is used by a single Oracle process. Theprogram global area is not shared. It contains data and controlinformation for a single process. It contains information such asprocess session variables and internal arrays.

    18. What is DDL, DML & DCL?Data Definition Language:Data Definition Language is the SQL construct used to define data in thedatabase. When data is defined, entries are made in Oracles data dictionary.

    When a DDL SQL statement is issued, Oracle commits the current transactionbefore and after every DDL statement.

    Eg: CREATE, ALTER, DROP, TRUNCATE, and REVOKE, NO AUDIT & COMMIT.

    Data Manipulation Language:Data Manipulation Language is the SQL construct used to manipulate thedata in the database.Eg: INSERT, UPDATE, DELETE, LOCK TABLE, and EXPLAIN PLAN & SELECT.

    Transactional Control:

    The word commit is used to indicate that data has been saved back to thedatabase.

    Eg: COMMIT & ROLLBACK

    Session Control: ALTERSESSION & SET ROLESystem Control: ALTER SYSTEM.

    19. How do we know the archive log mode in enabled?

  • 8/7/2019 MY ORACLE QA v1

    9/33

    SQL> Archive log list.

    SQL> select log_mode from v$database;

    20. What is Redo log Buffer?

    Used to store all the changes made in the database.Contents are periodically transferred form memory to online redo logfiles.LGWR is responsible for writing the changes from redo log buffer toonline redo logs.Contents of the redo log buffer are essential for instance recoverypurposes.

    Its size is set by init parameter.LOG_BUFFER

    21. What is redo log file mirroring? How can be achieved?

    Process of having a copy of redo log files is called mirroring. This canbe achieved by creating group of log files together, so that LGWR willautomatically writes them to all the members of the current on-lineredo log group.

    If any one group fails then database automatically switch over to nextgroup. It degrades performance.

    22. What is advantage of having disk shadowing / mirroring?Shadow set of disks save as a backup in the event of disk failure. Inmost operating systems if any disk failure occurs it automaticallyswitches over to place of failed disk.

    Improved performance because most OS support volume shadowingcan direct file I/O request to use the shadow set of files instead of themain set of files. This reduces I/O load on the main set of disks.

    23. What is Database Buffer Cache?The data buffer cache is where Oracle stores the most recently used

    blocks of database data. This is the data cache. When information isput into the database, it is stored in data blocks. The data buffer cacheis an area of memory in which Oracle places these data blocks so thata user process can look at them. Before any user process can look at apiece of data, the data must first reside in the data buffer cache. Thereis a physical limit on the size of the data buffer cache. Thus, as Oraclefills it up, it leaves the hottest blocks in the cache and moves out thecold blocks. This is done using the Least Recently Used Algorithm.

  • 8/7/2019 MY ORACLE QA v1

    10/33

    If a client process needs information that is not in the cache, thedatabase goes out to the physical disk drive, reads the needed datablocks, then places them in the data buffer cache.

    Its Cache & Block size are set by:DB_CACHE_SIZEDB_BLOCK_SIZE

    24. What is keep cache?

    To make available of the free blocks the db cache uses LRUalgorithm.

    The least recently used block are the first one to leave the block.

    Certain block needs to be in memory for more time so for doingso we have this keep cache.

    Since they are frequently accessed. The Keep cache is used to

    hold such. Though they are also subject to the LRU algorithm.

    But still blocks are not released as quickly as they would have inthe default cache.

    Blocks from standard and frequently accessed packages shouldbe placed in the keep cache.

    Its Cache & Block size are set by:DB_KEEP_CACHE_SIZE

    25. LIBRARY CACHE.Stores and reuses frequently used SQL statements their executionplans and stored procedures. This cache prevents from sql repeatedlyparsed thus improving the performance during the execution of SQL.When a statement is executed, Oracle looks for an identicalstatement / execution plan in the library cache. If one is found it isreused, if not a new parse tree and execution plan are created. Thelibrary cache also holds frequently accessed PL/SQL blocks.

    26. Data Dictionary Cache?A dictionary cache contains rows out of the data dictionary. The data

    dictionary contains all the information Oracle needs to manage itself,such as what users have access to the database, what databaseobjects they own and where those objects are located.

    27. The Shared PoolThe contents of this memory area are shared by multiple users andhence the name shared pool. Two specific caches form the shared

  • 8/7/2019 MY ORACLE QA v1

    11/33

    pool. The sizes of the two caches are not set individually and areautomatically determined by the Oracle Server.

    However it is possible to set the overall size of the Shared pool byusing the SHARED_POOL_SIZE initialization parameter.

    The Concept of shared pool was introduced from oracle 7i.It wasintroduced as repository for SQL and PL/SQL. Shared pool isresponsible for collecting, parsing, Interpreting, and executing all ofthe SQL statements that go against the Oracle database. After goingthrough all this and if the condition is passing then it will go and collectthe necessary data's from the datafile and executes it to the user.

    28. What is Large Pool?Its main functions are:To provide memory for session memory (UGA) for the shared server

    environment.Parallel execution message buffers (whenPARALLEL_AUTOMATIC_TUNING is set to TRUE).It is also used by theRecovery Manager (RMAN).This pool do not use LRU.

    29. How will you size you SGA?ORACLE recommends a database server, sub-80% of the memory tothe database, 20% of the memory to the operating system, how it to adatabase server with memory.

    http://sapbasis.wordpress.com/2010/06/19/how-to-estimate-the-pga-sga-size-

    configuration-database-server-memory/

    BACKGROUND PROCESS:30. DBWR

    Transfer modified blocks from the database buffer cache to thedatafiles.

    Normal or incremental checkpoint.

    The number of dirty buffers reaches a pre-defined thresholdvalue.

    The server process scans a pre-defined number of blocks looking

    for free space Needed by new blocks being read in.

    Timeout occurs.

    Tablespace is taken offline in normal or immediate mode.

    Tablespace is made read-only.

    Dropping or truncating a table.

    Online backup is done on a tablespace.

    http://sapbasis.wordpress.com/2010/06/19/how-to-estimate-the-pga-sga-size-configuration-database-server-memory/http://sapbasis.wordpress.com/2010/06/19/how-to-estimate-the-pga-sga-size-configuration-database-server-memory/http://sapbasis.wordpress.com/2010/06/19/how-to-estimate-the-pga-sga-size-configuration-database-server-memory/http://sapbasis.wordpress.com/2010/06/19/how-to-estimate-the-pga-sga-size-configuration-database-server-memory/
  • 8/7/2019 MY ORACLE QA v1

    12/33

    31. LGWRTransfers redo entries that have been written to the redo log buffer totheOnline redo log files present on disk.

    The LGWR writes to the online redo log files when one of the followingevents occurin the database:

    A commit is issued.

    The Redo Log Buffer is one-third full.

    More than 1MB of changes (updations) has been made in thedatabase.

    Every three seconds.

    Just before the DBWR writes from the database buffer cache to

    the datafiles.

    32. CKPTWhen the contents of the database buffer cache are transferred to thedatafiles by theDBWR background process, the event is referred to as a CHECKPOINT.When a checkpoint occurs the Checkpoint (CKPT) background processupdates the headers of the datafiles and control files to indicate themost recent checkpoint.

    This process is therefore responsible for synchronizing the database.

    33. SMONIt is responsible for performing recovery in the event of an instancefailure. Instance failure occurs during an abnormal shutdown of thedatabase, such as if a shutdown is performed using the ABORT option.

    During instance recovery the SMON process performs a roll forwardoperation.During this step all committed transactions that were not written out tothe datafiles at the time of failure were be completed.

    This step maybe followed by a rollback during which time either theSMON or individual user processes undo all the changes that wereuncommitted during the time of failure.

    Certain additional functions performed by the System Monitor involvecoalescing of free space in dictionary-managed datafiles and releasingtemporary segments that are created in the datafiles.

  • 8/7/2019 MY ORACLE QA v1

    13/33

    34. PMONUsers connect to the database to access data. When a user connectsto the database,a process known as a User process is started on behalf of the user on

    the client machine. If the user terminates his/her session abnormally,resources that were being used by the user session continue to remainattached until the PMON background process cleans it up.

    The PMON background process is responsible for cleaning theresources such locks on tables being held by failure user processes.The process also restarts dead dispatcher processes.

    35. ARCHOptional background process. It can be started when you wish tooperate the database in an archivelog mode. This mode of database

    operation allows for complete recovery of the database in an event ofa failure.

    The ARCH background process transfers the contents of the onlineredo log files to archival media which could be disk or tape.

    How to change the Redo Log Buffer size:http://www.ixora.com.au/tips/tuning/log_buffer_size.htm[The above link is for tunning the Redo log buffer]

    36. Parameter Files

    PFILE--Static parameter file [initSID.ora]SPFILE--Persistent parameter file [spfileSID.ora]These consist of a list of parameters. Each parameter has a name anda value.Most parameters have default values. Explicit values can also beassigned to the parameters.

    ALTER SYSTEM SET SGA_TARGET=300M SCOPE=SPFILE;ALTER SYSTEM SET SGA_TARGET=300M SCOPE=BOTH;ALTER SYSTEM SET DB_CACHE_SIZE=20M SCOPE=BOTH;

    These are the different types can be set using alter.[SCOPE = MEMORY|SPFILE|BOTH] [SID='sid' | '*']

    37. What is a datafile?Datafiles contain all the database data. The Oracle database is madeup of one or more datafiles; datafiles are grouped together to form a

  • 8/7/2019 MY ORACLE QA v1

    14/33

    tablespace. The datafiles contain all of the data information stored inthe database.

    USER DATA AND SYSTEM DATATwo types of data or information are stored within the

    datafiles associated with a database: user data and systemdata.User data is the application data, with all of the applications relevantinformation. This is the information the organization stores in thedatabase.The table below shows the common types of user data.Type of Data Contains Information About Customer Information,Last name, first name, phone number, Product Information, ProductName, availability, price, Medical Information, Lab results, doctorsname, nurses name, Inventory Information and etc..,

    System data is the information the database needs to manage theuser data and to manage itself. System data tells Oracle the validusers of the database, their passwords, and how many datafiles areparts of the database and where these datafiles are located.

    38. Dirty Data Block & HOT BLOCK

    A dirty data block is a portion of the computer memory that contains Oracle

    data whose value has changed from what was originally read from the

    database. Dirty blocks are data sitting in memory that has been

    changed but not written back to the database.

    Hot Block

    A hot block is a block whose data is changed frequently.

    39. What are the components of physical database structure ofOracle database?Oracle database is comprised of three types of files. One or moredatafile, two are more redo log files, and one or more control files.

    40. What are the components of logical database structure ofOracle database?There are tablespaces and database's schema objects.

    41. What is SYSTEM tablespace and when is it created?Every Oracle database contains a tablespace named SYSTEM, which isautomatically

  • 8/7/2019 MY ORACLE QA v1

    15/33

    created when the database is created. The SYSTEM tablespace alwayscontains thedata dictionary tables for the entire database.

    Used to manage the database level transactions such as modifications

    of the data dictionary table that record information about the freespace usage.

    42. Explain the relationship among database, tablespace and datafile.Each databases logically divided into one or more tablespaces one ormore data filesare explicitly created for each tablespace.

    43. What is schema?A schema is collection of database objects of a user.

    44. What are Schema Objects?Schema objects are the logical structures that directly refer to thedatabase's data. Schema objects include tables, views, sequences,synonyms, indexes, clusters, database triggers, procedures, functionspackages and database links.

    45. Can objects of the same schema reside in different tablespaces?Yes.

    46. Can a tablespace hold objects from different schemes?Yes.

    47. What is Oracle table?A table is the basic unit of data storage in an Oracle database. Thetables of a database hold all of the user accessible data. Table data isstored in rows and columns.

    48. What is an Oracle view?A view is a virtual table. Every view has a query attached to it. (Thequery is a SELECT statement that identifies the columns and rows of

    the table(s) the view uses.)

    49. Do views contain data?Views do not contain or store data.

    50. Can a view based on another view?Yes.

  • 8/7/2019 MY ORACLE QA v1

    16/33

    51. What are the advantages of views?

    Provide an additional level of table security, by restricting accessto a predetermined set of rows and columns of a table.

    Hide data complexity.

    Simplify commands for the user.

    Present the data in a different perspective from that of the basetable.

    Store complex queries.

    52. Can a view be updated/inserted/deleted? If Yes - under whatconditions?A View can be updated/deleted/inserted if it has only one base table ifthe view is based on columns from one or more tables then insert,update and delete is not possible.If a view on a single base table is manipulated will the changes bereflected on the base table? If changes are made to the tables and

    these tables are the base tables of a view, then the changes will bereference on the view.

    53. What is a synonym?A synonym is an alias for a table, view, sequence or program unit.

    54. What are the types of synonyms?There are two types of synonyms private and public.Private: Only its owner can access a private synonym.Public: Any database user can access a public synonym.

    55. What are synonyms used for? Mask the real name and owner of an object.

    Provide public access to an object

    Provide location transparency for tables, views or program unitsof a remote database.

    Simplify the SQL statements for database users.

    56. What is an Oracle index?An index is an optional structure associated with a table to have directaccess to rows, which can be created to increase the performance of

    data retrieval. Index can be created on one or more columns of a table.

    57. How the indexes are updates?Indexes are automatically maintained and used by Oracle. Changes totable data are automatically incorporated into all relevant indexes.

    58. What are clusters?

  • 8/7/2019 MY ORACLE QA v1

    17/33

    Clusters are groups of one or more tables physically stores together toshare common columns and are often used together.

    59. What is cluster key?The related columns of the tables in a cluster are called the cluster

    key. The cluster key is indexed using a cluster index and its value isstored only once for multiple tables in the cluster.

    60. What is index cluster?A cluster with an index on the cluster key.

    61. What is hash cluster?A row is stored in a hash cluster based on the result of applying a hashfunction to the row's cluster key value. All rows with the same hashkey value are stores together on disk.

    62. When can hash cluster used?Hash clusters are better choice when a table is often queried withequality queries. For such queries the specified cluster key value ishashed. The resulting hash key value points directly to the area on diskthat stores the specified rows.

    63. What is database link?A database link is a named object that describes a "path" from onedatabase to another. Database link is a named path through which aremote database can be accessed.

    64. What are the types of database links?Private database link, & public database link , network database link.

    Private databasePrivate database link is created on behalf of a specific user. A privatedatabase link can be used only when the owner of the link specifies aglobal object name in a SQL statement or in the definition of theowner's views or procedures.

    Public database linkPublic database link is created for the special user group PUBLIC. A

    public database link can be used when any user in the associateddatabase specifies a global object name in a SQL statement or objectdefinition.

    Network database linkNetwork database link is created and managed by a network domainservice. A network database link can be used when any user of any

  • 8/7/2019 MY ORACLE QA v1

    18/33

    database in the network specifies a global object name in a SQLstatement or object definition.

    65. What is data block?Oracle database's data is stored in data blocks. One data block

    corresponds to a specific number of bytes of physical database spaceon disk.

    66. How to define data block size?A data block size is specified for each Oracle database when thedatabase is created. A database users and allocated free databasespace in Oracle data blocks. Block size is specified in init.ora file andcannot be changed latter.

    67. What is row chaining?In circumstances, all of the data for a row in a table may not be able to

    fit in the same data block. When this occurs, the data for the row isstored in a chain of data block (one or more) reserved for thatsegment.

    68. What is an extent?An extent is a specific number of contiguous data blocks, obtained in asingle allocation and used to store a specific type of information.

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

    70. What is a segment?A segment is a set of extents allocated for a certain logical structure.

    71. What are the different types of segments?

    Data segmentData segment are the physical areas within a database block in whichthe data associated with tables and clusters are stored. Each non-clustered table has a data segment. All of the table's data is stored in

    the extents of its data segment. Each cluster has a data segment. Thedata of every table in the cluster is stored in the cluster's datasegment.

    Index segmentEach index has an index segment that stores all of its data.

    Rollback segment

  • 8/7/2019 MY ORACLE QA v1

    19/33

  • 8/7/2019 MY ORACLE QA v1

    20/33

    78. How the space utilization takes place within rollbacksegments?It will try to fit the transaction in a cyclic fashion to all existing extents.Once it found an extent is in use then it forced to acquire a new extent

    (number of extents is based on the optimal size)

    79. Why query fails sometimes?Rollback segment dynamically extent to handle larger transactionsentry loads.A single transaction may wipe out all available free space in therollback segment tablespace. This prevents other user using rollbacksegments.

    80. How will you monitor the space allocation?By querying DBA_SEGMENT table/view

    81. How will you monitor rollback segment status?Querying the DBA_ROLLBACK_SEGS viewIN USE - Rollback Segment is on-line.AVAILABLE - Rollback Segment available but not on-line.OFF-LINE - Rollback Segment off-lineINVALID - Rollback Segment Dropped.NEEDS RECOVERY - Contains data but need recovery orcorrupted.

    PARTLY AVAILABLE - Contains data from an unresolvedtransaction involving a

    Distributed database.82. List the sequence of events when a large transaction that

    exceeds beyond itsoptimal value when an entry wraps and causes the rollbacksegment to expand into another extend.

    Transaction Begins.

    An entry is made in the RES header for new transactions entry

    Transaction acquires blocks in an extent of RBS

    The entry attempts to wrap into second extent. None is available,so that the RBS must extent.

    The RBS checks to see if it is part of its OPTIMAL size.

    RBS chooses its oldest inactive segment.

    Oldest inactive segment is eliminated.

    RBS extents

    The data dictionary tables for space management are updated.

  • 8/7/2019 MY ORACLE QA v1

    21/33

    Transaction Completes.

    83. What is an Oracle sequence?A sequence generates a serial list of unique numbers for numericalcolumns of a database's tables.

    84. How to access the current value and next value from asequence? Is it possible toaccess the current value in a session before accessing nextvalue?Sequence name CURRVAL, sequence name NEXTVAL. It is not possible.Only if you access next value in the session, current value can beaccessed.

    85. What is CYCLE/NO CYCLE in a Sequence?CYCLE specifies that the sequence continue to generate values after

    reaching either maximum or minimum value. After pan-ascendingsequence reaches its maximum value, it generates its minimum value.After a descending sequence reaches its minimum, it generates itsmaximum.

    NO CYCLE specifies that the sequence cannot generate more valuesafter reaching its maximum or minimum value.

    86. What are the factors causing the reparsing of SQL statementsin SGA?Due to insufficient shared pool size. Monitor the ratio of the reloads

    takes place while executing SQL statements. If the ratio is greater than1 then increase the SHARED_POOL_SIZE.

    87. What is meant by recursive hints?Number of times processes repeatedly query the dictionary table iscalled recursive hints. It is due to the data dictionary cache is toosmall. By increasing the SHARED_POOL_SIZE parameter we canoptimize the size of data dictionary cache.

    88. What is hit ratio?It is a measure of well the data cache buffer is handling requests for

    data. Hit Ratio = (Logical Reads - Physical Reads - Hits Misses)/ LogicalReads.

    89. List the factors that can affect the accuracy of theestimations?

    The space used transaction entries and deleted records, does notbecome free immediately after completion due to delayedcleanout.

  • 8/7/2019 MY ORACLE QA v1

    22/33

    Trailing nulls and length bytes are not stored.

    Inserts of, updates to and deletes of rows as well as columnslarger than a single data block, can cause fragmentation achained row pieces.

    90. How will you swap objects into a different table space for an

    existing database? Export the user

    Perform import using the command imp system/managerfile=export.dmp index file=newrite.sql. This will create alldefinitions into newfile.sql.

    Drop necessary objects.

    Run the script newfile.sql after altering the tablespaces.

    Import from the backup for the necessary objects.

    91. List the Optional Flexible Architecture (OFA) of Oracledatabase? How can weorganize the tablespaces in Oracle database to have maximumperformance?

    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.

    92. Which parameter in Storage clause will reduce number of rowsper block?PCTFREE parameter .Row size also reduces no of rows per block.

    93. What is the significance of having storage clause?

    We can plan the storage for a table as how much initial extents arerequired, how much can be extended next, how much % should leavefree for managing row updating, etc.,

    94. How does Space allocation table place within a block?

    Each block contains entries as follows

    Fixed block header

    Variable block header

  • 8/7/2019 MY ORACLE QA v1

    23/33

    Row Header, row date (multiple rows may exists)

    PCTEREE (% of free space for row updating in future)

    95. What is the role of PCTFREE parameter is storage clause?This is used to reserve certain amount of space in a block for

    expansion of rows.

    96. How can we plan storage for very large tables?

    Limit the number of extents in the table

    Separate table from its indexes.

    Allocate sufficient temporary storage.

    97. How will you estimate the space required by a non-clusteredtable?

    Calculate the total header size

    Calculate the available data space per data block

    Calculate the combined column lengths of the average row

    Calculate the total average row size.

    Calculate the average number rows that can fit in a block

    Calculate the number of blocks and bytes required for the table.

    After arriving the calculation, add 10 % additional space tocalculate the initial extent size for a working table

    98. It is possible to use raw devices as data files and what are theadvantages overfile system files?

    Yes. The advantages over file system files are that I/O will be improvedbecause Oracle is bye-passing the kernel which writing into disk. Diskcorruption will be very less.

    99. What are disadvantages of having raw devices?We should depend on export/import utility for backup/recovery (fullyreliable).The tar command cannot be used for physical file backup,instead we can use dd command, which is less flexible and has limitedrecoveries.

    100. What is user Account in Oracle database?

    A user account is not a physical structure in database but it is havingimportant relationship to the objects in the database and will be havingcertain privileges.

    101. 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 thetables. When procedure executed it will execute the privilege of

  • 8/7/2019 MY ORACLE QA v1

    24/33

    procedures owner. Users cannot access tables except via theprocedure.

    102. What is the dictionary tables used to monitor a databasespace?

    DBA_FREE_SPACE DBA_SEGMENTS

    DBA_DATA_FILES.

    103. What is a transaction?Transaction is logical unit between two commits and commit androllback.

    104. What is difference between TRUNCATE & DELETE?

    TRUNCATE commits after deleting entire table i.e., cannot berolled back.

    Database triggers do not fire on TRUNCATE DELETE allows the filtered deletion. Deleted records can be rolled

    back or committed.

    Database triggers fire on DELETE.

    105. What is a join? Explain the different types of joins?Join is a query, which retrieves related columns or rows from multipletables.Self Join - Joining the table with itself.Equi Join - Joining two tables by equating two common columns.Non-Equi Join - Joining two tables by equating two common columns.Outer Join - Joining two tables in such a way that query can alsoretrieve rows that do not have corresponding join value in the othertable.

    106. What is the sub-query?Sub-query is a query whose return values are used in filteringconditions of the main query.

    107. What is correlated sub-query?Correlated sub-query is a sub-query, which has reference to the mainquery.

    108. Explain CONNECT BY PRIOR?Retrieves rows in hierarchical order eg.Select empno, ename from emp where.

    109. Difference between SUBSTR and INSTR?INSTR (String1, String2 (n, (m)),

  • 8/7/2019 MY ORACLE QA v1

    25/33

    INSTR returns the position of the m-th occurrence of the string 2 instring1. The search begins from nth position of string1.SUBSTR (String1 n, m)SUBSTR returns a character string of size m in string1, starting from n-th position of string1.

    110. Explain UNION, MINUS, UNION ALL and INTERSECT?INTERSECT - returns all distinct rows selected by both queries.MINUS - returns all distinct rows selected by the first query butnot by the second.UNION - returns all distinct rows selected by either queryUNION ALL - returns all rows selected by either query, including allduplicates.

    111. What is ROWID?ROWID is a pseudo column attached to each row of a table. It is 18

    characters long, blockno, rownumber are the components of ROWID.

    112. What is the fastest way of accessing a row in a table?Using ROWID and CONSTRAINTS

    113. What is an integrity constraint?Integrity constraint is a rule that restricts values to a column in a table.

    114. What is referential integrity constraint?Maintaining data integrity through a set of rules that restrict the valuesof one or more columns of the tables based on the values of primary

    key or unique key of the referenced table.

    115. How will you activate/deactivate integrity constraints?The integrity constraints can be enabled or disabled by ALTER TABLEENABLE CONSTRAINT / DISABLE CONSTRAINT.

    116. If unique key constraint on DATE column is created, will itvalidate the row thatare inserted with SYSDATE?It won't, because SYSDATE format contains time attached with it.

    117. What is the usage of SAVEPOINTS?SAVEPOINTS are used to subdivide a transaction into smaller parts. Itenables rolling back part of a transaction. Maximum of five save pointsare allowed.

    118. What is ON DELETE CASCADE?

  • 8/7/2019 MY ORACLE QA v1

    26/33

    When ON DELETE CASCADE is specified Oracle maintains referentialintegrity by automatically removing dependent foreign key values if areferenced primary or unique key value is removed.

    119. What are the data types allowed in a table?

    CHAR, VARCHAR2, NUMBER, and DATE, RAW, LONG and LONG RAW.

    120. What is difference between CHAR and VARCHAR2? What is themaximum SIZEallowed for each type?

    CHAR pads blank spaces to the maximum length.

    VARCHAR2 does not pad blank spaces.

    For CHAR the maximum length is 255 and 2000 for VARCHAR2.

    121. How many LONG columns are allowed in a table? Is it possibleto use LONG

    columns in WHERE clause or ORDER BY?Only one LONG column is allowed. It is not possible to use LONGcolumn in WHERE or ORDER BY clause.

    122. What are the pre-requisites to modify data type of a columnand to add acolumn with NOT NULL constraint?

    To modify the data type of a column the column must be empty.

    To add a column with NOT NULL constrain, the table must beempty.

    123. How to Enable Archive Log Mode in a Normal Database?

    1. SET THE ARCHIEVING LOG DESTINATION

    Sql>show parameter log_archive_dest_1This Query returns the Location of the archived log files.http://dbataj.blogspot.com/2007/09/how-to-enable-

    archivelog-mode.html

    Sql>show parameter log_startThis one shows value if the value is set to false then we

    have to edit the initparameter file.

    2. TO CHECK IF THE DATABASE IS IN ARCHIEVE LOG MODEOR NOT.

  • 8/7/2019 MY ORACLE QA v1

    27/33

    SQL> select log_mode from v$database;

    LOG_MODE------------

    NOARCHIVELOG

    If not in archive log mode this show like this.SQL> archive log list;Database log mode No Archive ModeAutomatic archival DisabledArchive destination /u04/oradata/myhcdata/arcOldest online log sequence 2302Current log sequence 2305

    If in archive log mode then it show like this.

    Create a directory under the folder/u02/oradata/grdom/arc

    alter system set ARCHIVE_LOG_DEST 'new location'alter system set log_archive_dest_1='location=/tmp' ;BSNDLPP_%t_%r_%s.ARC

    ENABLING THE ARCHIEVE LOG MODE:

    SHUTDOWN IMMEDIATE;STARTUP MOUNT;ALTER DATABASE ARCHIVELOG;ALTER DATABASE OPEN;archive log list;sql>alter system switch logfile;AFTER THIS GO AND CHECK WETHER THE LOG IS CREATED ORNOT.IN THE LOGFILE LOCATION.The current logfile sequence should have changed from

    [Current log sequence 2307 to 2308]. And a file like thisMYHCDATA_1_713461217_2307.ARC [In the logfile location]with the previous log sequence would have generated.

    Setting the Archive log files location.

  • 8/7/2019 MY ORACLE QA v1

    28/33

    ALTER SYSTEM SETlog_archive_dest_1='location=/u03/oradata/bsndlpp/arc/'SCOPE=spfile;

    Setting the Format of the Archieve logformat.Always start with

    the Database name asit will be helpfull for us to do.ALTER SYSTEM SET log_archive_format='BSNDLPP_%t_%r_%s.ARC' SCOPE=spfile;

    GRDOM_%t_%r_%s.ARCBSNDLPP_%t_%r_%s.ARC

    NOT DONE THESE TWO STEPSALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile;

    ARCHIVE LOG START;

    RESET ARCHIEVE

    log_archive_format='BSNDLPP_%t_%s.arc'log_archive_format='BSNDLPP_%t_%r_%s.ARC'*.log_archive_format='BSNDLPP_%t_%s.arc'*.log_archive_format='BSNDLPP_%t_%r_%s.ARC'

    124. How to Enable Archive Log Mode in a RAC Database?

    Login to the oracle database. [Any node].Set the parameter.oracle@grdb07 :~>. oraenvoracle@grdb07:~>db1 [Database name is db here we arelogging in to the node 1 database]Sqlplus "/ as sysdba"

    Shutdown all the instance accessing the database.oracle@grdb07 :~> $ srvctl stop database -d db

    Login in to the database through any of the node anddisable the cluster instance parameter to false.

    SQL>alter system set cluster_database=false scope=spfileSid='db1';

    Set the required parameters for archive log mode:

  • 8/7/2019 MY ORACLE QA v1

    29/33

    SQL> ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' scope=SPFILE;

    SQL>ALTER SYSTEM SET log_archive_dest=''scope=SPFILE;

    Enable ARCHIVELOG modeSQL>ALTER DATABASE ARCHIVELOG;

    Set cluster_database=true again.

    SQL> Alter system set cluster_database=true scope=spfileSid='db1';

    Shut down and restart all the instances.$ Srvctl start database -d dbOptional Bring any services (i.e. TAF) back up using srvctl:

    $ Srvctl start service -d db

    Verify archive log modeSQL> archive log list;

    125. What are types of cloning?

    Two ways of cloning one is cold cloning and another one is hot cloning.Cold Cloning is done by keeping the database down here all theservices are stopped before taking the image backup by keeping the

    database down we will get 100% consistent backup.

    Hard cloning it is done with the help of the RMAN here there is nodown time to the database.

    Steps of cold cloning:

    1. Down the database & listener. Then mount the Database.2. Take a backup of the control file.3. Backup the datafile, online redolog file, control file.4. Copy the trace files to a new location any locations of new

    created database folder.5. Edit all the lines keep only the following lines and edit them inthe trace file.

    6. Delete the control files which we have copied.7. Create a pfile from the source database and Copy the pfile to the

    target database.8. Now in the new pfile edit the new locations.

  • 8/7/2019 MY ORACLE QA v1

    30/33

    9. Now set the oracle home. set the env of the old database thenexport ORACLE_SID=test

    10. Now login as sqlplus as startup nomount.11. Alter database open resetlogs;

    12. This is the sample control file.CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS NOARCHIVELOGDATAFILE LOCATIONS/u01/app/oracle/product/10.2.0/oradata/bscmps/users01.dbf/u01/app/oracle/product/10.2.0/oradata/bscmps/sysaux01.dbf/u01/app/oracle/product/10.2.0/oradata/bscmps/undotbs01.dbf/u01/app/oracle/product/10.2.0/oradata/bscmps/system01.dbf/u01/app/oracle/product/10.2.0/oradata/bscmps/example01.dbf

    /u02/app/oracle/product/10.2.0/oradata/bscmps/ts_mail_d01.dbf/u02/app/oracle/product/10.2.0/oradata/bscmps/ts_mail_x01.dbf

    ONLINE REDOLOGFILE LOCATION/u01/app/oracle/product/10.2.0/oradata/bscmps/redo03.log

    /u01/app/oracle/product/10.2.0/oradata/bscmps/redo02.log/u01/app/oracle/product/10.2.0/oradata/bscmps/redo01.logbscmps.__db_cache_size=872415232CONTROLFILE LOCATION /u01/app/oracle/product/10.2.0/oradata/bscmps/control01.ctl/u01/app/oracle/product/10.2.0/oradata/bscmps/control02.ctl/u01/app/oracle/product/10.2.0/oradata/bscmps/control03.ctl

    Steps of hard cloning:

    1. Enable archive log mode.

    2. rman target /3. RMAN>show all;4. RMAN>BACKUP DATABASE FORMAT '/u02/rmanbkp/bscmps2_

    %U';5. RMAN>backup archivelog all;6. Create pfile.7. Change the locations.8. db_file_name_convert='/u01/app/oracle/product/10.2.0/oradata/b

    scmps','/u01/app/oracle/product/10.2.0/oradata/dev','/u02/app/oracle/product/10.2.0/oradata/bscmps','/u01/app/oracle/product/10.2.0/oradata/dev'

    9. log_file_name_convert='/u01/app/oracle/product/10.2.0/oradata/bscmps','/u01/app/oracle/product/10.2.0/oradata/dev' [optional]10. Create the necessary directories.11. Set the new oracle devlopment id.12. rman target=sys/admin123@bscmps nocatalog auxiliary /13. RMAN> run {14. allocate auxiliary channel C1 device type disk;15. duplicate target database to dev;

  • 8/7/2019 MY ORACLE QA v1

    31/33

    16. }17. If the backup is not consistent then it will show error as

    target database not found to restore. At that time we have to dothem. Media recovery failed.

    18. Mount the database.

    19. Recover database using backup controlfile.

    Cloning in a Remote system:http://www.akadia.com/services/ora_duplicate_database_rman.htmlhttp://www.dba-oracle.com/t_rman_clone+copy_database.htm

    1. Take a backup of the control file, full backup including the spfileor pfile.

    2. Create a pfile from the spfile.3. Now move the following to the NODE-2

    The database backup pieces

    Controlfile backup piece The parameter file i.e init.ora file

    4. Now edit the PFILE on NODE 2 to change the environmentspecific parameters like.user_dump_dest =background_dump_dest =control_files =

    5. Once the pfile is modified suitably set the oracle environmentvariables.

    6. And start the database in nomount mode:[oracle@]$ export ORACLE_HOME=/u01/oracle/product/ora10g[oracle@]$ export ORACLE_SID=ora10g[oracle@]$ export PATH=$ORACLE_HOME/bin:$PATH

    7. [oracle@]$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 13 00:36:55 2007Copyright 1982, 2005, Oracle. All rights reserved.connected to target database (not started)

    8. RMAN> startup nomountOracle instance startedTotal System Global Area 205520896 bytesFixed Size 1218508 bytesVariable Size 75499572 bytesDatabase Buffers 121634816 bytesRedo Buffers 7168000 bytes

    9. Restore the controlfile from the backup piece.

    10. RMAN> restore controlfile from '/u01/oracle/product/ora10g/dbs/c-3932056136-20070213-02';

    http://www.akadia.com/services/ora_duplicate_database_rman.htmlhttp://www.dba-oracle.com/t_rman_clone+copy_database.htmhttp://www.akadia.com/services/ora_duplicate_database_rman.htmlhttp://www.dba-oracle.com/t_rman_clone+copy_database.htm
  • 8/7/2019 MY ORACLE QA v1

    32/33

    Starting restore at 13-FEB-07using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=155 devtype=DISKchannel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete,elapsed time: 00:00:02

    output filename=/u01/oracle/product/oradata/ora10g/cntrl/control01.ctlFinished restore at 13-FEB-07

    11. Mount the database.

    12. RMAN> alter database mount ;

    13. Now catalog the backup pieces that were shipped fromNODE 1.

    14. RMAN> catalog backuppiece'/home/oracle/test/backup/o1_mf_annnn_TAG20070213T002925_2x21m6ty_.bkp';

    Starting implicit crosscheck backup at 13-FEB-07allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=155devtype=DISKCrosschecked

    3 objectsFinished implicit crosscheck backup at 13-FEB-07Starting implicit crosscheck copy at 13-FEB-07usingchannelORA_DISK_1Finished implicit crosscheck copy at 13-FEB-07searching for all files in the recovery areacatalogingfiles...nofiles catalogedcataloged backuppiecebackup piecehandle=/home/oracle/test/backup/o1_mf_annnn_TAG20070213T002925_2x21m6ty_.bkprecid=41 stamp=614393265RMAN> catalog backuppiece'/home/oracle/test/backup/o1_mf_annnn_TAG20070213T002825_2x21kbds_.bkp';catalogedbackuppiecebackup piece handle=/home/oracle/test/backup/o1_mf_annnn_TAG20070213T002825_2x21kbds_.bkprecid=42 stamp=614393292RMAN>catalog backuppiece '/home/oracle/test/backup/o1_mf_nnndf_TAG20070213T002827_2x21kd12_.bkp';catalogedbackuppiecebackuppiece handle=/home/oracle/test/backup/o1_mf_nnndf_TAG20070213T002827_2x21kd12_.bkp recid=43stamp=614393310

    15. Get to know the last sequence available in the archivelogbackup using the following command.

    16. RMAN > list backup of archivelog all;Rename the Redo logfiles, so that they can be created in newlocations 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';..................

    17. Now restore the datafiles to new locations and recover.

    18. RMAN> run { set until sequence set newnamefor datafile 1 to '/home/oracle/test/data/sys01.dbf';

  • 8/7/2019 MY ORACLE QA v1

    33/33

    set newname for datafile 2 to'/home/oracle/test/data/undotbs01.dbf'; set newname for datafile 3to '/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; alterdatabase open resetlogs; }

    126. What are the parameters of Data guard?