Importing Objects via Command Line
After you have exported objects to a file, you can import them from that file into another system. You need to understand the different modes for import and export before you do this.
Import Modes
| Mode | Description |
|---|---|
Primary objects only | The system imports Primary objects only. The system checks for the existence of all referenced objects, and resolves dependencies accordingly. If any referenced object is not found, the system issues an error message and ends import of the object. |
Primary objects plus missing Referenced objects | The system imports Primary objects. To resolve references, the system first uses existing objects and then imports referenced objects that do not already exist in the destination environment. |
All objects | The system imports all objects (Primary and Referenced) in the file, overwriting any objects that already exist in the destination system. After an All objects import, the destination system is configured (for all Primary objects) in the same way as the original system. |
There is no default import mode: you must choose a mode for import.
In all modes, if the system needs to overwrite an object, it overwrites that object completely, including all fields and references.
The system runs the entire import process in one transaction. This means that it’s impossible to have a partially successful import: if there is any error during the import process, the entire operation is rolled back.
Coordinating Export and Import Modes
As described earlier, when exporting, you can choose recursive or non-recursive mode; when importing, you can choose one of three modes. However, if you choose non-recursive for export mode, the behavior is the same for all three import modes. There are, thus, four different behaviors of export and import mode combinations, as described in the following table:
| Export mode | Import mode | Behavior of import |
|---|---|---|
| Recursive | Primary objects only | The objects that were explicitly exported are imported, and overwrite any definitions that exist in the target server. Any dependencies must already exist in the target server, or import will fail. |
| Recursive | Primary objects plus missing Referenced objects | Primary objects are imported into the target server, overwriting any definitions that may already exist. Any referenced objects that do not exist in the target server are imported, but existing definitions of referenced objects are not overwritten. |
| Recursive | All objects | All exported objects and referenced objects are imported into the target server, overwriting any definitions that may already exist. |
| Non-recursive | (Any) | The objects that were explicitly exported are imported, and overwrite any definitions that exist in the target server. Any dependencies must already exist in the target server, or import will fail. |
If you choose the non-recursive export mode, the only import mode that makes sense is Primary objects only, because the other two import modes process referenced objects. You choose the other modes, but the import will only include the objects that were exported explicitly (rather than because they were referenced).
If you choose recursive export mode, choosing either Primary objects plus missing Referenced objects or All objects for import mode will accommodate referenced objects. You can also choose Primary objects only; however, this behaves as if the objects were not exported recursively.