Previous Page | Next Page

Using the Promotion Tools

Using the Batch Export and Import Tools


About the Batch Export and Import Tools

The batch import and export tools enable you to perform promotions from an operating system command line or from a batch script. These tools provide the same capabilities as the Export SAS Package and Import SAS Package wizards, with the following exceptions:

The batch export and import tools are useful for the following purposes:
CAUTION:
Use of the batch import tool to import SAS 9.1.3 packages can result in a significant number of broken metadata associations, such as tables with no associated library, jobs with missing tables, transformations within jobs with missing mappings, and expressions within mappings with missing columns.

As a best practice, you should use the batch import tool to import a SAS 9.1.3 package only if the resources associated with the imported objects have the same values in the two environments. Otherwise, it is strongly recommended that you use the Import SAS Package wizard in either SAS Management Console or SAS Data Integration Studio. For more information, see Using the Batch Import Tool to Import a Package that Was Created in SAS 9.1.3.  [cautionend]

The batch import tool and export tools are called ImportPackage and ExportPackage and are located in the following path:

SAS-installation-directory\SASPlatformObjectFramework\9.2

You can execute these tools on any machine where the SAS Platform Object Framework is installed.


Preparing to Use the Batch Export Tool or the Batch Import Tool

The batch export tool and import tool require the same special considerations and the same preparation steps as the Export SAS Package and Import SAS Package wizards. (See Special Considerations for Promoting Metadata and Preparing to Use the Promotion Tools). Make sure that the user who is specified in the options has the appropriate credentials (see Ensure Appropriate User Credentials).

If you are using the batch import or export tool on a UNIX machine, make sure that the DISPLAY variable has been set on the machine. To set the variable, enter a command such as the following:

export DISPLAY=machine-name


Using the Batch Export Tool


Syntax for the Batch Export Tool

ExportPackage
-host source-host-name
-port source-port-number
-user user-id
-password password
-domain domain-name
<-profile connection-profile-name>
-package package-path-and-filename
-objects source-location-1 source-location-2 source-location-3 ... source-location-n
<-types object-type-1, object-type-2....object-type-n>
<-name character-string>
<-includeDep>
<-since from-absolute-date | from-relative-date|relative-time-period>
<-before to-absolute-date | to-relative-date>
<-created>
<-modified>
<-includeEmptyFolders>
<-subprop>
<-log log-path | log-path-and-filename | . >
<-noexecute>
<-? | --help>

Syntax Description for the Batch Export Tool

-host source-host-name

specifies the machine name of the metadata server from which the package is being exported.

Required: Yes, if -profile is not specified.
-port source-port-number

specifies the port number of the metadata server from which the package is being exported.

Required: Yes, if -profile is not specified.
-user user-id

specifies the user ID that is to be used to connect to the source metadata server. Make sure that this user has the appropriate credentials (see Ensure Appropriate User Credentials).

Required: Yes, if -profile is not specified, or if the specified connection profile does not contain user credentials.
-password password

specifies the password of the user who is specified in -user.

Required: Yes, if -profile is not specified, or if the specified connection profile does not contain user credentials.
-domain domain-name

specifies the SAS authentication domain in which the user ID is to be authenticated.

Required: No. You can omit this option if your installation has only one SAS authentication domain. You can also omit this option if you specify -profile and if the specified connection profile contains a domain name.
-profile connection-profile-name

specifies the name of the connection profile that is to be used to connect to the source metadata server. You can specify this option instead of -host, -port, -user, -password, and -domain.

The connection profile must exist on the computer where the export command is executed. You can specify any connection profile that has been created for use with SAS Management Console or SAS Data Integration Studio. When you open one of these applications, the available connection profiles are displayed in the drop-down box in the Connect Profile dialog box.

If the connection profile name contains spaces, then use quotation marks. If the connection profile contains a user ID and password, then make sure that the user has the appropriate credentials (see Ensure Appropriate User Credentials).

Required: No. You can omit this option if -host and -port are provided.
Interaction: If you specify this parameter, then -host and -port can be omitted. If the specified connection profile contains a user ID and password, then -user and -password can also be omitted.
-package package-path-and-filename

specifies the path and filename of the package file that you want to create. The objects that you export will be placed in this file.

The filename must have the extension .spk. The path is optional, but if you do specify a path, it must be fully qualified.

