Your SlideShare is downloading. ×
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply



Published on

Published in: Education, Technology, Business

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. contents][ Migrating to Oracle Database 11g This content was adapted from Internet.coms DatabaseJournal and InternetNews Web sites Contributors: Clint Boulton, Jim Czuprynski, and Steve Callan. 2 2 Introduction By Clint Boulton 3 New Features in Oracle Database 11g By Jim Czuprynski 3 10 10 Database Migration: A Planned Approach By Steve Callan 11 Hiring a DBA? 7 Interview Questions By Sean Hull11Migrating to Oracle Database 11g, An IT Management eBook.© 2007, Jupitermedia Corp.1
  • 2. [ Migrating to Oracle Database 11g ] Migrating to Oracle Database 11g By Clint Boulton SQL performance analyzer to let users test changesI n its 30th year, Oracles database is the most established software of its kind in the lot, showing against real-life workloads. The idea is to fine-tune that a mature product is OK as long as you lavish it them in a couple of days rather than months and putwith new perks. changes into production.Innovation is the key theme for Oracles Database Oracle Data Guard, the disaster-recovery technology,11g, which company President Charles Phillips and has also been upgraded in 11g, now allowing cus-other executives introduced at a launch event in New tomers to use their standby databases to improve per-York in July. formance in their production environments as well as provide protection from sys-While some analysts have tem failures and disasters.pegged the update asincremental over the previ- The technology now allowsous 10g database, there is simultaneous read andno mistaking 11g for old recovery of a single standbyhat; more than 400 new database, making it avail-features, including new able for reporting, backup,manageability features and testing and upgrades totesting utilities, dominate production databases.the release. Tired of spending thou-"People always need to sands of dollars on disks?manage more data, and the Mendelsohn said Oraclethings they need to do with Database 11g has signifi- Jupiterimagesdata become more com- cant new compressionplex," Phillips said. "Weve got to keep up. So we con- capabilities to further cut the number of disks and costtinue to have these innovations year after year after of storage.year... This is really rocket science." In one scenario, Mendelsohn showed how a customerAmong the core new features in 11g is Real Application using a combination of tiered storage (for high-per-Testing, which lets customers test and manage changes forming, less active and historical data) with the newto their IT environments quickly. compression technologies in 11g can trim a storage budget from almost $1 million to under $60,000 a year.Andrew Mendelsohn, senior vice president of DatabaseServer Technologies at Oracle, said the technology 11g also boasts something Oracle calls Total Recall,combines a workload capture-and-replay feature with a which allows administrators to query table data from the2 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 3. [ Migrating to Oracle Database 11g ]past. The idea is to bring a heretofore-unprecedented beyond column-level encryption to scramble data intime dimension to data for tracking changes, which in entire tables, indexes, and other data storage.turn leads to more intelligent auditing and compliance. Noting figures from Gartner that put Oracles databaseFor unstructured data such as images and large text market share at 47 percent -- more than the combinedfiles, 11g has Fast Files, which stores a lot of informa- market shares for IBMs DB2 Universal Database andtion but retrieves it really fast. Microsofts SQL Server -- Phillips said 11g is a continu- ation of Oracles practice of carving out the databaseSecurity, of course, is always a major concern, with data technology roadmap for the industry.breaches (hello T.J. Maxx, et al.) and compliance regu-lations keeping CIOs on their heels. In 11g, Oracle has "We dont mind defining the roadmap for them,"boosted its Transparent Data Encryption capabilities Phillips said, chuckling. ■New Features in Oracle Database 11gBy Jim CzuprynskiI spent several months participating in the Oracle Database 11g beta evaluation program. Even though Oracle Database 10g impressed me with the breadthof its changes, Im still trying to wrap my brain aroundthe even more impressive upgrades in this next release.Here are some of my personal favorites among theplethora of Oracle Database 11gs new features.No. 1: Result CachesIve often wished that the Oracle database would pro-vide a method to retain in memory the result set from acomplex query that contains what I like to call referenceinformation. These are data that hardly ever change, Jupiterimagesbut must still be read and used across multiple applica-tions -- for example, a list of all country codes and theircorresponding names for lookup when processing • Finally, the client result cache can retain results fromaddresses for new international customers, or a list of queries or functions on the application server fromall ZIP Codes in the Midwestern US. which the call originated.Oracle Database 11g fills this gap with three new struc- By retaining result sets in these in-memory caches, thetures called result caches, and each structure has a dif- results are immediately available for reuse by any userferent purpose: session. For user sessions that connect to the database through an application server, the client cache permits • The SQL query result cache is an area of memory in those sessions to simply share the results that are the Shared Global Area (SGA) that can retain the already cached on the application server without hav- result sets that a query generates. ing to reissue a query directly against the database. These result caches therefore hold great promise for • The PL/SQL function result cache can store the eliminating unnecessary "round trips" to the database results from a PL/SQL function call. server to collect relatively static reference data that still3 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 4. [ Migrating to Oracle Database 11g ]needs to be shared across many application servers or tion code, database patch set, or hardware configura-user sessions - a potentially immense improvement in tion will affect that databases performance. That usual-overall database throughput. ly meant purchasing a relatively expensive third-party package (e.g., Mercury Interactives LoadRunner) toNo. 2: Improved SQL Tuning generate a sample workload against the database using the next version of the application code, and then comparing the results against baseline perform-If youve already experienced the advice for SQL per- ance for the current application code version.formance improvements that Oracle Database 10gsSQL Tuning Advisor and SQL Access Advisor provide, Fortunately, Oracle Database 11g has come to the res-youll be pleasantly surprised with Oracle Database 11gs cue with two new utilities that offer monumental stridesenhanced SQL tuning capabilities. Heres a brief sample: forward in system testing: • SQL statements can now tune themselves via an • Database Replay. Database Replay can capture expansion to the automatic SQL tuning features that generated workloads from production systems at the were introduced in Oracle Database 10g. database level. Therefore, its no longer necessary to run actual application code to dupli- “ • Statistics for the Cost-Based cate the load on the database, and Optimizer (CBO) are now published this also improves accuracy of the separately from being gathered. If youve already simulated workload because it limits This means that recomputed statis- experienced the or removes other factors like network tics for the CBO will not necessarily latency. These captured workloads cause existing cursors to become advice for SQL per- can then be replayed on a quality invalidated. formance improve- assurance database so that the ments that Oracle impact of application changes, soft- • Multi-column statistics can be col- Database 10gs SQL ware patches, and even hardware lected for two or more columns in a Tuning Advisor and upgrades can be measured accurate- table. This gives the CBO the ability ly. This feature is especially valuable in to more accurately select rows SQL Access Advisor detecting performance issues that based on common multi-column provide, youll be could potentially hamstring a produc- conditions or joins. pleasantly surprised tion databases performance that with Oracle Database might go otherwise undetected until • SQL Access Advisor can now 11gs enhanced SQL well after changes have been make recommendations on how deployed. partitioning might be applied to tuning capabilities. ” existing tables, indexes, and materi- • SQL Performance Analyzer. A robust alized views to improve an applica- complement to the Database Replay tions performance. facility, the SQL Performance Analyzer (SPA) lever- ages existing Oracle Database 10g SQL tuning com- • Oracle Database 11g now supports retention of his- ponents. The SPA provides the ability to capture a torical execution plans for a SQL statement. This specific SQL workload in a SQL Tuning Set, take a means that the CBO can compare a new execution performance baseline before a major database or plan against the original plan and, if the old plan still system change, make the desired change to the sys- offers better performance than the new one, it can tem, and then replay the SQL workload against the decide to continue to use the original execution plan. modified database or configuration. The before and after performance of the SQL workload can then beNo. 3: New System Testing Tools compared with just a few clicks of the mouse. TheAs a DBA, one of the most bedeviling problems that DBA only needs to isolate any SQL statements thatIve regularly faced is to be able to predict accurately are now performing poorly and tune them via thehow the next set of changes to the databases applica- SQL Tuning Advisor.4 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 5. [ Migrating to Oracle Database 11g ]No. 4: Advisors and Fault Diagnostics • Support Workbench. Though its stored outside of the database itself, the ADR can be accessed viaOracle Database 10g introduced an impressive pletho- either Enterprise Manager or command-line utilities.ra of database performance advisors like the Segment Once the ADR has detected and reported a criticalAdvisor, the Undo Advisor, the SQL Access Advisor, the problem, the DBA can interrogate the ADR, reportSQL Tuning Advisor, the MTTR Advisor, and the ulti- on the source of the problem, and in some casesmate expert system for tuning database performance: even implement repairs through the Supportthe Automatic Database Diagnostic Monitor (ADDM). Workbench, a new facility thats part of Enterprise Manager.Oracle Database 11g expands this advisory frameworkwith several new Database Repair Advisors. The chief • Incident Packaging Service. If the problem cant begoals of these new Advisors are to locate root causes solved using these tools, it may be time to ask forof a failure, identify and present options for repairing help from Oracle Support. The new Incidentthese root causes, and even correct the identified Packaging Service (IPS) facility provides tools forproblems with self-healing mechanisms. Oracle gathering and packaging all necessary logs thatDatabase 11g also adds a series of improved fault Oracle Support typically needs to resolve a Servicediagnostics to make it extremely easy for even an Request.inexperienced DBA to detect and quickly resolveproblems with Oracle Database 11g. Here are the • Hang Manager. Oracle Database 10g introducedhighlights of these new features: the Hang Analysis tool in Enterprise Manager, and “ Oracle Database 11g also adds a series of improved fault diagnostics to make it extremely easy for even an inexperienced DBA to detect and quickly resolve problems with Database Oracle 11g. • Automatic Health Monitoring. When a problem within the database is detected, the new Health ” Oracle Database 11g now expands this concept with the Hang Manager. Through a series of dynamic views, it allows the DBA to traverse whats called a Monitor (HM) utility will automatically perform a hang chain to determine exactly which processes and series of integrity checks to determine if the problem sessions are causing bottlenecks because they are can be traced to corruption within database blocks, blocking access to needed resources. And since its redo log blocks, undo segments, or dictionary table activated by default on all single-instance databases, blocks. HM can also be fired manually to perform RAC clustered databases, and ASM instances, its checks against the databases health on a periodic now possible to track down the source of a hang basis. from one end of the system to the other. • Automatic Diagnostic Repository. The Automatic Diagnostic Repository (ADR) is at the heart of Oracle No. 5: Flashback Enhancements Database 11gs new fault diagnostic framework. The Oracle Database 10g dramatically expanded database ADR is a central, file-based repository external to the recoverability with the ability to perform an incom- database itself, and its composed of the diagnostic plete recovery of the database with Flashback data -- alert logs (in XML format), core dumps, back- Database. Oracle Database 10g also provided four ground process dumps, and user trace files -- collect- new logical database recovery features: Flashback ed from individual database components from the Table, Flashback Drop, Flashback Version Query, and first moment that a critical error is detected. Flashback Transaction Query. Oracle Database 11g expands this arsenal of recovery tools with two new5 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 6. [ Migrating to Oracle Database 11g ]Flashback features: tively called SecureFiles, will allow Oracle Database • Flashback Transaction. Essentially an extension of 11g to store images, extremely large text objects, and the Flashback Transaction Query functionality intro- the more advanced datatypes introduced in prior duced in Oracle Database 10g, Flashback Transaction Oracle releases (e.g., XMLType, Spatial, and medical allows the DBA to back out of the database one or imaging objects that utilize the DICOM [Digital Imaging more transactions -- as well as any corresponding and Communications In Medicine] format). dependent transactions -- by applying the appropri- ate reciprocal UNDO statements for the affected SecureFiles promises to offer performance that com- transaction(s) to the corresponding affected rows in pares favorably with file system storage of these object the database. types, as well as the ability to transparently compress and "deduplicate" these data. (Deduplication is yet • Total Recall. This new feature offers the ability to another brand-new feature in Oracle Database 11g. It retain the reciprocal UNDO information for critical data can detect identical LOB data in the same LOB column significantly beyond the point in time that it would be thats referenced in two or more rows, and then stores flushed out of the UNDO tablespace. Therefore, its just one copy of that data, thus reducing the amount of now possible to hold onto these reciprocal transac- space required to store these LOBs.) Perhaps most tions essentially indefinitely. Once this feature is importantly, Oracle Database 11g will also ensure that enabled, all retained transaction history can be viewed, these data can be encrypted using Transparent Data and this eliminates the cumbersome task of creating Encryption (TDE) methods - especially important (and corresponding history tracking tables for critical trans- welcome) in the current security-conscious environ- actional tables. And as you might expect, Oracle ments we inhabit today as database administrators. Database 11g also provides methods to automatically purge data retained in the data archive once a speci- No. 7: Improved Database Security fied retention period has been exceeded. Oracle Database 10g Release 2 dramatically improved the options for encrypting sensitive data both withinNo. 6: SecureFiles Oracle database tables and indexes, as well as outsideOracle Database 11g provides a series of brand-new the database (i.e., RMAN backups and DataPumpmethods for storing large binary objects (also known as export files) with Transparent Data Encryption (TDE).LOBs) inside the database. These new features, collec- Oracle Database 11g continues to expand the use of The concept of a virtual column – a column whose value is simply the result of an expression, but which is not stored physically in the database – is a powerful new construct in Oracle Database 11g. Jupiterimages6 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 7. [ Migrating to Oracle Database 11g ]TDE within the database. For example, its now possi- Row-Level Security (RLS) policies.ble to encrypt data at the tablespace level as well asthe table and index level. Also, logical standby data- • Finally, an RMAN recovery catalog can now bebases can utilize TDE to protect data thats been trans- secured via Virtual Private Catalog to prevent unau-ferred from its corresponding primary standby database thorized users from viewing backups that are regis-site. Moreover, secured storage of the TDE master tered within the catalog.encryption key is ensured by allowing it to be storedexternally from the database server in a separate No. 8: Partitioning UpgradesHardware Security Module. Oracle Database 10g made a few important improve-Secure By Default. Oracle Database 11g also imple- ments to partitioned tables and indexes (e.g., hash-par-ments a new set of out-of-the-box security enhance- titioned global indexes), but Oracle Database 11g dra-ments that are collectively called Secure By Default. matically expands the scope of partitioning with severalThese security settings can be enabled during data- new composite partitioning options: Range Withinbase creation via the Database Configuration Assistant Range, List Within Range, List Within Hash, and List(DBCA), or they can be enabled later after the data- Within List. And thats not all:base has been created. Heres a sample of these newsecurity features: • Interval Partitioning. One of the “ more intriguing new partitioning • Every user account password is options, interval partitioning is a spe- Oracle Database 11g cial version of range partitioning that now checked automatically to ensure sufficient password complex- adds a third standby requires the partition key be limited ity is being used database type, the to a single column with a datatype of either NUMBER or DATE. Range par- snapshot standby • To further strengthen password titions of a fixed duration can be database, thats specified just like in a regular range security, the DEFAULT user profile created by converting partition table based on this partition now sets standard values for pass- word grace time, lifetime, and lock an existing physical key. However, the table can also be time, as well as for the maximum standby database to partitioned dynamically based on number of failed login attempts this format. which date values fall into a calculat- ed interval (e.g., month, week, quar- • Auditing will be turned on by default for over 20 of the most sensitive DBA activi- ties (e.g., CREATE ANY PROCEDURE, GRANT ANY PRIVILEGE, DROP USER, and so forth). Also, the ” ter, or even year). This enables Oracle Database 11g to create future new partitions automatically based on the interval speci- fied without any future DBA intervention. AUDIT_TRAIL parameter is set to DB by default when the database is created, so this means that a data- • Partitioning On Virtual Columns. The concept of a base "bounce" will no longer be required to activate virtual column - a column whose value is simply the auditing result of an expression, but which is not stored physi- cally in the database - is a powerful new construct in • Fine-Grained Access Control (FGAC) is now avail- Oracle Database 11g. Its now possible to partition a able for network callouts when using raw TCP (e.g., table based on a virtual column value, and this leads via the UTL_TCP package), FGAC will be able to con- to enormous flexibility when creating a partitioned struct Access Control Lists (ACLs) to provide fine- table. For example, its no longer necessary to store grained access to external network services for spe- the date value that represents the starting week date cific Oracle Database 11g database user accounts. for a table that is range-partitioned on week number; the value of week number can be simply calculated • Enterprise Manager now provides interfaces for as a virtual column instead. direct management of the External Security Module (ESM), Fine-Grained Auditing (FGA) policies, and • Partitioning By Reference. Another welcome parti-7 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 8. [ Migrating to Oracle Database 11g ] tioning enhancement is the ability to partition a table • Fast Mirror Resynchronization. An ASM disk group that contains only detail transactions based on those thats mirrored using ASM two-way or three-way mir- detail transactions relationships to entries in another roring could lose an ASM disk due to a transient fail- partitioned table that contains only master transac- ure (e.g., failure of a Host Bus Adapter, SCSI cable, or tions. The relationship between a set of invoice line disk I/O controller). Should this occur, ASM will now items (detail entries) that corresponds directly to a utilize the Fast Mirror Resynchronization feature to single invoice (the master entry) is a typical business quickly resynchronize only the extents that were example. Oracle Database 11g will automatically affected by the temporary outage when the disk is place the detail tables data into appropriate subpar- repaired, thus reducing the time it takes to restore titions based on the foreign key constraint that estab- the redundancy of the mirrored ASM disk group. lishes and enforces the relationship between master and detail rows in the two tables. This eliminates the • Preferred Mirror Read. An ASM disk group thats need to explicitly establish different partitions for mirrored using ASM two-way or three-way mirroring both tables because the partitioning in the master requires the configuration of failure groups. (A failure table drives the partitioning of the detail table. group defines the set of disks across which ASM will mirror allocation units; this ensures that the loss of • Transportable Partitions. Finally, Oracle Database any disk(s) in the failure group doesnt cause data 11g makes it possible to transport a partitioned tables loss.) In Oracle Database 11g, its now possible to individual partitions between a source and a target inform ASM that its acceptable to read from the database. This means its now possible to create a nearest secondary extent (i.e., the extent thats really tablespace version of one or more selected partitions supporting the mirroring of the ASM allocation unit) if of a partitioned table, thus archiving that partitioned that extent is actually closer to the node thats portion of the table to another database server. accessing the extent. This feature is most useful in a Real Application Clusters (RAC) database environ-No. 9: ASM Enhancements ment, especially when the primary mirrored extent is not local to the node thats attempting to access theOracle Database 10g introduced Automatic Storage extent.Management (ASM) that at its essence is a file systemspecifically developed for Oracle database files. Oracle • Resizable Allocation Unit. Oracle Database 11gDatabase 11g expands the reach of ASM with several now permits an ASM allocation unit to be sized atnew features, including: either 2, 4, 8, 16, 32, or 64 MB when an ASM disk group is first created. This means that larger sequen- • SYSASM Role. A new role, SYSASM, has been cre- tial I/O is now possible for very large tablespaces, ated so that ASM instances can be managed sepa- and/or tablespaces with larger block sizes. The extent rately from the roles typically granted for traditional size is now automatically increased as necessary and Oracle database instance management. this allows an ASM file to grow up to the maximum of 128 TB as supported by Bigfile Tablespaces (BFTs). • ASM Rolling Upgrades. One of the most popular and sensible uses of ASM is in a Real Applications • Improved ASMCMD Command Set. ASMCMD now Cluster (RAC) environment. Oracle Database 10g includes several new commands that increase visibili- made it possible to initiate a rolling patch set ty of ASM disk group information, support faster upgrade to the software in the Oracle database restoration of damaged blocks, and retain and home on each node in the cluster. This ensures that restore complex metadata about disk groups: the clustered database remains accessible at all times because at least one Oracle database instance is • A system / storage administrator can execute the active while the patch set is applied to the other lsdsk command to view a list of all ASM disks even if node(s). The good news is that Oracle Database 11g an ASM instance is not currently running. now extends this concept to ASM instances in a RAC clustered environment. • The remap command utilizes the existing backup of a damaged block on an ASM-mirrored disk group to8 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 9. [ Migrating to Oracle Database 11g ] recover the damaged block to an alternate location standby again. elsewhere in the ASM disk group. • Rolling Database Upgrades Support Physical • Commands md_backup and md_restore allow a Standby Databases. Oracle Database 10g introduced DBA to back up and restore, respectively, the meta- the ability to utilize SQL Apply to perform rolling data reflecting the exact structure of an ASM disk upgrades against a primary database and its logical group. These new commands are an immense boon standby database. During a rolling upgrade, the DBA because the recreation of extremely large disk groups first upgrades the logical standby database to the lat- consisting of several dozen mount points can be est database version, and then performs a switchover tedious, time-consuming, and prone to error. to make the standby database the primary and vice versa. The original primary database is then upgrad-No. 10: Data Guard Enhancements ed to the new database version, and a switchover reverses the roles once again. This ensures that theLast but most certainly not least, Oracle Database 11g only interruption to database access is the time itadds plenty of enhancements to its flagship high-avail- takes to perform the switchovers. The good news isability solution for site survivability, Data Guard: that Oracle Database 11g now allows a rolling data- base upgrade to be performed on a physical standby • Snapshot Standby Database. Prior versions of database by allowing the physical standby to be con- Oracle Database supported two types of standby verted into a logical standby database before the databases: the physical standby, which is an exact upgrade begins. After the rolling upgrade is complet- duplicate of the primary database and is updated via ed, the upgraded logical standby is simply reconvert- direct application of archived redo logs; and the logi- “ Migrating from one version to another may be as simple as exporting the old and importing into the new, but chances are there is a lot more involved than first meets the eye. cal standby, which contains the same logical informa- tion as the primary database, but whose data is ” ed back into a physical standby. organized and/or structured differently than on the • Real-Time Query Capability. Active Data Guard will primary database and which is updated via SQL now allow the execution of real-time queries against Apply. Oracle Database 11g adds a third standby a physical standby database, even while the physical database type, the snapshot standby database, thats standby continues to receive and apply redo transac- created by converting an existing physical standby tions via Redo Apply. (In prior releases, the physical database to this format. A snapshot standby data- standby could only be accessed for reporting if it was base still accepts redo information from its primary, opened in read-only mode while the application of but unlike the first two standby types, it does not redo was suspended.) This means that a physical apply the redo to the database immediately; instead, standby database can be utilized more flexibly for the redo is only applied when the snapshot standby read-only reporting purposes; also, the considerable database is reconverted back into a physical standby. resources needed to create and maintain the standby This means that the DBA could convert an existing environment may now be put to much more effective physical standby database to a snapshot standby for use. testing purposes, allow developers or QA personnel to make changes to the snapshot standby, and then • Expanded DataType and Security Support. Oracle roll back those data created during testing and Database 11g now supports XMLType data stored in immediately reapply the valid production redo data, CLOB datatypes on logical standby databases. In thus reverting the snapshot standby to a physical addition, Transparent Data Encryption (TDE) can now9 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 10. [ Migrating to Oracle Database 11g ] support encrypted table data as well as encrypted Conclusion tablespaces, and Virtual Private Database (VPD) is supported for logical standby databases. Oracle Database 11g continues to improve upon the massive paradigm shift in Oracle Database 10g • Heterogeneous Data Guard. Finally, its now possi- toward self-managed, self-tuning, and self-healing ble to set up the primary database site using one databases. These automatic database management operating system (e.g., Oracle Enterprise Linux 4.4) features will be especially valuable to IT organizations while using another operating system (e.g., Windows that continue to struggle with ever-larger databases 2003 Server) for the standby database site. and ever-increasing computing workloads while attempting to answer the demand for lowered costs and value-added service. ■Database Migration: A Planned ApproachBy Steve CallanA fairly common event in a databases lifecycle is that of the migration from version "older" to version "newer." Migrating from one version toanother may be as simple as exporting the old andimporting into the new, but chances are there is a lotmore involved than first meets the eye. It is not uncom-mon to also incorporate other significant changes suchas an operating system change, a schema modification,and changes to related applications. Each change hasits own inherent risk, but lumping them together in oneoperation flies in the face of common sense, even moreso without having tested the migration from start toend. Amazingly, this situation occurs all too often. JupiterimagesFrom a software engineering standpoint, is it safe or abest practice to heap so many significant changestogether in one step? Further, wouldnt it seem obvious Separate the Knownthat you would want to not only practice the migration, from the Unknownbut test the changes before actually applying them to For non-leading edge/early adopter/early imple-your live/production environment? menters of a new version of Oracle, by the time you (and your company) are ready to migrate from an olderHere is something else to consider: break a dependen- version of the RDBMS software to a newer one, manycy chain before it breaks you and the migration others will have gone before you. Likewise, many oth-process. Given the scenario of migrating from Oracle ers have already crossed over to the dark side by hav-10g to 11g, changing the underlying operating system ing adopted Linux as their underlying Linux from Solaris, modifying major tables within aschema, and running newer/modified versions of relat- Considering the combined RDBMS/OS version changeed applications, where are the places you can break the as the known. Where your production database lives independency chain? Put another way, what are the terms of version and OS is a logical place to break thesafer/well-known/"charted by many others before you" dependency chain. In an all-or-nothing, do-or-diesteps, and which are the uncharted/"applies only to migration scenario, failure means losing the time spentyou" steps? on what is perhaps the simplest part of the scenario,10 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 11. [ Migrating to Oracle Database 11g ]namely the hours spent on exporting and importing. Ifyou can separate the overall migration into at least twodistinct stages, you will have broken the dependencychain into smaller chains. The guiding principle/lessonto be learned here is to move from point A to D viasafe, incremental steps.How your database operates with respect to schemaand application interaction is up to you to determine.Until you have thoroughly test-driven schema andapplication changes, this part of the overall migrationprocess stays in the realm of the unknown. Going live Hiring a DBA? Jupiterimagesand finding out - for the first time - that the new appli-cation/database code results in cascading triggers(thereby bringing an instance to its knees, so to speak)is obviously a poor time to become aware of this situ- 7 Interview Questionsation. Developers and testers using 100 records as a by Sean Hulltest size when the production environment containstens of millions of records are hardly conducting athorough test. There are nearly an infinite number and combi- nation of questions one can pose to a DBA can-Export and Import via didate in an interview. I prefer to lean towardsa Proactive Approach the conceptual, rather than the rote, as ques- tions of this kind emphasize your foundationWith respect to the export and import utilities, you do and thorough understanding. Besides, Ivenot have to accept the default parameters. In fact, you never been one to remember facts and details Iowe it to yourself to use quite a few non-default set- can lookup in a reference. Therefore, with thattings, and doing so makes the process easier to per- in mind, here are some brainteasers for you toform and saves time when it is time do it for real. Lets ponder over.look at the indexfile parameter as a start. There are (atleast) four excellent reasons to use indexfile=filename 1. Why is a UNION ALL faster than a UNION?on an import. The union operation, you will recall, brings twoThe first is that the output documents the storage of sets of data together. It will not, however, pro-tables and indexes (all or some, depending on what duce duplicate or redundant rows. To performwas included in the export dump file). Where is your this feat of magic, a SORT operation is done onsource code for schema creation? If you do not have both tables. This is obviously computationallysource code, this parameter (along with a fairly simple intensive, and uses significant memory as well. A UNION ALL conversely just dumps collectionquery that returns everything else) goes a very long way of both sets together in random order, not wor-toward providing that information. The query part is rying about duplicates.spooling out the contents of all or user_source. Codefor packages, package bodies, procedures, functions, 2. What are some advantages to using Oraclesand triggers will be included in the output. With very CREATE DATABASE statement to create alittle editing such as adding "create or replace" and new database manually?cleaning up SQL*Plus artifacts (i.e., feedback, heading,page breaks - if these werent suppressed to begin • You can script the process to include it in a setwith), you are left with the current source for a signifi- of install scripts you deliver with a product.cant portion of a schema. • You can put your create database script in CVS for version control, so as you make changesThe second is that if you are going to do any house-11 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 12. [ Migrating to Oracle Database 11g ]cleaning or rearranging of tables and indexes, now is thetime to edit the indexfile and update tablespace map- 7 Interview Questions continuedpings and storage parameters. If the logical layout is to or adjustments to it, you can track them like youremain the same, then the third reason comes into play. do changes to software code. • You can log the output and review it forSeparate the tables from the indexes; that is, separate errors.the SQL create statements (one script for tables, the • You learn more about the process of databaseother for indexes). Do as much as you can on the target creation, such as what options are available anddatabase before it is time to do the actual migration. why.Part of this includes creating the same/new tablespacesand running the create tables script. Run the create 3. What are three rules of thumb to create goodtables script ahead of time for two reasons: one is to passwords? How would a DBA enforce thosevalidate the logical layout, the other is to help speed rules in Oracle? What business challengesup the import (concepts question: how does import might you encounter?work if an object exists or does not exist?). Typical password cracking software uses a dic- tionary in the local language, as well as a list ofThe fourth reason comes back to the indexes listed in proper names, and combinations thereof tothe indexfile. Performance-wise, when doing bulk attempt to guess unknown passwords. Sinceinserts, is it better to have indexes or not? What hap- computers can churn through tens of thousandspens when a new record is inserted? One or more of attempts quickly, this can be a very effectiveindexes have to be updated (assuming there is at least way to break into a database. A good passworda primary key for that record). Oracles recommenda- therefore should not be a dictionary word; ittion is that (for large databases) you should hold off on should not be a proper name, birthday, or othercreating indexes until after all the data has been insert- obvious guessable information. It should also beed. Again, this comes back to the importance of the of sufficient length, such as eight to 10 charac-indexfile because it is the link between export using ters, including upper and lowercase, special"indexes=n" (the default is y) and your being able to characters, and even alternate characters if pos-re-create the indexes after the data has been loaded. sible. Oracle has a facility called password securityIts More than Running exp and imp profiles. When installed they can enforce com- plexity, and length rules as well as other pass-The new server using Red Hat is up and running, Oracle word related security measures.RDBMS software has been installed, a new instance isrunning with all of the new features you can possibly In the security arena, passwords can be madeimagine, and "all" thats left to do is migrate the source better, and it is a fairly solvable problem. Whatdatabase (or schema) to the new/target database. It is about in the real world? Often the biggest chal-midnight Friday and you have an eight-hour planned lenge is in implementing a set of rules like thisoutage/maintenance period available to perform the in the enterprise. There will likely be a lot ofmigration. What can you do prior to midnight Friday to resistance to this, as it creates additional has-make the migration as painless as possible? Lets look sles for users of the system who may not beat four areas where planning can make a difference: used to thinking about security seriously.general administration, the export phase, the import Educating business folks about the real risks,phase, and a handoff phase. by coming up with real stories of vulnerabilities and break-ins youve encountered on the job, or those discussed on the internet goes a long wayGeneral Administration/ towards emphasizing what is at stake.Project Planning 4. Describe the Oracle Wait Interface, how itYou are the one in charge of the database migration. works, and what it provides. What are someQuestion: What do you and Hannibal from "The A-12 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 13. [ Migrating to Oracle Database 11g ]Team" have in common? Answer: "I love it when a plancomes together." 7 Interview Questions continued limitations? What do theTo help make the plan come together, fire up Visio or db_file_sequential_read and db_file_scat-PowerPoint and diagram a workflow process. As a mini- tered_read events indicate?mum, you can take the low-tech route and come upwith a timeline. Even if you start with brainstorming and The Oracle Wait Interface refers to Oracles datawriting down ideas as they come to mind, you will be dictionary for managing wait events. Selectingmuch better off having everyone on the same sheet of from tables such as v$system_event and v$ses-music. Items to consider include: sion_event give you event totals through the life of the database (or session). The former are • Diagramming the workflow/process, coordination totals for the whole system, and latter on a per meetings session basis. The event db_file_sequential_read refers to single block reads, and table accesses • Assign responsibilities among team members, by rowid. db_file_scattered_read conversely establish roles and responsibilities refers to full table scans. It is so named because the blocks are read, and scattered into the • Create and distribute a contact list, include how to buffer cache. get in touch with other key personnel (managers, sys- 5. How do you return the top-N results of a tem administrators, testing, developers, third query in Oracle? Why doesnt the obvious party/application providers, customers, account man- method work? agers, etc.) Most people think of using the ROWNUM • Hours of operation for Starbucks (some of them pseudocolumn with ORDER BY. Unfortunately open an hour later on Saturdays) the ROWNUM is determined before the ORDER BY so you dont get the results you want. The • After hours building access for contractors (meet at answer is to use a subquery to do the ORDER a designated place and time?) BY first. For example to return the top five employees by salary: • Janitorial services - do they alarm the building/office when they are done? There is nothing SELECT * FROM (SELECT * FROM employees like an alarm going off, as you walk down the hall, to ORDER BY salary) WHERE ROWNUM < 5; add a little excitement to the evening. 6. Can Oracles Data Guard be used on • Notification to security/police regarding after hours Standard Edition, and if so how? How can you presence ("Really Officer, we work here, were not just test that the standby database is in sync? sitting here looking like we work here") Oracles Data Guard technology is a layer of • Establishing a transfer point on the file system and software and automation built on top of the ensuring there is enough disk space for the export standby database facility. In Oracle Standard Edition it is possible to be a standby database, • Acquiring a complete understanding of schema and update it manually. Roughly, put your pro- duction database in archivelog mode. Create a changes (how and when key tables get altered/modi- hotbackup of the database and move it to the fied, to include data transformation processes) standby machine. Then create a standby con- trolfile on the production machine, and ship • Establish a work schedule (does every DBA need to that file, along with all the archived redolog be present the entire time, or can schedules be stag- files to the standby server. Once you have all gered?) these files assembled, place them in their prop- er locations, recover the standby database, and13 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 14. [ Migrating to Oracle Database 11g ]Pre-Export and Export Phase 7 Interview Questions continuedAside from a shortage of time, there is very little to youre ready to roll. From this point on, youprevent you (or the person in charge of export) from must manually ship, and manually apply thosepracticing the export several times over and ensuring archived redologs to stay in sync with produc-there are no glitches in this part of the plan. Does the tion.export have to be a one-step, A to Z process? Howabout phasing the export by functional groups? To test your standby database, make a change toConsider breaking up the export into functional a table on the production server, and commitgroups: support tables, main tables, altered tables, and the change. Then manually switch a logfile sohistorical/static tables. those changes are archived. Manually ship the newest archived redolog file, and manuallyBy grouping tables in this manner, you can interleave apply it on the standby database. Then openexport and import. Once the export of a group is your standby database in read-only mode, andcomplete, you can start its corresponding import. It select from your changed table to verify thosemay take two hours to export and four hours to changes are available. Once youre done, shut-import, but that does not mean it takes six consecu- down your standby and startup again in standbytive hours. Why is there a time difference between mode.export and import? Export and import are not one toone. Export will run quite a bit faster than import, and 7. What is a database link? What is the differ- ence between a public and a private database “ Aside from a shortage of time, there is very little to prevent you (or the link? What is a fixed user database link? A database link allows you to make a connec- tion with a remote database, Oracle or not, and person in charge of export) from query tables from it, even incorporating those accesses with joins to local tables. practicing the export several times over and ensuring there are no glitches in A private database link only works for, and is this part of the plan. accessible to the user/schema that owns it. Any user in the database can access a global one. ”both can run faster if optimized a bit. Do not forgetthat indexes are not being exported. Indexes will be A fixed user link specifies that you will connect to the remote db as one and only one user that is defined in the link. Alternatively, a currentre-built after the data is loaded in the target data- user database link will connect as the currentbase. How are you driving the exports: interactive user you are logged in as.mode or use of shell scripts and parameter files? Shellscripts should have four key features: As you prepare for your DBA Interview, or pre- pare to give one, we hope these questions pro- • An interview process vide some new ideas and directions for your study. Keep in mind that there are a lot of direc- • Feedback, or a summary of what was entered tions an interview can go. As a DBA, emphasize what you know, even if it is not the direct • Existence checks (includes parameter files, ability to answer to the question, and as an interviewee, write to the dump and log file locations, and data- allow the interview to go in creative directions. base connectivity) In the end, what is important is potential or apti- tude, not specific memorized answers. So listen • Bail out mechanisms ("Do you want to continue?") for problem-solving ability, and thinking outside after key steps or operations the box, and you will surely find or be the candi- date for the job. ■14 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 15. [ Migrating to Oracle Database 11g ]One script can drive the entire export process, and the For tables undergoing a modification, questions to askbail out points can be used as signals (accompanied by include where, when, and how does that take place?extensive use of echo statements, which denote where Do the changes occur within the users schema, oryou are in the process). A key metric to be determined within a temporary or migration schema, followed bywhile practicing and refining the scripts is that of the "insert into new version of table as select from temptime it takes to perform all exports. table?"If a schema migration is taking place (as opposed to a Fully understand how major tables are being changed -full database migration), what are the dependencies you may take for granted what appear to be ash andamong schemas? Look for names/items such as trash "not null" constraints, but application changesbuild_manager, process_logger, and stage (more ger- may completely rely upon them. In other words, it maymane to a warehouse). "Build_manager" (as an exam- not be enough to take care of PK, FK and unique con-ple of a name) may contain common or public func- straints when trying to rebuild a table on the flytions, procedures and packages. because there was some hiccup inProcess_logger may be the owner the process.of process logs for all schemas (fair-ly common if you see "pragma What about cron and databaseautonomous_transaction" in the jobs? How are youtext of a source; it is a way of cap- migrating/exporting all of those?turing errors during failed transac- Something that frequently goestions). Unless the new schema hand-in-hand with cron jobs is e-incorporates these external or mail. Is the new server configuredassociated schemas, some or all of for e-mail notification? Are therethese otherwise "Left Behind" any database links to create?schemas need to be accounted forin the target database. Do you need logging turned on while the import is taking place? IsWhile the export is taking place, it even necessary to log every-what is happening with the non- thing being imported? Whatexported schemas? You may need about triggers, especially the "forto disable connections, change each row" kind? Millions of rowspasswords, disable other process- inserted via import equals millionses, and suspend crons while the of times one or more triggers firedexport is taking place. Web appli- on a table with that kind of trig-cations connections tend to be like ger. If the trigger on a table back Jupiterimagescrabgrass (i.e., hard to kill), and an on the source database alreadyeffective way of stopping them is to change a pass- took care of formatting a name, does it need to beword. Finally, what is the disposition of the source data- fired again during an import?base, that is, assuming your plan comes together? You can be clever and disable quite a few automaticImport phase functions to help speed up the import, but dont be too clever by half, that is, do not forget to re-enablePractice creating schemas and associated physical/logi- whatever it is you disabled. At 5:30 in the morning,cal objects such as tablespaces and datafiles. The end having worked all day Friday (in addition to comingresult desired here is no ORA-xxxxx errors whatsoever, back at 11 to get ready for the midnight starting gun),and all create scripts should be re-runnable. With sleep deprivation can introduce a significant amount ofrespect to import parameter files, ensure fromuser mar- human error. If you have to go off your game plan,ries up to touser. Using what was gleaned from the have someone double-check your work or steps, espe-indexfile, pre-create tables in the target database. cially if the object being manipulated is of key impor- tance to a database or schema.15 An IT Management eBook. © 2007, Jupitermedia Corp.
  • 16. [ Migrating to Oracle Database 11g ]Post Import Considerations In ClosingDid everything work? Breathe a sigh of relief, but the The tips and steps covered in this article are based onjob is not finished. What are you using for a baseline real events, places, and persons. I have personally wit-backup, once everything is up and running after the nessed the customer service rep complaining aboutmigration? Are you transitioning from export/cold/hot how his changes were not showing up, and it wasbackups to RMAN? Has RMAN backup and recovery because he had no idea whatsoever about pointing hisbeen practiced yet? desktop CRM application to the new database. Was that the responsibility of the DBA or the reps manag-Plan A, obviously, is a success from start to finish. er? I have seen key tables have problems with theHowever, despite all best intentions and planning, what insertion of transformed data and workarounds such asis Plan B? What if, for some undeterminable reason, "create table as select" from the stage or transforma-applications fail to work properly after the migration? tion table implemented, but alas, the stage table didThorough testing minimizes this, but what if no large- not have all of the not null constraints as did the newscale testing took place? What does it take to revert to "real" table, and there goes the Web application downthe source database? Do you have the time to try the drain.again? A second attempt will not take as long assum-ing you trust what took place in the export(s). The sad truism about a database migration is that if you do not have the time to test beforehand andDo not assume everyone knows or understands what wind up failing (the reason why is immaterial), it isjust took place. For example, do customer support per- amazing how time magically appears to perform test-sonnel know how to point desktop CRM applications to ing before the second attempt. The tips mentioned inthe new database? Or are they opening trouble tickets this article should give you a good perspectivea few weeks after the fact to complain how their regarding some the external factors that come intochanges are not being made or are not taking effect? play during a migration. ■What may be blindingly obvious to you as a DBA maybe completely obscure to people who dont speak"database." This content was adapted from Internet.coms DatabaseJournal and InternetNews Web sites Contributors: Clint Boulton, Jim Czuprynski, and Steve Callan.16 An IT Management eBook. © 2007, Jupitermedia Corp.