Ora*PePi [Parallel export Parallel import]

Ora*PePi is a superset of the Oracle export/import tools. PePi is currently capable of :

Ora*PePi makes extensive use of Korn shell and has been tested on AIX 4.3.x and Solaris. Pepi can be used under the GNU General Public License.

Ora*Pepi is a project maintained on SourceForge.


Table of Contents

  1. Overiew
  2. Configuring Ora*PePi
  3. Running Ora*PePi
  4. Tips on tuning your export/import
  5. About the authors
  6. GNU General Public License GPL

Overview

Ora*PePi is a data-driven tool by making use of a control table. This control table contains all tables and partitions that will take part of the export/import processflow. It consists of the following columns :

After configuring Ora*PePi [ run.conf ] the control table will be created in the destination or source database. The control table will be populated with all segments found in the source DB not owned by SYS or SYSTEM. If the table resides in the destination database then a DB LINK will be used for the population. 

Once populated, the control table is used to :

During (and after) execution of the export/import, the control table can be queried to find out how many exp/imp's are running, have failed or still need to run. This also means that you can quickly recover from any errors by updating the status column in the control table to NO_OPERATION and rerun PePi.

If source and destination reside on different hosts - and both hosts can be equipped with multiple network adapters, PePi will provide Net8 load balancing during exp/imp by using these adapters in a randomized way.

PePi - once installed - is run from the 'crontab' using parallel_exp_run.ksh. It actually needs to be run every minute. Every execution, parallel_exp_run.ksh will evaluate the number of processes that are running and will spawn extra processes if necessary to maintain the specified amount of parallel degree. The great advantage here is,  one can change parallel degree parameters, and the next time parallel_exp_run.ksh is run by cron, the new parallel degree can be applied on the fly. It also means that the export/import is resumable - just comment out the crontab entry and wait for the exp/imp processes to finish - kind of like a shutdown transactional. When you want to continue just activate the entry again...

Back to Top

Configuring Ora*PePi

PePi was completely written in Korn shell in an IBM RS6000 AIX environment. We all know there are minor differences between unix flavours (grep/awk/sed/...), so in order to make PePi run on other unix boxes,  one should take a closer look at all parameters and adjust were necessary. First of all make sure you have ksh installed on your system, and that it resides in /usr/bin/ksh (linux users!).

All configuration is done in the file "run.conf". Make sure to take a closer look at the following parameters :

Solaris uses "/usr/xpg4/bin/grep -E"
AIX 4.2x and above use "grep -E"
SVR4 (Unisys, not sure about any other flavour) - use "egrep"

Solaris uses "/usr/xpg4/bin/awk -F"
AIX 4.2x and above use "awk -F"
SVR4 (Unisys, not sure about any other flavour) - uses "awk -F"

Solaris uses "/usr/xpg4/bin/grep -x"
AIX 4.2x and above use "grep -x"
SVR4 (Unisys, not sure about any other flavour) - uses "fgrep -x"

 

 

 

Back to Top

Running Ora*PePi

Preface

