用途
create_job 命令可根据命令行或XML文件中指定的参数值创建作业。您在命令行中输入的参数值将取代在参数 XML 文件中为这些参数输入的任何值。
语法
create_job [ -file File | parameters]
示例
dsc create_job -n job1 -f parameters.xml
参数
- n|name Name
- 这是在其上执行操作的作业的名称。每个作业的名称都必须唯一。
- f|file filename
- 包含创建作业所需参数的文件的完整文件路径和文件名。如果在该文件和命令行中同时提供了相同的参数,Teradata DSA 将使用命令行中指定的值。
- d|description Description
- 有意义的作业说明。要允许多字说明,请在说明字符串前后添加 “\"”。
- t|type Type
- 作业的类型。请输入以下值之一:
- BACKUP
- RESTORE
- ANALYZE_READ
- ANALYZE_VALIDATE
- b|backup_name BackupName
- [可选] 现有备份作业的名称。仅适用于类型为恢复、Analyze_Read 和 Analyze_Validate 的作业。
- u|user_authentication User
- 如果启用了安全管理,则需要使用此参数。为命令提供 Viewpoint 用户,并触发用于身份验证的密码提示。
所需权限:用户角色
- v|backup_version BackupVersion
- [可选] 要复制到第三方存储或从第三方存储复制的备份版本号。可以在备份文件名 (bar_123456789.out) 中看到此编号
如果您指定 next_incremental_restore,请不要指定备份版本号。
用法说明
只包含 DBC 的备份作业不能联机运行。
要获取保存集的备份版本,请使用 list_save_sets 命令。
将 skip_archive 参数设置为 true,以便在表不存在的情况下,作业可以继续运行。例如,缺少对象访问权限,或者作业文件中明确列出的某个表缺失(例如,表被删除)。通过将该参数设置为 true,作业将跳过缺失的表并继续处理剩余的表。skip_archive 的缺省值为 false。现有作业的缺省值应为 false,可以在升级过程中进行设置。
在还原作业中,parent_name 参数使用导出 XML 时的备份作业名称。
- 多个数据库将映射到同一数据库
- 不同数据库下的同一表级别对象名称将映射到同一数据库
- 数据库 A 将映射到 newA,数据库 B 下的表级别对象 x 将映射到 newA.x
- 如果已选择数据库并且不在数据库级别设置 includeAll 属性、map_to 或 config_map_name,DSC 将展开数据库下的对象,并将恢复作业视为表级别恢复。
- 如果已选择数据库并且已在数据库级别设置 includeAll 属性、map_to 或 config_map_name,将忽略表级别定义,并且 DSC 将恢复作业视为数据库级别恢复。
在备份、还原或 analyze_validate 作业中,使用 streams_softlimit 作业选项覆盖系统级别的流软限制。范围是 1 到流软限制的 max 软限制,其中 max 是系统中每个节点的 AMP 数。有关最佳设置的详细信息,请参阅 XML 元素的值。
若在备份或还原作业中使用了 skip_joinhash_index 作业选项,在备份作业期间将跳过联接索引和哈希索引存档,或者在还原作业期间将跳过联接索引还原。
对于增量还原备份作业,请使用 enable_backup_for_IR 作业选项为增量还原创建备份作业。此作业只能在 create_job 期间设置。创建作业后,无法再将其设置为增量还原。
示例 XML:远程备份作业
远程备份作业的作业参数:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--****The command below must be on one line.****-->
<dscCreateJob xmlns="http://schemas.teradata.com/v2012/DSC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="DSC.xsd">
<!-- Optional -->
<job_instance>
<!-- 'job_name' - Required, max 128 characters.-->
<!-- Note: Can be omitted in xml to be specified via command line. -->
<job_name>SampleRemoteBackup1</job_name>
<!-- 'job_description' - Required, max 256 characters. -->
<!-- Note: Can be omitted in xml to be specified via command line. -->
<job_description>This is a sample remote backup job.</job_description>
<!-- 'job_type' - Required, accepted values: BACKUP, RESTORE, ANALYZE_VALIDATE, ANALYZE_READ -->
<!-- Note: Can be omitted in xml to be specified via command line. -->
<job_type>BACKUP</job_type>
<!-- 'auto_retire' - Optional, accepted values: true/false -->
<auto_retire>true</auto_retire>
<!-- 'retire_value' - Required (if auto_retire is true) -->
<retire_value>15</retire_value>
<!-- 'retire_units' - Required (if auto_retire is true), accepted values: DAYS, WEEKS -->
<retire_units>DAYS</retire_units>
<!-- 'objectlist' - Required for BACKUP, RESTORE, ANALYZE_VALIDATE -->
<!-- Note: 'objectlist' is NOT permitted for ANALYZE_READ jobs -->
<objectlist>
<objectinfo>
<!-- 'object_name' - Required, max 128 characters -->
<object_name>CreateQCFVer</object_name>
<!-- 'object_type' - Required, accepted values: AGGREGATE_FUNCTION, AUTHORIZATION, COMBINED_AGGREGATE_FUNCTIONS, DATABASE, EXTERNAL_PROCEDURE, GLOP_SET, HASH_INDEX, INSTANCE_OR_CONSTRUCTOR_METHOD, JAR, JOIN_INDEX, MACRO, NO_PI_TABLE, ORDERED_ANALYTICAL_FUNCTION, QUEUE_TABLE, STANDARD_FUNCTION, STATISTICAL_FUNCTION, STORED_PROCEDURE, TABLE, TABLE_FUNCTION, TRIGGER, USER, USER_DEFINED_METHOD, USER_DEFINED_DATA_TYPE, VIEW -->
<object_type>TABLE</object_type>
<!-- 'parent_name' - Required, max 128 characters -->
<parent_name>SystemFe</parent_name>
<!-- 'parent_type' - Required, accepted values: DATABASE/USER -->
<parent_type>DATABASE</parent_type>
</objectinfo>
<objectinfo>
<object_name>ABC</object_name>
<object_type>DATABASE</object_type>
<parent_name>DBC</parent_name>
<parent_type>DATABASE</parent_type>
<object_attribute_list>
<includeAll>false</includeAll>
</object_attribute_list>
<!-- 'exclude' - Optional -->
<exclude>
<excludeobjectinfo>
<object_name>T1</object_name>
<object_type>TABLE</object_type>
</excludeobjectinfo>
<excludeobjectinfo>
<object_name>T2</object_name>
<object_type>TABLE</object_type>
</excludeobjectinfo>
</exclude>
</objectinfo>
</objectlist>
</job_instance>
<!-- 'source_tdpid' - Required, max 32 characters -->
<source_tdpid>system1</source_tdpid>
<!-- 'source_accountid' - Optional, max 30 characters -->
<source_accountid>acctid</source_accountid>
<!-- 'target_media' - Required, max 32 characters -->
<target_media>remote1_nbu</target_media>
<!-- 'job_options' - Required -->
<job_options>
<!-- 'online'- Optional, accepted values: true/false -->
<online>false</online>
<!-- 'nosync' - Optional, accepted values: true/false -->
<nosync>false</nosync>
<!-- 'data_phase' - Required, accepted values: DATA,DICTIONARY -->
<data_phase>DATA</data_phase>
<!-- 'query_band' - Optional, max 2048 characters -->
<query_band>queryBandTest</query_band>
<!-- 'dsmain_logging_level' - Optional, accepted values: Error, Info, Debug, Warning -->
<dsmain_logging_level>Error</dsmain_logging_level>
<!-- 'nowait' - Optional, accepted values: true/false -->
<nowait>false</nowait>
<!-- skip_archive -Optional can be true/false. Skip archive during the backup job in case error in access rights. Supported in DBS 15.10.01 and above -->
<skip_archive>true</skip_archive>
<!-- skip_stats - Optional can be true/false, default is false. Skip collecting the stats during the backup job. Supported in DBS 16.00 and above -->
<skip_stats>true</skip_stats>
<!-- track_empty_tables -Optional can be true/false. When it's true, it will track empty table during the backup. Supported in DBS 16.00 and above -->
<track_empty_tables>true</track_empty_tables>
<!-- streams_softlimit -Optional for BACKUP/RESTORE/ANALYZE_VALIDATE -->
<!-- Job level stream softlimit. This value will override system level stream softlimit-->
<streams_softlimit>10</streams_softlimit>
<!-- single_object_locking - Optional, can be true/false, default is false. Enables the Enhanced Lock Management feature, to lock objects in a backup one at a time rather than all at the beginning of the backup. -->
<single_object_locking>false</single_object_locking>
<!-- skip_joinhash_index - Optional can be true/false, default is false. Skip archiving the join and hash index during the backup job. Supported in DBS 16.20 and above -->
<skip_joinhash_index>true</skip_joinhash_index>
</job_options>
</dscCreateJob>
示例 XML:为增量还原启用的备份作业
为增量还原启用的远程备份作业的任务参数:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--****The command below must be on one line.****-->
<dscCreateJob xmlns="http://schemas.teradata.com/v2012/DSC"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="DSC.xsd">
<!-- Optional -->
<job_instance>
<!-- 'job_name' - Required, max 128 characters.-->
<!-- Note: Can be omitted in xml to be specified via command line. -->
<job_name>SampleRemoteBackup1</job_name>
<!-- 'job_description' - Required, max 256 characters. -->
<!-- Note: Can be omitted in xml to be specified via command line. -->
<job_description>This is a sample remote backup job.</job_description>
<!-- 'job_type' - Required, accepted values: BACKUP, RESTORE, ANALYZE_VALIDATE, ANALYZE_READ -->
<!-- Note: Can be omitted in xml to be specified via command line. -->
<job_type>BACKUP</job_type>
<!-- 'auto_retire' - Optional, accepted values: true/false -->
<auto_retire>true</auto_retire>
<!-- 'retire_value' - Required (if auto_retire is true) -->
<retire_value>15</retire_value>
<!-- 'retire_units' - Required (if auto_retire is true), accepted values: DAYS, WEEKS -->
<retire_units>DAYS</retire_units>
<!-- 'objectlist' - Required for BACKUP/RESTORE/ANALYZE_VALIDATE -->
<!-- Note: 'objectlist' is NOT permitted for ANALYZE_READ jobs -->
<objectlist>
<objectinfo>
<!-- 'object_name' - Required, max 128 characters -->
<object_name>CreateQCFVer</object_name>
<!-- 'object_type' - Required, accepted values: AGGREGATE_FUNCTION, AUTHORIZATION, COMBINED_AGGREGATE_FUNCTIONS, DATABASE, EXTERNAL_PROCEDURE, GLOP_SET, HASH_INDEX, INSTANCE_OR_CONSTRUCTOR_METHOD, JAR, JOIN_INDEX, MACRO, NO_PI_TABLE, ORDERED_ANALYTICAL_FUNCTION, QUEUE_TABLE, STANDARD_FUNCTION, STATISTICAL_FUNCTION, STORED_PROCEDURE, TABLE, TABLE_FUNCTION, TRIGGER, USER, USER_DEFINED_METHOD, USER_DEFINED_DATA_TYPE, VIEW -->
<object_type>TABLE</object_type>
<!-- 'parent_name' - Required, max 128 characters -->
<parent_name>SystemFe</parent_name>
<!-- 'parent_type' - Required, accepted values: DATABASE, USER -->
<parent_type>DATABASE</parent_type>
</objectinfo>
<objectinfo>
<object_name>ABC</object_name>
<object_type>DATABASE</object_type>
<parent_name>DBC</parent_name>
<parent_type>DATABASE</parent_type>
<object_attribute_list>
<includeAll>false</includeAll>
</object_attribute_list>
<!-- 'exclude' - Optional -->
<exclude>
<excludeobjectinfo>
<object_name>T1</object_name>
<object_type>TABLE</object_type>
</excludeobjectinfo>
<excludeobjectinfo>
<object_name>T2</object_name>
<object_type>TABLE</object_type>
</excludeobjectinfo>
</exclude>
</objectinfo>
</objectlist>
</job_instance>
<!-- 'source_tdpid' - Required, max 32 characters -->
<source_tdpid>system1</source_tdpid>
<!-- 'source_accountid' - Optional, max 30 characters -->
<source_accountid>acctid</source_accountid>
<!-- 'target_media' - Required, max 32 characters -->
<target_media>remote1_nbu</target_media>
<!-- 'job_options' - Required -->
<job_options>
<!-- 'online'- Optional, accepted values: true/false -->
<online>false</online>
<!-- 'nosync' - Optional, accepted values: true/false -->
<nosync>false</nosync>
<!-- 'data_phase' - Required, accepted values: DATA, DICTIONARY -->
<data_phase>DATA</data_phase>
<!-- 'query_band' - Optional, max 2048 characters -->
<query_band>queryBandTest</query_band>
<!-- 'dsmain_logging_level' - Optional, accepted values: Error, Info, Debug, Warning -->
<dsmain_logging_level>Error</dsmain_logging_level>
<!-- 'nowait' - Optional, accepted values: true/false -->
<nowait>false</nowait>
<!-- skip_archive -Optional can be true/false. Skip archive during the backup job in case error in access rights. Supported in DBS 15.10.01 and above -->
<skip_archive>true</skip_archive>
<!-- skip_stats - Optional can be true/false, default is false. Skip collecting the stats during the backup job. Supported in DBS 16.00 and above -->
<skip_stats>true</skip_stats>
<!-- track_empty_tables -Optional can be true/false. When it's true, it will track empty table during the backup. Supported in DBS 16.00 and above -->
<track_empty_tables>true</track_empty_tables>
<!-- streams_softlimit -Optional for BACKUP/RESOTRE/ANALYZE_VALIDATE -->
<!-- Job level stream softlimit. This value will override system level stream softlimit-->
<streams_softlimit>10</streams_softlimit>
<!-- skip_joinhash_index - Optional can be true/false, default is false. Skip archiving the join and hash index during the backup job. Supported in DBS 16.20 and above -->
<skip_joinhash_index>true</skip_joinhash_index>
<!-- enable_backup_for_IR - Optional can be true/false, default is false. Enable the IR feature during backup job. Supported in DBS 16.20 Update 2 and above -->
<enable_backup_for_IR>true</enable_backup_for_IR>
</job_options>
</dscCreateJob>
示例 XML:远程还原作业
远程还原作业的作业参数
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!--****The command below must be on one line.****--> <dscCreateJob xmlns="http://schemas.teradata.com/v2012/DSC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="DSC.xsd"> <!-- Optional --> <job_instance> <!-- 'job_name' - Required, max 128 characters.--> <!-- Note: Can be omitted in xml to be specified via command line. --> <job_name>SampleRemoteRestore1</job_name> <!-- 'job_description' - Required, max 256 characters. --> <!-- Note: Can be omitted in xml to be specified via command line. --> <job_description>This is a sample remote restore job.</job_description> <!-- 'job_type' - Required, accepted values: BACKUP,RESTORE, ANALYZE_VALIDATE, ANALYZE_READ --> <!-- Note: Can be omitted in xml to be specified via command line. --> <job_type>RESTORE</job_type> <!-- 'auto_retire' - Optional, accepted values: true/false --> <auto_retire>true</auto_retire> <!-- 'retire_value' - Required (if auto_retire is true) --> <retire_value>15</retire_value> <!-- 'retire_units' - Required (if auto_retire is true), accepted values: DAYS, WEEKS --> <retire_units>DAYS</retire_units> <!-- 'objectlist' - Required for BACKUP, RESTORE, ANALYZE_VALIDATE --> <!-- Note: 'objectlist' is NOT permitted for ANALYZE_READ jobs --> <objectlist> <objectinfo> <!-- 'object_name' - Required, max 128 characters --> <object_name>BAR1</object_name> <!-- 'object_type' - Required, accepted values: AGGREGATE_FUNCTION, AUTHORIZATION, COMBINED_AGGREGATE_FUNCTIONS, DATABASE, EXTERNAL_PROCEDURE, FUNCTION_ALIAS, GLOP_SET, HASH_INDEX, INSTANCE_OR_CONSTRUCTOR_METHOD, JAR, JOIN_INDEX, JOURNAL, MACRO, NO_PI_TABLE, ORDERED_ANALYTICAL_FUNCTION, QUEUE_TABLE, STANDARD_FUNCTION, STATISTICAL_FUNCTION, STORED_PROCEDURE, TABLE, TABLE_FUNCTION, TRIGGER, USER, USER_DEFINED_METHOD, USER_DEFINED_DATA_TYPE, VIEW --> <object_type>VIEW</object_type> <!-- 'parent_name' - Required, max 128 characters --> <parent_name>DBC</parent_name> <!-- 'parent_type' - Required, accepted values: DATABASE, USER --> <parent_type>DATABASE</parent_type> </objectinfo> <objectinfo> <object_name>BAR</object_name> <object_type>DATABASE</object_type> <parent_name>DBC</parent_name> <parent_type>DATABASE</parent_type> <!-- 'exclude' - Optional --> <exclude> <excludeobjectinfo> <object_name>T1</object_name> <object_type>TABLE</object_type> </excludeobjectinfo> <excludeobjectinfo> <object_name>T2</object_name> <object_type>TABLE</object_type> </excludeobjectinfo> </exclude> </objectinfo> <objectinfo> <object_name>BAR2</object_name> <object_type>VIEW</object_type> <parent_name>DBC</parent_name> <parent_type>DATABASE</parent_type> <!-- 'object_attribute_list' Optional --> <object_attribute_list> <!-- 'map_to' - Optional, max 128 characters --> <map_to>DBC2</map_to> <!-- 'rename_to' - Optional, max 128 characters --> <rename_to>BAR2</rename_to> <!-- 'config_map_name' - Optional hash map name, max 128 characters --> <config_map_name>objectLevelMap</config_map_name> </object_attribute_list> </objectinfo> </objectlist> <!-- 'backup_name'- Required for RESTORE, ANALYZE_READ, ANALYZE_VALIDATE jobs. --> <backup_name>SampleRemoteBackup1</backup_name> <!-- 'backup_version' - Required for RESTORE, ANALYZE_READ, ANALYZE_VALIDATE jobs. Optional for incremental restore job. --> <!-- Note: Value = '0', latest save set from backup. Value > 0 is an existing save set.--> <backup_version>0</backup_version> <!-- next_incremental_restore - Optional for incremental restore job. Default is false. Set to true to indicate restore to automatically apply the next available save set. If set to true, you cannot specify backup_version. Supported in Advanced SQL Engine 16.20 Update 2 and later--> <next_incremental_restore>true</next incremental_restore> <!-- 'all_backup_objects' - Required for RESTORE, ANALYZE_READ, ANALYZE_VALIDATE jobs. --> <!-- Accepted values: true/false. --> <!-- Note: If False then objectlist is required. --> <all_backup_objects>false</all_backup_objects> </job_instance> <!-- 'source_media' - Required, max 32 characters --> <source_media>remote1_nbu</source_media> <!-- 'target_tdpid' - Required, max 32 characters --> <target_tdpid>system1</target_tdpid> <!-- 'target_accountid' - Optional, max 30 characters --> <target_accountid>acctid</target_accountid> <!-- 'job_options' - Required --> <job_options> <!-- 'data_phase' - Optional, accepted values: DATA, DICTIONARY --> <data_phase>DATA</data_phase> <!-- 'enable_temperature_override' - Optional, accepted values: true/false --> <enable_temperature_override>false</enable_temperature_override> <!-- 'temperature_override' - Optional, accepted values: DEFAULT, HOT, WARM, COLD --> <temperature_override>DEFAULT</temperature_override> <!-- 'block_level_compression' - Optional, accepted values: DEFAULT, ON, OFF --> <block_level_compression>DEFAULT</block_level_compression> <!-- 'disable_fallback' - Optional, accepted values: true/false --> <disable_fallback>false</disable_fallback> <!-- 'query_band' - Optional, max 2048 characters --> <query_band>queryBandTest</query_band> <!-- 'dsmain_logging_level' - Optional, accepted values: Error, Info, Debug, Warning --> <dsmain_logging_level>Error</dsmain_logging_level> <!-- 'reblock' - Optional, accepted values: true/false --> <!-- Note: Only useful for RESTORE jobs.--> <reblock>false</reblock> <!-- 'run_as_copy' - Optional, accepted values: true/false --> <!-- Note: Only useful for RESTORE jobs.--> <run_as_copy>false</run_as_copy> <!-- 'skip_archive' -Optional can be true/false. Skip archive during the restore job in case error in access rights. Supported in DBS 15.10.01 and later --> <skip_archive>true</skip_archive> <!-- 'skip_stats' - Optional can be true/false, default is false. Skip restoring the stats during the restore job. Supported in DBS 16.00 and later --> <skip_stats>true</skip_stats> <!-- 'config_map_name' - Optional, Hash map name, max 128 characters --> <config_map_name>jobLevelMap</config_map_name> <!-- 'concurrent_bld_per_tbl' - Optional, Number of index and fallback subtables that can be built concurrently per table during restore. --> <!-- Range 1-5 for database version 16.0 and later --> <!-- Note: Only useful for RESTORE jobs. --> <concurrent_bld_per_tbl>5</concurrent_bld_per_tbl> <!-- 'map_to' - Optional, apply map_to to all objects in the restore job. Supported in Teradata Database 16.00 and later --> <map_to>new_db</map_to> <!-- 'streams_softlimit' - Optional for BACKUP, RESTORE, ANALYZE_VALIDATE --> <!-- Job level stream softlimit. This value will override system level stream softlimit. --> <!-- Value can be 1 - max soft limit of the stream soft limit, where max is the number of AMPS per node in the system. --> <streams_softlimit>10</streams_softlimit> <!-- skip_joinhash_index - Optional. Can be true/false. Default is false. Skip restoring the join and hash index during the backup job. Supported in DBS 16.20 and later --> <skip_joinhash_index>true</skip_joinhash_index> <!-- enable_incremental_restore - Optional. Can be true/false. Default is false. Enable incremental restore feature when creating restore job. Supported in Advanced SQL Engine 16.20 Update 2 and later --> <enable_incremental_restore>false</enable_incremental_restore> <!-- skip_build_secondary_indexes - Optional. Can be true/false. Default is false. Skip building the secondary index during the restore job. Supported in Advanced SQL Engine 16.20 Update 2 and later --> <skip_build_secondary_indexes>fales</skip_build_secondary_indexes> </job_options> </dscCreateJob>
增量还原作业的命令 XML
<enable_backup_for_IR>true</enable_backup_for_IR> <!—include_DBC_data -– Optional. Can be true/false, default is false. Enable the IR feature for DBC tables during backup job. Supported in DBS 17.10 and above --> <include_DBC_data>true</include_DBC_data>