CAUTION:
If a file of this name already exists, then it will be overwritten.

If you want to preserve pre-existing packages, then be sure to specify a unique name.  [cautionend]

If the path or filename includes spaces, then use quotation marks.
Required: You must specify a filename, but the path is optional.
Default path: If you do not specify a path, then the package is placed in the directory where the command was launched.
-objects source-location-1 source-location-2 source-location-3 ... source-location-n

specifies the locations of the objects that are to be exported. You can specify any number of locations. Leave a space between each location. If a location includes spaces, then surround the location with quotation marks.

Use the following syntax to specify a location:

/folder-1/folder-2/...folder-n/<object-name(object-type)>

The following rules apply to specifying locations:

  • Locations are relative to the SAS Folders node. Therefore, the first folder that you specify in a location must be located directly beneath SAS Folders.

  • If you specify a folder but you do not specify an object name, then all objects and folders beneath that folder are exported.

  • To export objects from your personal folder, you must specify the actual path (/Users/user-name/My Folder/) rather than the shortcut (/My Folder/).

  • If you specify an object name, then you must also specify the object's type. For a list of object types, see Specifying Object Types. Object types are case-sensitive.

The following are examples of locations:
-objects /

exports the entire folder hierarchy and all of its objects.

-objects "/Users/sasdemo/My Folder"

exports all objects and folders that are in the personal folder of the user named -sasdemo.

-objects "/Shared Data/Orion Star Data/Customer Orders(InformationMap)"

exports the Customer Orders information map, which is located in /Shared Data/Orion Star Data.

-objects "/Shared Data/Orion Star Data/Customer Orders(InformationMap)" "/Shared Data/Orion Star Data/CUSTOMER_DIM(Table)" "/Shared Data/Orion Star Data/ORDER_FACT(Table)" "/Shared Reports/Orion Star Reports/Sales by Customer Type(Report)"

exports the Customer Orders information map, the CUSTOMER_DIM table, and the ORDER_FACT table, all of which are located in /Shared Data/Orion Star Data; and the Sales by Customer Type report, which is located in /Shared Reports/Orion Star Reports.

Required: Yes
Interaction:
  • To further limit the objects that are exported, you can use the -types, -name, -since, and -before options.

  • If you want to automatically export all of the objects on which the exported objects depend (instead of having to explicitly list those objects), specify -includeDep.

-types object-type-1, object-type-2....object-type-n

specifies a comma-separated list of the types of objects that are to be exported. If you specify this option, then the tool exports only objects that are of the specified types; all other objects are ignored.

If the string contains spaces, then use quotation marks.

For a list of object types, see Specifying Object Types. Object types are case-sensitive.

If you specify an object type that has one or more subtypes, then the subtypes are automatically included in the export. For example, if you specify InformationMap, then InformationMap.OLAP and InformationMap.Relational are automatically included. If you specify MQM, then MQM.MSMQ and MQM.Websphere are automatically included.

Required: No
Exception: This option does not apply to folders. Objects that are contained in folders are exported only if their object types are specified. However, the folders themselves are exported regardless of whether they contain the specified object types.
-includeDep

specifies that all objects on which the exported objects depend are to be included in the export. If you select this option, the export tool recursively identifies dependencies and includes the identified objects in the export.

For example, if you export an information map, the export tool identifies and exports any libraries, tables, and stored processes that are used by the information map. The process also exports any objects that the identified stored processes depend on.

CAUTION:
If you do not export the objects on which exported objects depend, then the exported objects might not function properly when you import them to the target metadata server.   [cautionend]
Required: No
-name character-string

specifies a character string that must be present in an object's name in order for the object to be exported. Objects whose names contain the specified string are exported, and all other objects are ignored.

This option is not case sensitive. For example, if you specify -name product, then the tool exports objects with the names Sales by Product and PRODUCT_DIM.

If the string contains spaces, then use quotation marks.

-since from-absolute-date | from-relative-date | relative-time-period

specifies that objects are to be exported only if they were created or modified on or after the specified date, or during the specified time period. You can specify one of the following:

from-absolute-date

specifies an absolute date (see Specifying an Absolute Date (or an Absolute Date and Time))

from-relative-date

specifies a date relative to the current date (see Specifying a Relative Date)

