Oracle Transportable Tablespaces |
Author: Bill EnnisIntroductionOracle 8i has introduced a new feature in data movement dubbed transportable tables. The functionality is accessed through the import and export utilities. This feature can be a great aid to those in need to move large volumes of processed data throughout a network of Oracle databases. TerminologyAn Oracle tablespace is a logical collection of physical database files that reside on the operating system. Import and export are Oracle utilities used to extract and load data to and from Oracle databases. Source is referred to as the system where the original copy of the data exists. Target is referred to as the system that data is being transfereed to. The Problem Transportable Tablespaces SolveIn order to appreciate transportable tablespaces you must have lived through the problems that it solves. Therefore, I will describe a process that I was performing repeatedly to move data through Development, Test, Staging, and Production environments for a system that I was working on. The “prepared” data was a product catalog and had a substantial size of 5 GB. In the beginning there was just one server (Development). But as the project approached the launch date new environments needed to be constructed and loaded with the catalog data. The method used to create the catalog in the new environment was an Oracle export from the source and an import into the target. The catalog objects were owned by a catalog user and a owner level export was being performed. Exporting the data wasn’t too bad (45-60 minutes), but imports were another story (6-12 hours). And those numbers didn’t take into account the file transfer time between servers (sometimes 5 hours – I was unlucky enough to have these servers sitting in different cities connected via a VPN). Here is the math for the tasks involved in the operation: Export catalog
Compress file Transfer file over the network Uncompress file Create catalog user and import Total .75 hours
.25 hours 5 hours .25 hours 8 hours 14.25 hours That can make for a long day! What if I told you you could shave about 8 hours off of that time? Interested? Ok, now you can appreciate this feature! Explaining the featureHow can we save 9 hours? Well, if you think about it, the files belonging a tablespace already contain all the data, indexes, etc that we need. So why bother the target Oracle instance with the task of recreating all the entries for us. Transportable tablespaces allow us to export the meta-data about the tablespace ONLY. The row level information is not required! That information is already contained in the Oracle datafiles. So our export is reduced down to a meta-data export, and we literally copy the datafiles over to the target in their entirety. Things you need to know (Caveats)
ProcessThe overall process can be broken down at a high level into the following steps:
It is a good idea to compress large datafiles first to speed up the file transfer. It is important to note that the datafiles do NOT have to be placed in the same location as they existed on the source. The tablespace import allows an option to designate the location of the datafiles at the target database. I have found that sequences are not transferred during a tablespace transport. This is because Oracle actually stores sequence information in the system tablespace and you should NOT transport a system tablespace! The specific syntax required to perform this exercise can be found in the Oracle reference manuals. In particular, refer to syntax for the following:
SummaryTransportable tablespaces can be an excellent tool for migrating data that has been transformed and loaded into a database. It is much faster than export/import because it is basically a meta data copy within Oracle along with a straight file copy to the destination system. Transporatable tablespaces should be in any data integration toolbox. |