This blog try to answer few questions faced during export/import of a partition
For a "Export/Import Documentation" please refer to http://docs.oracle.com/middleware/1221/wls/WLSMT/export_import.htm#WLSMT636
wlst command for exporting is
exportPartition(partitionName, expArchPath, [includeAppsNLibs], [keyFile])
This carries out the exportPartition task and returns the status of the exportPartition operation in an object
The status are as follows
To see the status of exportPartition whether it succeeded or not one must capture the output of the command in an object, like
expPartStatus = exportPartition('partition1','/home/partitionadmin/exportedPartitions')
while (expPartStatus.getState() != 2 and expPartStatus.getState() != 3):
if(expPartStatus.getState() == 3):
As we can see that the returned object has 2 methods getState() and getError() , with the names that are self descriptive.
getError() actually returns an java Exception object so one could invoke all methods available for java.lang.Exception object like
to print the stack trace.
Similarly this could be used for importPartition as well.
Sometimes it is desired that the user encrypt secure attributes using their own keys during exportPartition, which they could then re-use to decrypt the secure attributes during importPartition
exportPartition, takes in an optional String argument that specifies the location of the file in which the user key is specified in plain text
Now one could use this file to encrypt secure attributes during exportPartition
expPartStatus = exportPartition('partition1','/home/partitionadmin/exportPartition',true,'/home/partitionadmin/exportPartition/userkey')
and during importPartition use the same key to decrypt the attributes
impPartStatus = importPartition('/home/partitionadmin/exportPartition/partition1.zip',keyfile='/home/partitionadmin/exportPartition/userkey')
It is quite possible that during importing a partition into domain, the domain already has a ResourceGroupTemplate with the same name as the one being imported. In that case one needs to answer the question which ResourceGroupTemplate should the imported Partition use.
The answer is it depends what the user wants.
impPartStatus = importPartition('/home/partitionadmin/exportPartition/partition1.zip',createNew=false)
impPartStatus = importPartition('home/partitionadmin/exportPartition/partition1.zip',createNew=true)