relative-time-period

specifies a time period relative to the current date (see Specifying a Relative Time Period)

Required: No
Interaction: You can specify either -created or -modified with this option. The default setting is -modified.
-before from-absolute-date | from-relative-date

specifies that objects are to be exported only if they were created or modified on or before the specified date. You can specify one of the following:

from-absolute-date

specifies an absolute date (see Specifying an Absolute Date (or an Absolute Date and Time))

from-relative-date

specifies a date relative to the current date (see Specifying a Relative Date)

Required: No
Interaction:
  • To specify a date range, specify -since along with this option.

  • You can specify either -created or -modified with this option. The default setting is -modified.

-created

specifies that the -since and -before options are to be based on each object's Created date. If -created is specified, then objects are exported only if the Created date meets the criteria specified in -since and -before.

Required: No
Default: If -since or -before is specified but -created is not specified, then -modified is assumed.
Interaction: If you specify both -created and -modified, then -modified takes precedence.
-modified

specifies that the -since and -before options are to be based on each object's Modified date. If -modified is specified, then objects are exported only if the Modified date meets the criteria specified in -since and -before

Note:   If an object has never been modified, then the object's Modified date is equal to its Created date.  [cautionend]

Required: No
Default: If -since or -before is specified, and if you specify neither -created nor -modified, then -modified is assumed.
Interaction: If you specify both -created and -modified, then -modified takes precedence.
-includeEmptyFolders

specifies that folders are to be exported even if they do not contain any subfolders or objects.

Required: No
Default: If this option is not specified, then empty folders are not exported.
-subprop

specifies that the export tool is to create an external substitution properties file. By default, the export tool always creates a substitution properties file inside of the package file. If you specify this option, then the substitution properties file is created externally.

In this file, you can modify values that are associated with the exported objects so that the objects will function properly in the target system. For example, you can modify server names, source code repository paths, OLAP schema names, and cube names to reflect the names that are used on the target system. For detailed instructions, see Using the Substitution Properties File.

Required: No
Default: If you do not specify this option, then an external substitution properties file is not created. The import process will use the source environment's settings for server names, source code repository paths, database schema names, and archive paths and will expect those servers, paths, and schemas to exist in the target environment.

A substitution file is still created inside the package file and can be extracted as described in Using the Batch Import Tool to Import a Package That Was Created by the Export SAS Package Wizard.

-log log-path | log-path-and-filename | .

specifies one of the following:

  • the path (or the path and filename) where the log file is to be written

  • that the log file is to be written to the current directory. To specify this option, use a period, as shown here:

    -log .

The log file contains messages that are generated during the batch tool's execution.
Required: No
Default: If you do not specify this option, then the log is directed to the path and filename that are described in Viewing the Batch Export or Import Log.
-noexecute

specifies that the package file is not to be created. Instead, a list of all of the objects that are included in the export is displayed, and a log file is created. This option is useful if you want to verify that the command is constructed correctly before you execute it.

Required: No
Default: If you do not specify this option, then the package is exported to the specified package.
[-? | --help]

specifies to display help for the batch export tool.

Required: No

Specifying Object Types

When you use the export batch tool, you might need to specify one or more object types, as follows:

The following table provides a list of object type names that you can use with these options.
CAUTION:
Object types are case sensitive. Be sure to enter them exactly as they are shown here.   [cautionend]

Note:   You might be able to export additional object types, depending on which applications you have installed.  [cautionend]

Valid Object Types
Action

Application

BurstDefinition

Channel

Condition

ConditionActionSet

ContentSubscriber

Cube

DataExploration

DeployedFlow

DeployedJob

Document

EventSubscriber

ExternalFile

Folder

GeneratedTransform

InformationMap

InformationMap.OLAP

InformationMap.Relational

Job

Library

MessageQueue

MiningResults