When you're performing an export/import of a database you're most probably performing a DB reorg. We first used this kind of massive parallel export/import when we had to reorg a 1TB database with 2000 tables/partitions spread over almost as many tablespaces. Because we wanted to increase the DB block size there was only one way to go - recreate the DB and export/import the full database. Luckily, we had the latest storage server at hand (SSA, Fiber Channel load balancing, 16GB cache etc) - but still ... what better place to store around 650GB of dump files than in a database itself ! So we created a target DB next to the source DB on the same machine. Now, if you have nice big hardware to play with, why do people always run one silly export and import at a time (it's not like it's mulithreaded or anything). So this is were we started off spawning a massive amount of exp/imp processes and did the full exp/imp in 10 hours (I still haven't found anyone who has beaten our record). 

This is nice and all - but when you read this something should tell you that these scripts are fairly useless on your 2-way/ 4 disk Sun box.  PePi will only prove itself useful on BIG unix boxes with a large amount of disks, large amount of FAST I/O controllers (like IBM's ESS Shark or EMC boxes) and big fat juicy databases! I don't think I need to explain why - it'll generate MASSIVE I/O !  

Anyhow - when you're recreating a DB you might as well fiddle around with segment definitions and pre-create them with new storage parameters. For example we revisited pctfree, pctused, initial extent, next extent, pct increase, freelist, freelist group and parallel degree of every table using Pretoria - GUI tools might be easier to use but you can throw them away if you need to click 5 times a segment and you have 2000 of them.

Because this is a table per table (or partition per partition) export/import you'll need to pre-create the Oracle users in the destination database and provide them with the necessary privileges.

parallel_exp_install.ksh

After configuring [ run.conf ] PePi needs to install itself by running parallel_exp_install.sh :

Verify that you DO NOT HAVE A TABLE named in the run.conf as ${CONTROL_TABLE_NAME} that contains user data as it will be DROPPED in favour of this scripts semaphore unit. Also make sure that if your database contains many data segments, that you have adequately sized rollback segments as this script creates its control semaphore with a "CREATE TABLE AS".

parallel_exp_run.ksh

Parallel executes Oracle export/import scripts that were pre-created by the script  "parallel_exp_install.ksh". 
This script accepts three parameters.

 

 

Typically place this script to run from crontab every minute. WARNING - once you have place this script in crontab the whole mechanism of exp/imp process spawning will ignite and a thunderbolt of lightning will strike on your machine ! What we tend to do is start with a small parallel degree (say parallel degree equals number of CPU's) and monitor the unix runqueue and waitqueue. Then we start augmenting the parallel degree parameter for parallel_exp_run.ksh in the crontab. Naturally, this setup will be I/O bound - however - if your disk layout is thoroughly tuned you will be able to fill your runqueue - this should be your goal ... fill the runqueue with a minimum wait for I/O. Example - we have been able to run these scripts with a parallel degree of 256

Back to Top

Tips on tuning your export/import

Supported

Non-supported

These are the ones where the fun kicks in - some people will find this 'unprofessional' but basically everything we describe here we have used ourselves - and sometimes it went terrible wrong. The following tips can result in corrupted databases - so use WITH CARE - OR NOT AT ALL !!! 

Just for the record - we have never ever lost any data - we have excellent backup and recovery procedures as well !

Back to Top

About the authors

Kurt Van Meerbeeck (kurtvm@pandora.be or kurt_van_meerbeeck@axi.be) is an Oracle DBA/Consultant for AXI NV Belgium / AXI BV The Netherlands. His personal webpage is http://zap.to/knal

Kugendran Naidoo (kugenn@absa.co.za) is a freelance Oracle DBA currently working for ABSA Bank, Johannesburg South Africa.

The initial script was written by Kurt Van Meerbeeck - it contained a base locking scheme, parallel simultaneous export/import with on the fly adjustable parallel degree and support for partitions. The code was ugly like a dog and not very user friendly. Kugendran Naidoo redesigned/tuned/cleanup, basically rewrote the whole mess in his spare time and added some nice features (Net8 support + load balancing, large table run ratio, pre-generation of scripts (instead of 'at runtime') and some nifty error trapping) while doing so. The result was Ora*PePi.

These scripts were *designed* to make your server SCREAM !

Some fine examples of the typical DBA

Kugendran 'Mr K' Naidoo - "why don't we script around it with one large cowabunga awk line..."

 

Kurt Van Meerbeeck - "I think it'll run faster with some multithreaded Java...now where did you say you left those memory boards?"

And you think OCP is hard - does it really prepare you for all the survivor skills you'll need in the real world ?

In our opinion it should cover following practical exams :

  • speed smoking - or how to smoke 3 packs a day and 2 at night

  • coffee marathon - or how to make 2 cans of coffee while recreating a controlfile of a 1000+ tablespace database

  • endurance - or what herbals to use when coffee doesn't cut it anymore after 48hours of no sleep

  • round robin sleep schemas - or how to perform a shutdown transactional on yourself and learn to sleep comfortable on uncomfortable chairs

  • speed dialing - or how to consistently acquire the phone number of the greasiest pizza delivery in every foreign country you visit

 

Back to Top

GNU General Public License

And now for the legal mambo jumbo :

The short version :

We are linux followers, so all software is free. Hack, chop and improve this script at will. If you find errors and make improvements drop us a line. Use this script at your own risk - we have used it and it works, but then we wrote this organized mess and are well aware of all subtle features ie. "bugs".

The long version :

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Copyright (C) 2001  Kurt Van Meerbeeck - Kugendran Naidoo

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

END OF TERMS AND CONDITIONS

Back to Top

Kurt Van Meerbeeck - Kugendran Naidoo
Revised: October 29, 2001 .