| Oracle9i Warehouse Builder User's Guide Release 9.2 Part Number B10996-01 |
|
The Metadata Loader (MDL) enables you to populate a new repository as well as transfer, update, or restore a backup of existing repository metadata. You can also take snapshots of your metadata and use them for backup, compare, and restore purposes.
This section contains the following topics:
Warehouse Builder provides several features that enable you to copy and move metadata for the purposes of backup, history management and version management.
You can import and export metadata for any type of object on the navigation tree using the Metadata Loader (MDL) utility. Access MDL through the Warehouse Builder client or through the OMB Plus scripting interface. Use the import and export functionality to backup metadata or to migrate metadata when upgrading Warehouse Builder.
You can also then move exported files into a third-party version control tool such as Oracle Repository, ClearCase, or SourceSafe. If you enter version numbers in your project properties, it is easier to track your export and import versions in this setting.
You can also perform metadata change management by taking snapshots of your metadata using the OMB Plus scripting interface. Snapshots enable you to capture definitions of metadata objects using Warehouse Builder scripts. Use snapshots for the purpose of metadata backup and version management. For more information about metadata change management, see Chapter 16, "Metadata Change Management".
The MDL enables you to copy or move metadata objects between repositories, even if those repositories reside on platforms with different operating systems.
The MDL consists of two utilities: metadata export and metadata import. The export utility extracts metadata objects from a repository and writes the information into a text file. The import utility reads the metadata information from an exported text file and inserts the metadata objects into a repository. MDL uses its own format, and the MDL import utility only reads files of MDL format (files created by MDL Export).
You can operate the MDL from the Warehouse Builder console or by using a command line interface. For instructions on using MDL through the command line interface, refer to "Using the Metadata Loader Command Line Utility". If you use the console menu, a graphical interface guides you through the export or import processes.
Use the metadata loader to perform any of the following tasks:
This section contains the following topics:
The Warehouse Builder repository allows multiple clients to access the same repository schema concurrently. Warehouse Builder uses locks to allow only one client to access to change repository objects. While an object is locked, other clients can only view it as it existed after the last transaction instigated by any user is committed.
If you click OK when prompted, the MDL commits changes made to the repository after a successful metadata import (any import with no error messages, including imports with only information or warning messages). The MDL also executes a rollback after an unsuccessful import. This means that Warehouse Builder attempts to acquire one lock for each primary object (an object in the first level on the navigation tree) in the repository that matches an object in the MDL file. These objects include, but are not limited to, projects, modules, and tables--individual columns are not locked. Therefore, you must be able to hold the locks for these objects while you import metadata. If other users hold locks for objects to which you are importing, the MDL will fail.
If the MDL import affects too many objects in the repository, the MDL automatically switches to single user mode. This means that no other users can log on to the repository until after the MDL import completes. Single-user mode allows the MDL to avoid the performance degradation that results from using a large number of locks. In single-user mode, the MDL is less likely to deplete the repository enqueue resources. If other users are logged into this repository when MDL attempts to switch to single-user mode, MDL cannot switch to single-user mode and subsequently fails.
You also need to have MDL_IMPORT security privileges in order to import metadata. For more information on security, see "Managing Security with PL/SQL".
Each time you use the export or import utilities, the MDL reports the results of an action and writes diagnostic and statistical information to a log file.
The MDL reports the results after any import or export task with a dialog. If you want detailed information, you can view a detailed log by clicking View Log File from the Metadata Export Results dialog as shown in Figure 15-1.
The results dialog lists the metadata objects found in either the file or the repository, and the number of each object that was exported or imported. You can use the results dialog to ensure that all of the objects were exported or imported. The MDL identifies the objects that were exported or imported and compares it with the eligible objects list. A zero in the Number Exported or Number Imported column for any object indicates that the MDL found no object of that type in the repository. However, if a zero appears for any object that exists in the repository or imported MDL file, then MDL encountered a problem when importing or exporting that object.
Whenever you export or import repository metadata, the MDL writes diagnostic and statistical information to a log file. By default, the log file is located in the directory and path specified in the Message Log tab located in the Preferences dialog. You can specify an alternative location for the log file when invoking MDL.
Example 15-1 displays the contents of a typical import log file.
Import started at 04/25/2001 4:59:46 PM ******************************************************************************** * Import for OWB Release: 3.0.0.0.0 Version: 3.0.0.3.0 * User: user30_3i Connect String: epaglina-pc:1521:ora8i * Data File: d:\owb3000\sco_dim_time_phy_m_tgt.mdl * Log File: d:\owb3000\imp_dim_time_phy_m_tgt.log * Trace: B * Trace File: d:\owb3000\imp_dim_time_phy_m_tgt.trc * Physical Names: Y Mode: CREATE * Ignore Universal Identifier: Y Commit At End: Y ******************************************************************************** Informational at line 15: MDL-1207 PROJECT with physical name <PRJ_Dimension> not imported because it already exists. Informational at line 21: MDL-1207 DATAWAREHOUSE with physical name <WH> not imported because it already exists. Informational: MDL-1134 COMMIT issued at end of import data file. Counts for OWB Import Utility ----------------------------- Total Projects Processed by Import = 1 ------------------------------- Project = PRJ_Dimension Entity in Project Added Replaced Skipped ------------------------------- ----- -------- ------- DATAWAREHOUSE: 0 0 1 DIMENSION: 1 0 0 LEVEL: 3 0 0 HIERARCHY: 2 0 0 LEVELRELATIONSHIP: 4 0 0 COLUMN: 18 0 0 UNIQUEKEY: 8 0 0 PRIMARYKEY: 2 0 0 CONFIGPARAM: 60 0 60 CHILDCONFIG: 14 0 0 Import ended at 04/25/2001 4:59:52 PM
The log file enables you to monitor and troubleshoot export and import activities in detail. The log file contains the following types of status messages:
This log also displays the total number of objects that have been added, replaced, and skipped. A zero in any column for any object indicates that the MDL found no object of that type in the repository or in the imported MDL file.
If you are running an MDL Import and encounter an error, an error message displays.
Click Detail to display a detailed error log that lists the repository object and the object line in which the error occurred. Detailed messages are useful whenever you import metadata into repositories with existing metadata because they alert you to problems such as improperly defined metadata objects and object duplication.
Figure 15-2 is an example of a detailed error message.
In this example, the repository object is the CUST dimension and the imported object is the TOTAL level. The dialog explains that the TOTAL level cannot be imported into the CUST dimension because a level named TOTAL already exists.
The Metadata Loader can export all repository objects. The MDL also exports information belonging to metadata objects such as table columns and their constraints, data loading configuration parameters, and named attribute sets. You can use the MDL to export an entire project or a subset of objects within a project.
When you export repository metadata, the Metadata Loader writes the extracted metadata to a delimited text file. The MDL stores this file outside the repository by assigning a default path and file name to the exported MDL file.
This section contains the following topics:
Before you attempt to export metadata, ensure you have the following:
You can export metadata from a Warehouse Builder repository using one of the following:
Using the command line or the client interface, you can export an entire project, collection, or module, or any subset of objects. If you export a subset of objects, the MDL exports definitions for each object you have selected and the parent objects to which the subset belongs. This enables the MDL to maintain the tree relationships for those objects during metadata import.
For example, if you export a single dimension, the export file contains definitions for:
If you are exporting a subset of objects, make sure you export all referenced objects and import them as well. The Metadata Import Utility allows you to import repository objects even if the references for those objects cannot be satisfied.
For example, if you export a cube, the foreign key references will be exported, but the dimensions to which they refer will not. If the metadata in the dimension tables changed, then the foreign key references imported to the new repository would become incorrect.
Use the metadata export utility to export objects from a Warehouse Builder repository into an MDL file.
To export metadata from a repository using the Warehouse Builder client interface:You can export individual objects such as tables or groups of objects. When you export projects nodes, or modules, you also export the objects they contain. When you export collections, you also export the objects they reference.
The Metadata Export dialog displays the names and types of the objects you are exporting. The Metadata Export dialog also displays default settings for the export file as shown in Figure 15-3.
File Name: Type the name of the export file to create or click Browse to locate a directory or file. The filename you assign must end with .mdl.
Log File: Warehouse Builder records information about the export in a log file. You can change this location by entering a new path and filename. Type the path and file name in the field or click Browse to locate a directory or filename.
Field Separator: Table fields in the export file are separated with a pipe (|) by default. If your file already has the pipe (|) symbol as part of its data, you can change the default field separator to a caret (^) by selecting it from the list.
Character Set: Select the character set to use in the export file. The default character set is defined by the Warehouse Builder client system. Use the list to change the output character set.
If you made changes to the repository metadata prior to running the export utility, the Metadata Export Confirmation dialog displays. Click Commit to save changes or Rollback to revert to the previously saved version. You must have read-write access to the repository in which you are exporting metadata to commit changes.
The Metadata Export Progress dialog displays the progress. When the export completes, the Metadata Export Results dialog displays.
Click View Log File for a detailed view of the export process.
The Metadata Loader formats the .mdl export file using keywords and position as shown in Example 15-2.
#Project data <PhysicalName> <LogicalName> <UniversalID> <Version Label> PROJECT|WarehouseName|Warehouse Name|A86184D5336911D58E9000B0D02A59E4|null #Dimension <PhysicalName> <LogicalName> <UniversalID> <Prefix> <UsageType> <Imported> <Generated> DIMENSION|Channels|Channels Dimension Data Mart|7E727655029911D58DC900C04F48E9ED|ch|null|N|N
In this example, each record in the file begins with a keyword followed by one or more variable-length fields. Table fields are separated by a pipe (|) by default.
Archiving a project allows you to copy metadata stored within a Warehouse Builder repository to an external location for the purpose of securing that data at a fixed point in time. Warehouse Builder provides an Archive Wizard to assist you in this process. The Archive and Restore utilities initially write to a file system. You can then move files from this file system into a third-party version control tool such as Oracle Repository, ClearCase, or SourceSafe.
You must set up your Archive/Restore settings on the Preferences page before you can archive or restore your project. If you attempt to archive or restore without setting these preferences, you get an error.
Before you archive your project, you can update the project version label with the Project Properties dialog. There are two places in Warehouse Builder where you can set up the version label used in the archive/restore:
Archive and Restore are different from Import and Export. Table 15-1 describes the differences between Archive and Export.
Before you archive your project, you can update the project version label with the Project Properties dialog (see "Project Version Labels").
To archive a project:You can also select Archive from the right-click menu when a project is selected.
The Archive Wizard Welcome page displays, as shown in Figure 15-4.
The Summary page displays a summary of the archive settings prior to running the archive process. If you want to see the details of your archive after the archive process is complete, check the Show details dialog following a successful archive box.
No changes can be made from the wizard. If you notice an error in the Archive Wizard Summary page, click Cancel and make the appropriate changes to your Archive/Restore Preferences before continuing with the archive.
This begins the archive process. A progress window appears. When the progress bar reaches 100%, the archive process is complete.
If you checked the Show details dialog following a successful archive box, the Archive Results dialog displays. This dialog displays the name of each object type and how many of each were archived, as shown in Table 15-5.
For a more detailed look at the archive process, click View Log File. This displays the entire log file, as shown in Table 15-6.
The import utility reads the metadata information from an exported text file and inserts the metadata objects into a repository. The metadata import utility only reads files created by the metadata export utility.
The MDL imports information belonging to exported metadata objects such as table columns and their constraints, data loading configuration parameters, and named attribute sets. You can use the MDL to import objects into a project or a collection.
If you import an .mdl file containing metadata for gateway Modules, such as DB2 or Informix, from an older version of Warehouse Builder, the file may not import the metadata into the corresponding source module folders in a project. The imported files are stored under the Others node in the navigation tree. You need to manually copy the metadata for the gateway modules into the correct source module folders.
The following sections describe how to use the Metadata Import Utility:
Before you attempt to import metadata, ensure you have the following:
You can import metadata into a Warehouse Builder repository using one of the following:
When you import a set of definitions from exported metadata, the import utility can update existing definitions in a Warehouse Builder project. However, certain metadata definitions require attention to ensure that they are updated. The following are examples of some of the errors you can see:
Use the metadata import utility to import objects from an MDL file into a Warehouse Builder repository.
To import objects from an export file using the Warehouse Builder client:
Warehouse Builder displays the Metadata Utility Import dialog as shown in Figure 15-7.
File Name: Type the name of the MDL file or click Browse to find the MDL file you want to import.
Log File: Warehouse Builder records information about the import in a log file. You can change this location by entering a new path and filename. Type the path and file name in the field or click Browse to locate a directory or filename.
Add new metadata only: Adds new objects to a repository.
Add new metadata and replace existing objects: Adds new objects to a repository and replaces existing objects.
Add new metadata and merge existing objects: Adds new objects and merges columns into existing objects in your repository.
Replace existing objects only: Replaces existing objects in your repository.
Ignore Universal Identifier: The import utility does not use Universal Identifiers to search for objects you are importing.
Name: Searches your repository using the physical names of the objects you are importing to make sure the objects do not already exist.
Character Set: Select the type of character set used to create the import file. The default character set is defined by the Warehouse Builder client machine. Use the drop-down list to change the output character set.
You can add new languages and character sets using the Repository Assistant. For more information, refer to the Oracle9i Warehouse Builder Installation and Configuration Guide.
If you have made any changes before starting the import, the Metadata Import Confirmation dialog displays. Click Commit to save any changes or Rollback to ignore changes and revert to the previously saved version.
The Metadata Import Confirmation dialog displays as shown in Figure 15-9 if the exported metadata data information has not been reviewed.
The Metadata Import Progress panel displays, as shown in Figure 15-10.
This dialog displays the object types and the number of each type that were imported or skipped. For a detailed view of the import process, click View Log File.
The graphical user interface for the metadata import utility operates in one of the following modes:
When you import using the Update or the Replace modes, the import completely replaces the existing object's children so that the final object is exactly the same as the source object. Any existing children of a repository object that are not replaced or added are deleted. This occurs regardless of whether a child object occurs in a mapping or is a foreign, primary, or unique key column in a table or view.
For example, in the MDL export file, the CUST table contains three columns with the physical names: Last_Name, First_Name, and Middle_Init. In the repository, the same table already exists, and contains four columns with the physical names: Last_Name, First_Name, Status, and license_ID. During a replace operation, the columns Last_Name and First_Name are replaced, column Middle_Init are added, and column Status and license_ID are deleted. The final result is that the CUST table in the Warehouse Builder repository contains the same metadata from the CUST table in the export file.
When you use the metadata import utility, it first searches the repository for metadata objects that exist in the repository and compares them to those in the file you are importing. How the comparison is made is determined by the loading mode and by the search method you choose. The following methods are available:
By default, the import utility searches by UOIDs. However, the import utility ignores the UOIDs for mappings in the MDL file that already exist in the target repository.
|
Note: MDL imports that run in merge mode must use UOIDs for the search criteria in order to merge into existing mappings. Also, if the mapping in the MDL file does not have a Universal Identifier, the mapping cannot be merged into a mapping that matches by name. For more information, see "Import Modes". |
Each search method can be combined with an import mode in several different combinations. Each combination can offer different results in the import process. The mode that you select determines how the metadata import utility will search for metadata objects in the repository prior to importing.
For example, if the search is by the logical name of a repository object in the export file, the Metadata Import Utility searches the repository for the object's logical name. If an object with the corresponding logical name is not found, the resulting actions are based on the import mode you select.
Table 15-2 describes what happens in the available import modes for repository objects that do not match the MDL file names.
Table 15-3 describes what happens in the available import modes for repository objects that match the MDL file names.
The MDL reads and processes the imported metadata and writes status and diagnostic information in the log file. When the import is complete, the Metadata Import Results dialog displays.
Restoring a project allows you to recreate metadata within a Warehouse Builder repository from an external location. Warehouse Builder provides a Restore Wizard to assist you in this process.
You must set up your Archive/Restore settings on the Preferences page before you can archive or restore your project. If you attempt to archive or restore without setting these preferences, you get an error.
Archive and Restore are different from Import and Export. Table 15-4 describes the differences between Restore and Import.
Follow these instructions to restore a project.
To restore a project:The Restore Wizard Welcome page displays.
The Select Archive page displays, as shown in Figure 15-11. Browse to or type the Archive File you want to restore.
The Summary page displays a summary of the restore settings prior to running the restore process, as shown in Figure 15-12. If you want to see the details of your restore after the restore process is complete, check the Show details dialog following a successful restore box.
This begins the restore process. A progress window appears. When the progress bar reaches 100%, the restore process is complete.
If you checked the Show details dialog following a successful restore box, the Restore Results dialog displays, as shown in Figure 15-13. This dialog displays the name of each object type, how many of each were restored, and how many of each were skipped.
For a more detailed look at the archive process, click View Log File. This displays the entire log file, as shown in Figure 15-14.
You can operate the MDL from the command line instead of the user interface.
This section contains the following topics:
For related information on using the Metadata Loader's command line utility for upgrade purposes, refer to the Oracle9i Warehouse Builder Installation and Configuration Guide.
If you use the command line interface, you can customize how to move your metadata at a more detailed level than you can when using the GUI. For example, when exporting metadata, the command line allows you the flexibility to disable the export of configuration values, vary the separator character within an export file, and maintain parameter files for selected export operations.
For importing metadata, the command line offers the flexibility of creating specific import actions for each object. These operations automate the consolidation or synchronization of metadata in multiple repositories that have a similar project structure.
The scripts for executing both the export and import utilities reside in the $OWBHOME\owb\bin\win32 directory. Both the export and import utilities are driven by a set of parameters. You can specify the MDL parameters by:
By default, the MDL also exports values for configuration parameters for loading data, but you can override this setting at the command line. You can choose how you want to export the files within a project. For example, if you are exporting three source modules and two target modules, you can choose to export them separately or together.
To export a project at the command line:
The following command invokes the Metadata Export Utility and specifies the above parameters file:
w:\owb\bin\win32>exp parfile=e:\MDL\EXP_Directives Processing ... Export successful.
The objects are exported to the file and can be imported into a repository using the metadata import utility.
An MDL parameters file is a text file that contains a set of parameters for the export utility. The format for an export parameter is:
You can also form an export parameters by replacing the value with the wildcard character (*), which matches any string, or with a list of named objects:
For example, you can specify a set of tables to be exported as:
TABLES=(Customers, Products, Days)
Example 15-3 shows a typical parameters file for importing a module.
USERID=GCCWH/GCCWH@dwdoc11-pc:1521:ora816 PROJECT=GCCWarehouse FILE=e:\MDL\GCCWarehouse-exp-JUL01 FIELDSEPARATOR=| LOG=e:\MDL\GCCWarehouse-exp-JUL01-LOG CONFIGPARAM=N
Table 15-5 summarizes the keywords used to form export parameters. You can use the comment indicator (#) to document the scripts. Put the indication in the first column of a record and follow it with text.
The following command invokes the Import Utility and specifies the above MDL parameter file:
w:\owb\bin\win32>imp parfile=e:\MDL\IMP_Directives.txt Processing ... Import successful.
Like the MDL export, you can direct the MDL import to import objects from a file by answering prompts or by creating a file with a set of parameters. Example 15-4 shows a typical parameters file for importing a module.
USERID=GCCWH/GCCWH@dwdoc11-pc:1521:ora816 FILE=e:\MDL\gccstar-exp LOG=e:\MDL\gccstar-imp-LOG MODE=CREATE CONFIGPARAM=N
Table 15-6 summaries the keywords used to form import parameters.
If a MODE parameter is not included, then the default is CREATE.
In addition to running an MDL parameter file from the import utility, you can also specify an action plan within the file that will allow you to specifically define what you want to do with each object in the imported file. First you need to specify if you want the object imported, skipped, or deleted. If you choose to import the object, you can set the import mode to CREATE, UPDATE, REPLACE, or INCREMENTAL UPDATE.
Example 15-5 shows an example of an MDL parameter file that contains an action plan.
USERID=user_sample/user_sample@test-pc:1521:ora8i # FILE=e:\test\data\sample_file.mdl LOG=e:\test\log \imp_sample_file.log # MODE=ACTIONPLAN PHYSICALNAMES=Y IGNOREUOID=Y # # User-Specified Action Plan # ACTION=NONE PROJECT=MY PROJECT MODULES=(DATAWAREHOUSE) # ACTION=CREATE TABLES=(TABLE_3) FACTS=(FACT1, FACT2, FACT3) SEQUENCES=(SEQ_A, SEQ_B, SEQ_C) # ACTION=REPLACE TABLES=(TABLE_1, TABLE_2) DIMENSIONS=(DIM1, DIM2, DIM3) # ACTION=DELETE TABLES=(TABLE_A, TABLE_B) # # Switching to a different module ACTION=REPLACE MODULES=(FLAT_FILE) FILES=(FILE_1, FILE_2) # ACTION=CREATE FILES=(FILE_3) # ACTION=DELETE FILES=(FILE_X)
The Split utility provides a workaround for the memory limitations of the MDL import utility when you are importing a large number of mappings. This utility generates export and import scripts for migrating mappings in pieces as opposed to migrating them all at the same time. The generated scripts have matching MDL parameter files that utilize the CREATE mode. These files can be edited.
If the MDL import fails because of large data, the split utility can be used to re-export and import the mapping data in smaller pieces. All other object types must be exported and imported using the standard MDL utilities. Only mappings can be split into smaller pieces. To export all entities other than mappings, a parameter file containing the following can be used:
VIEWS=*
TABLES=*
SEQUENCES=*
MATERIALIZEDVIEWS=*
CUBES=*
FILES=*
DIMENSIONS=*
VIRTUALTABLES=*
TEMPORARYTABLES=*
TRANSFORMCATEGORIES=*
The split utility splits the mappings within a module in a Warehouse Builder project. The size of the pieces is determined by a parameter located in a file provided with this application.
The expsplit batch script accepts the following arguments:
c:\temp\owb_apps.txt. The parameter file has special keywords outlined below that identify the number of mappings, data file names, and extensions.
c:\temp\owb_apps the piece number (numbered from 1). A .txt suffix is added to the generated parameter file, a .bat suffix is added for the export batch file, and an _imp.bat suffix is added to the import batch file.
The following is an example of how to start the split utility:
expsplit exampleparams.txt c:\temp\ora_apps
The following example uses a parameter file exampleparams.txt. This file contains the following parameters:
userid=apps/apps@130.35.12.73:1521:orcl0
PHYSICALNAMES=Y
LOG=c:\temp\owb_data_apps
LOGEXT=log
FILE=c:\temp\owb_data_apps
FILEEXT=dat
FIELDSEPARATOR=^
PROJECT=EDWPRJ
MODULES=EDW_COMMON_MODULE
TYPE=MAPPINGS
COUNT=70
This file is similar to the export parameter file for Warehouse Builder Metadata Loader, with the changes listed in Table 15-7.
If the mappings for a Warehouse Builder project are split, the generated parameter files are named as follows:
owb_apps1.txt owb_apps2.txt
A batch file is generated: c:\temp\owb_apps.bat (given the parameter target file prefix) to export the data from the repository. An import batch file is created to import, using create mode, into the same repository. These files can be edited if different target databases are required.
To export all objects other than mappings in a command line, use a parameter file with the following keywords:
VIEWS=*
TABLES=*
SEQUENCES=*
MATERIALIZEDVIEWS=*
FACTS=*
FILES=*
DIMENSIONS=*
VIRTUALTABLES=*
TEMPORARYTABLES=*
TRANSFORMCATEGORIES=*
If you are using Warehouse Builder to perform export, use multi-select to select and export objects other than mappings.
expsplit exampleparams.txt c:\temp\ora_apps
The utility connects to the source repository, splits mappings, and creates multiple parameter files according to exampleparams.txt. These parameter files are used during the export. The utility also creates an export batch file and an import batch file.
Table 15-8 lists the files that are created.
c:\temp\ora_apps1.txt, c:\temp\ora_apps2.txt. Edit the connection information to point to the target repository.
c:\temp\ora_apps_imp.bat to complete the import.
|
|
![]() Copyright © 2001, 2003 Oracle Corporation. All Rights Reserved. |
|