MQM.MSMQ (queue manager for MSMQ

MQM.Websphere (queue manager for WebSphere MQ)

Note

OLAPSchema

Project

Project.EG

Project.AMOExcel

Project.AMOPowerPoint

Project.AMOWord

Prompt

PromptGroup

Report

Report.Component

Report.Image

Service.SoapGenerated

StoredProcess

SubscriberGroup.Content

SubscriberGroup.Event

Table


Specifying an Absolute Date (or an Absolute Date and Time)

When you use -since or -before in a batch export command, you can specify an absolute date (or an absolute date and time). Use one of the following formats:

Note:   If you do not specify a time, then the specified date begins at midnight (12:00:00 a.m.) and ends at 11:59:59 p.m.  [cautionend]


Specifying a Relative Date

When you use -since or -before in a batch export command, you can specify a date relative to the current date. To specify a relative date, use one of the following values:

Today

is the current date.

Yesterday

is the day just before the current date.

"Current day of last year"

is the same as the current date, except that the year is replaced with the previous year. For example, if the current date is October 12, 2010, then Current day of last year is October 12, 2009.

"Current day of last month"

is the same as the current date, except that the month is replaced with the previous month. For example, if the current date is October 12, 2010, then "Current day of last month" is September 12, 2010.

"Current day of last week"

is seven days previous to the current date. For example, if the current date is October 12, 2010, then Current day of last week is October 5, 2010.

"n days ago"

is n days previous to the current date. When specifying this option, replace n with an integer.

Note:   Dates are assumed to begin at midnight (12:00:00 a.m.) and end at 11:59:59 p.m.  [cautionend]


Specifying a Relative Time Period

When you use -since in a batch export command, you can specify a time period that is relative to the current date. To specify a relative time period, specify one of the following values:

"Year to date"

is the period from January 1 of the current year up to and including the current date.

"Month to date"

is the period from the first day of the current month up to and including the current date.

"Week to date"

is the period from the most recent Monday up to and including the current date.

Note:   Dates are assumed to begin at midnight (12:00:00 a.m.) and end at 11:59:59 p.m.  [cautionend]


Example: Batch Export Command

ExportPackage -profile "My Profile" -package "c:\SAS Promotion Files\Package_1.spk" -objects "/Shared Reports/Orion Star Reports" -includeDep -since "Week to date" -modified -subprop

This command does the following:


Using the Substitution Properties File


About the Substitution Properties File

If you specify -subprop in a batch export command, then the export tool creates an external substitution properties file. In this file, you can modify values that are associated with the exported objects so that the objects will function properly in the target system. For example, you can modify server names, source code repository paths, database schema names, and archive paths to the values that are appropriate on the target system.

The substitution properties file has the same path and filename that you specify in -package, except that it has the filename extension .subprop instead of .spk. For example, if the package file is named Package_1.spk, then the substitution properties file is named Package_1.subprop.

Note:   Packages that are created in SAS 9.1.3 do not contain substitution properties files. For more information, see Using the Batch Import Tool to Import a Package that Was Created in SAS 9.1.3.  [cautionend]


Edit the Substitution Properties File

Before you import a package, make any necessary updates to the substitution properties file. Follow these guidelines:

Here are examples of properties before the substitution properties file was modified:

[Connections: Application Server]
ApplicationServer[1].SourceName=SASAppTest
ApplicationServer[1].TargetName=SASAppTest

[Connections: Source Code Repository]
SourceCodeRepository[1].ApplicationServer=ApplicationServer[1]
SourceCodeRepository[1].SourceDirectory=c:\\StoredProcessesTest
SourceCodeRepository[1].TargetDirectory=c:\\StoredProcessesTest
SourceCodeRepository[1].CreateIfNeeded=false

Here are examples of modified properties in a substitution properties file. Note that only the target values have been modified. In addition, note that CreateIfNeeded has been changed to true. This means that the source code repository definition will be created if it does not exist on the target system.

Connections: Application Server]
ApplicationServer[1].SourceName=SASAppTest
ApplicationServer[1].TargetName=SASApp

[Connections: Source Code Repository] SourceCodeRepository[1].ApplicationServer=
ApplicationServer[1]
SourceCodeRepository[1].SourceDirectory=c:\\StoredProcessesTest
SourceCodeRepository[1].TargetDirectory=c:\\StoredProcesses
SourceCodeRepository[1].CreateIfNeeded=true


Apply the Substitution Properties File

To apply the changes that you made to the substitution properties file, specify the -subprop option when you run the batch import tool.


Using the Batch Import Tool


Syntax for the Batch Import Tool

