Using the Promotion 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 wizards provide the option of either including or excluding associated content such as physical tables and source code files. When you use the batch tools, the promotion automatically includes all associated content except tables and external files.
In the Export SAS Package wizard, you can display a list of the objects on which an object depends and then individually specify which of these objects to export. In the batch export tool, you can select a global option to include all dependent objects.
to perform ad hoc promotion jobs from the command line, as an alternative to using the wizards
to create promotion jobs that are to be run on a scheduled basis or a repeated basis
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.
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 |
ExportPackage
|
specifies the machine name of the metadata server from which the package is being exported.
Required: | Yes, if -profile is not specified. |
specifies the port number of the metadata server from which the package is being exported.
Required: | Yes, if -profile is not specified. |
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. |
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. |
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. |
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. |
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.
If you want to preserve pre-existing packages, then be sure to specify a unique name.
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. |
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.
exports the entire folder hierarchy and all of its objects.
exports all objects and folders that are in the personal folder of the user named -sasdemo.
exports the Customer Orders information map, which is located in /Shared Data/Orion Star Data.
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: |
|
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. |
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.
Required: | No |
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.
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:
specifies an absolute date (see Specifying an Absolute Date (or an Absolute Date and Time))
specifies a date relative to the current date (see Specifying a Relative Date)
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. |
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:
specifies an absolute date (see Specifying an Absolute Date (or an Absolute Date and Time))
specifies a date relative to the current date (see Specifying a Relative Date)
Required: | No |
Interaction: |
|
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. |
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.
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. |
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. |
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. |
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 .
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. |
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. |
specifies to display help for the batch export tool.
Required: | No |
When you use the export batch tool, you might need to specify one or more object types, as follows:
in the -objects option, if you specify individual objects. You must specify the object type in parentheses after each object name.
in the -types option.
Note: You might be able to export additional object types, depending on which applications you have installed.
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 |
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:
ddMMMyyyy
ddMMMyyyy:HH:mm:ss
ddMMMyy
ddMMMyy:HH:mm:ss
MM/dd/yyyy
MM/dd/yyyy HH:mm:ss
yyyyMMdd
yyyyMMdd:HH:mm:ss
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.
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:
is the current date.
is the day just before the current date.
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.
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.
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.
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.
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:
is the period from January 1 of the current year up to and including the current date.
is the period from the first day of the current month up to and including the current 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.
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:
exports folders, subfolders, and objects from /Shared Reports/Orion Star Reports. Objects are included only if they were created or modified since Monday of the current week.
recursively identifies the objects on which the exported objects depend, and exports those objects as well.
exports physical content (for example, .srx files) that is associated with the exported objects.
creates a package file called Package_1.spk that contains the exported objects and content, and places the file in C:\SAS Promotion Files.
creates a substitution properties file called Package_1.subprop, and places the file in C:\SAS Promotion Files.
Using 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.
Before you import a package, make any necessary updates to the substitution properties file. Follow these guidelines:
Modify only properties that contain the word Target (for example, TargetName=, TargetPath=, and TargetDirectory=).
Update the target properties with the exact names of the resources as they appear on the target system. The names are case sensitive.
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
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 |
ImportPackage
|
specifies the machine name of the metadata server to which the package is being imported.
Required: | Yes, if -profile is not specified. |
specifies the port number of the metadata server to which the package is being imported.
Required: | Yes, if -profile is not specified. |
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. |
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. |
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. |
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. |
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 batch export tool
the Export SAS Package wizard (see Using the Batch Import Tool to Import a Package That Was Created by the Export SAS Package Wizard before you import this type of package)
the BI Manager Export Wizard in SAS 9.1.3 (see Using the Batch Import Tool to Import a Package that Was Created in SAS 9.1.3 before you import this type of package)
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. |
the location, relative to SAS Folders, to which the package is to be imported on the target metadata server. For example:
imports the package to the root level (directly under SAS Folders)
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/).
Required: | Yes |
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. |
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. |
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 |
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.
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.
Required: | No |
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. |
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 .
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. |
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. |
specifies to display help for the batch import tool.
Required: | No |
ImportPackage -profile "My Profile" -package "c:\SAS Promotion Files\Package_1.spk" -target / -includeACL -subprop
This command does the following:
imports folders, subfolders, and objects from Package_1.spk and writes them to the root location under SAS Folders on the target metadata server
updates objects on the target metadata server with values that are specified in the substitution properties file
imports access controls for all of the objects in the package
imports physical content (for example, SRX files) that is associated with the imported objects
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:
On Windows Vista systems: C:\Users\user\AppData\Roaming\SAS\Logs
On other Windows systems: C:\Documents and Settings\user\Application Data\SAS\Logs
On UNIX systems: user's-home-directory/SAS/Logs
Note:
To see the log file on Windows systems, you must enable the option to view hidden files and folders.
If you want to direct the log to a different location, specify the -log option with the import or export command.
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:
Extract the substitution properties file from the package. (Do not save the package file after you perform the extract.)
Modify the target values in the substitution properties file as needed (see Using the Substitution Properties File).
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.
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:
The SAS 9.1.3 environment must have the correct software versions. For details, see Special Considerations for Promoting Metadata.
In SAS 9.1.3, only the following types of objects can be exported: data explorations, documents, deployed jobs, external files, folders, generated transformations, information maps, jobs, job flows, libraries, mining results, notes, reports, stored processes, and tables. In SAS 9.2, a larger number of object types can be imported and exported (see Specifying Object Types).
For the servers, paths, and other resources that are associated with the imported objects, the batch tool will apply the same values that were used in the SAS 9.1.3 environment. After the import is completed, you must use SAS Management Console (or other SAS applications, as needed) to modify the imported objects' properties so that their associated servers, paths, and other values are correct for the target environment.
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.
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.