ImportPackage
-host target-host-name
-port target-port-number
-user user-id
-password password
-domain domain-name
<-profile connection-profile-name>
-package package-path-and-filename
-target target-location
<-types object-type-1, object-type-2....object-type-n>
<-newOnly>
<-includeACL>
<-subProp <substitution-properties-filename>>
<-preservePaths>
<-log log-path | log-path-and-filename | . >
<-noexecute>
<-? | --help>

Batch Import Tool Syntax Description

-host target-host-name

specifies the machine name of the metadata server to which the package is being imported.

Required: Yes, if -profile is not specified.
-port target-port-number

specifies the port number of the metadata server to which the package is being imported.

Required: Yes, if -profile is not specified.
-user user-id

specifies the user ID that is to be used to connect to the target metadata server. Make sure that this user has the appropriate credentials (see Ensure Appropriate User Credentials).

Required: Yes, if -profile is not specified, or if the specified connection profile does not contain user credentials.
-password password

specifies the password of the user who is specified in -user.

Required: Yes, if -profile is not specified, or if the specified connection profile does not contain user credentials.
-domain domain-name

specifies the SAS authentication domain in which the user ID is to be authenticated.

Required: No. You can omit this option if your installation has only one SAS authentication domain. You can also omit this option if you specify -profile and if the specified connection profile contains a domain name.
-profile connection-profile-name

specifies the name of the connection profile that is to be used to connect to the target metadata server. You can specify this option instead of -host, -port, -user, -password, and -domain.

The connection profile must exist on the computer where the import command is executed. You can specify any connection profile that has been created for use with SAS Management Console or SAS Data Integration Studio. When you open one of these applications, the available connection profiles are displayed in the drop-down box in the Connect Profile dialog box.

If the connection profile name contains spaces, then use quotation marks. If the connection profile contains a user ID and password, then make sure that the user has the appropriate credentials (see Ensure Appropriate User Credentials).

Required: No. You can omit this option if -host and -port are provided.
Interaction: If you specify this parameter, then -host and -port can be omitted. If the specified connection profile contains a user ID and password, then -user and -password can also be omitted.
-package package-path-and-filename

specifies the path and filename of the package file that you want to import. The filename must have the extension .spk. If the path or filename includes spaces, then use quotation marks.

You must specify a package that was created with one of the following methods:

The path is optional, but if you do specify a path, it must be fully qualified.
Required: You must specify a filename, but the path is optional.
Default path: If you do not specify a path, then the package is assumed to be located in the directory where the command was launched.
-target target-metadata-location

the location, relative to SAS Folders, to which the package is to be imported on the target metadata server. For example:

-target /

imports the package to the root level (directly under SAS Folders)

-target "/Shared Data"

imports the package to the Shared Data folder

Note:   To import objects to your personal folder, you must specify the actual path (/Users/user-name/My Folder/) rather than the shortcut (/My Folder/).  [cautionend]

Required: Yes
-types object-type-1, object-type-2....object-type-n

specifies a comma-separated list of the types of objects that are to be imported. If you specify this option, then the tool imports only objects that are of the specified types; all other objects are ignored.

For a list of object types, see Specifying Object Types. Object types are case sensitive.

Required: No
Exception: This option does not apply to folders. Objects that are contained in folders are imported only if their object types are specified. However, the folders themselves are imported regardless of whether they contain the specified object types.
-newOnly

specifies that objects are to be imported only if they do not already exist in the specified location on the target metadata server. If objects of the same name and type already exist, then they are not imported.

For example, suppose the package file contains a relational information map called Customer Orders in the location /Shared Data/Orion Star Data, and that the target metadata server contains a relational information map of the same name in that location. If -newOnly is specified, then the information map is not imported.

Required: No
Default: If you do not specify this option, then objects that already exist on the target metadata server are overwritten by any imported objects that have the same location, name, and type.
-includeACL

specifies that access controls are to be imported for all of the objects in the package. If the objects already exist on the target metadata server, then any existing access controls for these objects will be overwritten by the imported access controls.

For details about this option, see Optional Promotion of Access Controls.

Required: No
-subprop <substitution-properties-filename>

specifies that imported objects are to be updated based on properties that are specified in the substitution properties file. You must manually update this file to specify how imported objects are to be mapped to existing servers and directories in the target environment. For instructions, see Edit the Substitution Properties File.

The substitution-properties-filename argument is not required with this option. If the filename is omitted, then the name is assumed to be package-name.subprop. For example, if your package is named Package1.spk, then the import tool expects the substitution properties file to be named Package1.subprop. If your properties file has a different name, then you must either rename it or specify the filename in the -subprop option. The filename must have the extension .subprop.

CAUTION:
If you do not update the properties file or if you do not specify this option, then some imported objects might not function properly.

You might need to log on to the target metadata server after the import is complete and modify servers, paths, and other values that are associated with the imported objects.  [cautionend]

Required: No
-preservePaths

specifies that objects and folders are to be placed in the same path where they were located in the source environment. If the folders that are included in the path do not exist, they are created.

For example, suppose you export a library from /Shared Data/Libraries. If you import the library to the root level (SAS Folders) in the target environment, then the import wizard determines whether a Libraries folder exists under Shared Data. If the folder does not exist, the wizard creates it and places the imported library in that folder.

If you import objects into a folder below the root level, then this option is ignored.

Required: This option is required if you import individual objects (independently of the folders that contain them) and you have specified the root folder (SAS Folders) as the import target by specifying -target /. This option is necessary because the root folder can contain folders, but it cannot contain individual objects.
-log log-path | log-path-and-filename | .

specifies one of the following:

  • the path (or the path and filename) where the log file is to be written

  • that the log file is to be written to the current directory. To specify this option, use a period, as shown here:

    -log .

The log file contains messages that are generated during the batch tool's execution.
Required: No
Default: If you do not specify this option, then the log is directed to the path and filename that are described in Viewing the Batch Export or Import Log.
-noexecute

specifies that the package is not to be imported to the target metadata server. Instead, a list of all of the objects that are included in the import is displayed, and a log file is created. This option is useful if you want to verify that the command is constructed correctly before you execute it.

Required: No
Default: If you do not specify this option, then the package is imported to the target metadata server.
[-? | --help]

specifies to display help for the batch import tool.

Required: No

Example: Batch Import Command

ImportPackage -profile "My Profile" -package "c:\SAS Promotion Files\Package_1.spk" -target / -includeACL -subprop

This command does the following:


Viewing the Batch Export or Import Log

When you run the batch export or import tool, a log file is created in the following path:

Note:   

  [cautionend]

The log file is named Export_yyMMddHHmmss.log or Import_yyMMddHHmmss.log, where yyMMddHHmmss is the date and time that the command was executed.

If the batch import or export command fails, you can use the log file to determine the source of the error. For a list of common error messages, see Troubleshooting the Promotion Tools.


Using the Batch Import Tool to Import a Package That Was Created by the Export SAS Package Wizard

You can use the batch import tool to import a package that was created by the Export SAS Package wizard. When you run the Export SAS Package wizard, the wizard creates a substitution properties file and places it in the package. If you want to provide different values for servers, paths, or other resources, then you must extract the substitution file and modify the properties. Follow these steps:

  1. Extract the substitution properties file from the package. (Do not save the package file after you perform the extract.)

  2. Modify the target values in the substitution properties file as needed (see Using the Substitution Properties File).

  3. Optional) Rename the properties file so that it has the same base filename as the package. For example, if your package is named Package1.spk, then rename the properties file Package1.subprop.

  4. Specify -subprop in the batch import command. If you did not rename the package (as described in the preceding step), then you must specify the substitution properties filename with this option.


Using the Import SAS Package Wizard to Import a Package that Was Created by the Batch Export Tool

You can use the Import SAS Package wizard to import a package that was created by the batch export tool. The import works the same as it would if the package had been created by the Export SAS Package wizard.


Using the Batch Import Tool to Import a Package that Was Created in SAS 9.1.3

You can use the batch import tool to import a package that was created by the BI Manager export wizard in SAS 9.1.3, subject to the following special considerations:

CAUTION:
Use of the batch import tool to import SAS 9.1.3 packages can result in a significant number of broken metadata associations, such as tables with no associated library, jobs with missing tables, transformations within jobs with missing mappings, and expressions within mappings with missing columns.

As a best practice, you should use the batch import tool to import a SAS 9.1.3 package only if the resources associated with the imported objects have the same values in the two environments. Otherwise, it is strongly recommended that you use the Import SAS Package wizard in either SAS Management Console or SAS Data Integration Studio.  [cautionend]

Previous Page | Next Page | Top of Page