ssma mysql 出错_执行 SSMA 控制台 (MySQLToSQL)

执行 SSMA 控制台 (MySQLToSQL)Executing the SSMA Console (MySQLToSQL)

01/19/2017

本文内容

Microsoft 为你提供了一组可靠的脚本文件命令来执行和控制 SSMA 活动。Microsoft provides you with a robust set of script file commands to execute and control SSMA activities.

控制台应用程序使用本部分中所列举的某些标准脚本文件命令。The console application uses certain standard script file commands as enumerated in this section.

项目脚本文件命令Project Script File Commands

命令Command

创建-新项目:create-new-project:

创建新的 SSMA 项目。Creates a new SSMA project.

项目命令用于处理创建项目、打开、保存和退出项目。The Project commands handle creating projects, opening, saving, and exiting projects.

脚本Script

project-folder 指示已创建项目的文件夹。project-folder indicates the folder of the project getting created.

project-name 指示项目的名称。project-name indicates the name of the project. {string}{string}

overwrite-if-exists可选属性指示是否应覆盖现有项目。overwrite-if-existsOptional attribute indicates if an existing project should be overwritten. 变量{boolean}

project-type:可选的特性。project-type:Optional attribute. 指示项目类型,即 "sql-2005" 项目或 "sql-server-2008" 项目或 "sql-server 2012" 或 "sql-server-2014" 项目或 "sql-azure" 项目。Indicates the project type i.e. "sql-server-2005" project or "sql-server-2008" project or "sql-server-2012" or "sql-server-2014" project or "sql-azure" project. 默认值为 "sql-server-2008"。Default is "sql-server-2008".

语法示例:Syntax Example:

project-folder=""

project-name=""

overwrite-if-exists="" (optional)

project-type=="" (optional)

/>

默认情况下,属性 "覆盖-exists" 为 false 。Attribute 'overwrite-if-exists' is false by default.

默认情况下,属性 "项目类型" 为 sql-server-2008 。Attribute 'project-type' is sql-server-2008 by default.

命令Command

打开项目:open-project:

打开现有的项目。Opens an existing project.

脚本Script

project-folder 指示已创建项目的文件夹。project-folder indicates the folder of the project getting created. 如果指定的文件夹不存在,则该命令将失败。The command fails if the specified folder does not exist. {string}{string}

project-name 指示项目的名称。project-name indicates the name of the project. 如果指定的项目不存在,则该命令将失败。The command fails if the specified project does not exist. {string}{string}

语法示例:Syntax Example:

project-folder=""

project-name=""

/>

重要

SSMA For MySQL 控制台应用程序支持向后兼容性。SSMA For MySQL Console Application supports backward compatibility. 你将能够打开以前版本的 SSMA 创建的项目。You will be able to open projects created by previous version of SSMA.

命令Command

保存-项目:保存迁移项目。save-project: Saves the migration project.

脚本Script

语法示例:Syntax Example:

命令Command

关闭项目close-project

:关闭迁移项目。: Closes the migration project.

脚本Script

语法示例:Syntax Example:

命令Command

关闭项目close-project

:关闭迁移项目。: Closes the migration project.

脚本Script

语法示例:Syntax Example:

if-modified="" (optional)

/>

特性 "if-modified" 是可选的,默认情况下 忽略 。Attribute 'if-modified' is optional, ignore by default.

数据库连接脚本文件命令Database Connection Script File Commands

数据库连接命令有助于连接到数据库。The Database Connection commands help connect to the database.

控制台中不支持 UI 的 浏览 功能。The Browse feature of the UI is not supported in console.

连接到 SQL Azure 时, windows 身份验证 和 端口 参数不适用。The windows-authentication and port parameters are not applicable when connecting to SQL Azure.

有关 "创建脚本文件" 的详细信息,请参阅 创建脚本文件 (MySQLToSQL)。For more information on 'Creating Script Files', see Creating Script Files (MySQLToSQL).

命令Command

连接-源-数据库connect-source-database

执行与源数据库的连接,并加载源数据库的高级元数据,而不是所有元数据。Performs connection to the source database and loads high-level metadata of the source database but not all of the metadata.

如果无法建立与源的连接,则会生成错误,并使控制台应用程序停止执行If the connection to the source cannot be established, an error is generated and the console application stops further execution

脚本Script

服务器定义是从为服务器连接文件或脚本文件的 server 部分中的每个连接定义的名称属性中检索的。Server definition is retrieved from the name attribute defined for each connection in the server section of the server connection file or the script file.

语法示例:Syntax Example:

命令Command

强制加载-源/目标-数据库force-load-source/target-database

加载源元数据。Loads the source metadata.

适用于脱机处理迁移项目。Useful for working on migration project offline.

如果无法建立与源/目标的连接,则会生成错误,并使控制台应用程序停止进一步执行If the connection to the source/target cannot be established, an error is generated and the console application stops further execution

脚本Script

需要一个或多个元数据库节点作为命令行参数。Requires one or several metabase nodes as command-line parameter.

语法示例:Syntax Example:

命令Command

重新连接-源-数据库reconnect-source-database

重新连接到源数据库,但不会加载任何元数据,这与连接源数据库命令不同。Reconnects to the source database but does not load any metadata unlike the connect-source-database command.

如果 (无法建立与源) 的连接,则会生成错误,并且控制台应用程序将停止执行。If (re)connection with the source cannot be established, an error is generated and the console application stops further execution.

脚本Script

语法示例:Syntax Example:

命令Command

连接目标-数据库connect-target-database

连接到目标 SQL Server 或 Azure SQL 数据库,并加载目标数据库的高级元数据,而不是完全加载元数据。Connects to the target SQL Server or Azure SQL Database and loads high-level metadata of the target database but not the metadata entirely.

如果无法建立与目标的连接,则会生成错误,并且控制台应用程序将停止执行。If the connection to the target cannot be established, an error is generated and the console application stops further execution.

脚本Script

服务器定义从为服务器连接文件或脚本文件的服务器部分中的每个连接定义的名称属性中检索Server definition is retrieved from the name attribute defined for each connection in the server section of the server connection file or the script file

语法示例:Syntax Example:

命令Command

重新连接-目标-数据库reconnect-target-database

重新连接到目标数据库,但不加载任何元数据,这与连接目标数据库命令不同。Reconnects to the target database but does not load any metadata, unlike the connect-target-database command.

如果无法建立与目标) 的 (连接,则会生成错误,并且控制台应用程序将停止执行。If (re)connection to the target cannot be established, an error is generated and the console application stops further execution.

脚本Script

语法示例:Syntax Example:

报表脚本文件命令Report Script File Commands

报表命令生成各种 SSMA 控制台活动的性能报告。The Report commands generate reports on the performance of various SSMA Console activities.

命令Command

生成-评估-报表generate-assessment-report

在源数据库上生成评估报告。Generates assessment reports on the source database.

如果在执行此命令之前未执行源数据库连接,则会生成错误并退出控制台应用程序。If the source database connection is not performed before executing this command, an error is generated and the console application exits.

在执行命令期间,无法连接到源数据库服务器也会导致终止控制台应用程序。Failure to connect to the source database server during the command execution, also results in terminating the console application.

脚本Script

assessment-report-folder: 指定存储评估报表的文件夹。 (可选特性)assessment-report-folder: Specifies folder where the assessment report is stored.(optional attribute)

object-name: 指定 () 用于评估报表生成的对象, (可以将单个对象名称或组对象名称) 。object-name: Specifies the object(s) considered for assessment report generation (It can have individual object names or a group object name).

object-type: 指定对象名属性中指定的对象的类型 (如果指定了对象类别,则对象类型将为 "category" ) 。object-type: specifies the type of the object specified in the object-name attribute (if object category is specified then object type will be "category").

assessment-report-overwrite: 指定是否覆盖评估报告文件夹(如果已存在)。assessment-report-overwrite: Specifies whether to overwrite the assessment report folder if it already exists.

默认值: false。Default value: false. (可选特性)(optional attribute)

write-summary-report-to: 指定将在其中生成汇总报表的路径。write-summary-report-to: Specifies the path where the summary report will be generated.

如果仅提到文件夹路径,则按名称 AssessmentReport < n > 。创建 XML 。If only the folder path is mentioned, then file by name AssessmentReport.XML is created. (可选特性)(optional attribute)

报表创建还有另外两个子类别:Report creation has two further sub-categories:

report-errors (= "true/false",默认值为 "false" (可选属性) # A3report-errors (="true/false", with default as "false" (optional attributes))

verbose (= "true/false",默认值为 "false" (可选属性) # A3verbose (="true/false", with default as "false" (optional attributes))

语法示例:Syntax Example:

object-name=""

object-type=""

write-summary-report-to="" (optional)

verbose="" (optional)

report-errors="" (optional)

conversion-report-folder="" (optional)

conversion-report-overwrite="" (optional)

/>

或or

conversion-report-folder="" (optional)

conversion-report-overwrite="" (optional)

>

object-type=""/>

迁移脚本文件命令Migration Script File Commands

迁移命令将目标数据库架构转换为源架构,并将数据迁移到目标服务器。The Migration commands convert the target database schema to the source schema and migrates data to the target server.

迁移命令的默认控制台输出设置为 "完全" 输出报告,没有详细的错误报告:仅限源对象树根节点上的 "摘要"。The default console output setting for the migration commands is 'Full' output report with no detailed error reporting: Only summary at the source object tree root node.

命令Command

转换-架构convert-schema

执行从源到目标架构的架构转换。Performs schema conversion from source to the target schema.

如果在执行此命令之前未执行源或目标数据库连接,或者与源或目标数据库服务器之间的连接在命令执行过程中失败,则会生成错误并退出控制台应用程序。If the source or target database connection is not performed before executing this command or the connection to the source or target database server fails during the command execution, an error is generated and the console application exits.

脚本Script

conversion-report-folder: 指定存储评估报表的文件夹。 (可选特性)conversion-report-folder: Specifies folder where the assessment report is stored.(optional attribute)

object-name: 指定 (s) 用于转换架构的对象 (它可以有单个对象名或) 的组对象名称。object-name: Specifies the object(s) considered for converting schema (It can have individual object names or a group object name).

object-type: 指定对象名属性中指定的对象的类型 (如果指定了对象类别,则对象类型将为 "category" ) 。object-type: specifies the type of the object specified in the object-name attribute (if object category is specified then object type will be "category").

conversion-report-overwrite: 指定是否覆盖评估报告文件夹(如果已存在)。conversion-report-overwrite: Specifies whether to overwrite the assessment report folder if it already exists.

默认值: false。Default value: false. (可选特性)(optional attribute)

write-summary-report-to: 指定将在其中生成汇总报表的路径。write-summary-report-to: Specifies the path where the summary report will be generated.

如果仅提到文件夹路径,则按名称 SchemaConversionReport < n > 。创建 XML 。If only the folder path is mentioned, then file by name SchemaConversionReport.XML is created. (可选特性)(optional attribute)

创建摘要报表包含另外两个子类别:Summary report creation has two further sub-categories:

report-errors (= "true/false",默认值为 "false" (可选属性) # A3report-errors (="true/false", with default as "false" (optional attributes))

verbose (= "true/false",默认值为 "false" (可选属性) # A3verbose (="true/false", with default as "false" (optional attributes))

语法示例:Syntax Example:

object-name=""

object-type=""

write-summary-report-to="" (optional)

verbose="" (optional)

report-errors="" (optional)

conversion-report-folder="" (optional)

conversion-report-overwrite="" (optional)

/>

或or

conversion-report-folder="" (optional)

conversion-report-overwrite="" (optional)

object-type=""/>

命令Command

迁移-数据migrate-data

将源数据迁移到目标。Migrates the source data to the target.

脚本Script

object-name: 指定) 用于迁移数据的源对象 ( (它可以有单个对象名或) 的组对象名称。object-name: Specifies the source object(s) considered for migrating data (It can have individual object names or a group object name).

object-type: 指定对象名属性中指定的对象的类型 (如果指定了对象类别,则对象类型将为 "category" ) 。object-type: specifies the type of the object specified in the object-name attribute (if object category is specified then object type will be "category").

write-summary-report-to: 指定将在其中生成汇总报表的路径。write-summary-report-to: Specifies the path where the summary report will be generated.

如果仅提到文件夹路径,则按名称 DataMigrationReport < n > 。创建 XML 。If only the folder path is mentioned, then file by name DataMigrationReport.XML is created. (可选特性)(optional attribute)

报表创建还有另外两个子类别:Report creation has two further sub-categories:

report-errors (= "true/false",默认值为 "false" (可选属性) # A3report-errors (="true/false", with default as "false" (optional attributes))

verbose (= "true/false",默认值为 "false" (可选属性) # A3verbose (="true/false", with default as "false" (optional attributes))

语法示例:Syntax Example:

write-summary-report-to=""

report-errors="true" verbose="true">

source-use-last-used="true"/source-server=""

target-use-last-used="true"/target-server=""/>

或or

object-name=""

object-type=""

write-summary-report-to=""

report-errors="true" verbose="true"/>

"迁移准备脚本文件" 命令Migration Preparation Script File Command

迁移准备命令启动源数据库和目标数据库之间的架构映射。The Migration Preparation command initiates schema mapping between the source and target databases.

命令Command

映射架构map-schema

将源数据库映射到目标架构的架构。Schema mapping of source database to the target schema.

脚本Script

source-schema 指定要迁移的源架构。source-schema specifies the source schema we intend to migrate.

sql-server-schema 指定要将其迁移到的目标架构。sql-server-schema specifies the target schema where we want it to be migrated.

语法示例:Syntax Example:

source-schema=""

sql-server-schema=""/>

可管理性脚本文件命令Manageability Script File Commands

可管理性命令有助于将目标数据库对象与源数据库同步。The Manageability commands help synchronize the target database objects with the source database.

备注

迁移命令的默认控制台输出设置为 "完全" 输出报告,没有详细的错误报告:仅限源对象树根节点上的 "摘要"。The default console output setting for the migration commands is 'Full' output report with no detailed error reporting: Only summary at the source object tree root node.

命令Command

同步-目标synchronize-target

将目标对象与目标数据库同步。Synchronizes the target objects with the target database.

如果对源数据库执行此命令,则会遇到错误。If this command is executed against the source database, an error is encountered.

如果在执行此命令之前未执行目标数据库连接,或者与目标数据库服务器之间的连接在命令执行过程中失败,则会生成错误并退出控制台应用程序。If the target database connection is not performed before executing this command or the connection to the target database server fails during the command execution, an error is generated and the console application exits.

脚本Script

object-name: 指定要与目标数据库同步) (的对象, (可以将单个对象名称或组对象名称) 。object-name: Specifies the object(s) considered for synchronizing with target database (It can have individual object names or a group object name).

object-type: 指定对象名属性中指定的对象的类型 (如果指定了对象类别,则对象类型将为 "category" ) 。object-type: specifies the type of the object specified in the object-name attribute (if object category is specified then object type will be "category").

on-error: 指定是否将同步错误指定为警告或错误。on-error: Specifies whether to specify synchronization errors as warnings or error. 针对出错的可用选项:Available options for on-error:

报表-总警告report-total-as-warning

报告-每个警告report-each-as-warning

fail-脚本fail-script

report-errors-to: 指定同步操作的错误报告位置 (可选属性) 如果仅指定了文件夹路径,则创建按名称 TargetSynchronizationReport.XML 文件。report-errors-to: Specifies location of error report for the synchronization operation (optional attribute) if only folder path is given, then file by name TargetSynchronizationReport.XML is created.

语法示例:Syntax Example:

object-name=""

on-error="

report-each-as-warning/

fail-script>" (optional)

report-errors-to="" (optional)

/>

或or

object-name=""

object-type=""/>

或or

命令Command

从数据库刷新refresh-from-database

刷新数据库中的源对象。Refreshes the source objects from database.

如果对目标数据库执行此命令,则会生成错误。If this command is executed against the target database, an error is generated.

脚本Script

object-name: 为源对象指定 () 的源对象, (可以将单个对象名称或组对象名称) 。object-name: Specifies the source object(s) considered for refreshing from source database (It can have individual object names or a group object name).

object-type: 指定对象名属性中指定的对象的类型 (如果指定了对象类别,则对象类型将为 "category" ) 。object-type: Specifies the type of the object specified in the object-name attribute (if object category is specified then object type will be "category").

on-error: 指定是否将同步错误指定为警告或错误。on-error: Specifies whether to specify synchronization errors as warnings or error. 针对出错的可用选项:Available options for on-error:

报表-总警告report-total-as-warning

报告-每个警告report-each-as-warning

fail-脚本fail-script

report-errors-to: 指定同步操作的错误报告位置 (可选属性) 如果仅指定了文件夹路径,则创建按名称 SourceDBRefreshReport.XML 文件。report-errors-to: Specifies location of error report for the synchronization operation (optional attribute) if only folder path is given, then file by name SourceDBRefreshReport.XML is created.

需要一个或多个元数据库节点作为命令行参数。Requires one or several metabase nodes as command-line parameter.

语法示例:Syntax Example:

object-name=""

on-error="

report-each-as-warning/

fail-script>" (optional)

report-errors-to="" (optional)

/>

或or

object-name=""

object-type=""/>

或or

脚本生成脚本文件命令Script Generation Script File Commands

脚本生成命令执行双重任务:它们有助于将控制台输出保存到脚本文件中;并根据指定的参数将 T-sql 输出记录到控制台或文件中。The Script Generation commands perform dual tasks: They help save the console output in a script file; and record the T-SQL output to the console or a file based on the parameter you specify.

命令Command

另存为脚本save-as-script

用于将对象的脚本保存到在元数据库 = 目标时提到的文件中,这是同步命令的替代方法,在其中获取脚本并在目标数据库上执行相同的。Used to save the Scripts of the objects to a file mentioned when metabase=target ,this is an alternative to synchronization command where in we get the scripts and execute the same on the target database.

脚本Script

需要一个或多个元数据库节点作为命令行参数。Requires one or several metabase nodes as command-line parameter.

object-name: 指定要保存其脚本的对象 () 。object-name: Specifies the object(s) whose scripts are to be saved . (可以有单个对象名或组对象名)(It can have individual object names or a group object name)

object-type: 指定对象名属性中指定的对象的类型 (如果指定了对象类别,则对象类型将为 "category" ) 。object-type: specifies the type of the object specified in the object-name attribute (if object category is specified then object type will be "category").

metabase: 指定它是源元数据库还是目标元数据库。metabase: Specifies whether it is the source or target metabase.

destination: 指定要在其中保存脚本的路径或文件夹。如果未提供文件名,则格式 (object_name 属性值) 为 out。destination: Specifies the path or the folder where the script has to be saved, if the file name is not given then a file name in the format (object_name attribute value).out

overwrite: 如果为 true,则它将覆盖相同的文件名。overwrite: if true then it overwrites if same filename exist. 它的值可以为 true/false) (。It can have the values (true/false).

语法示例:Syntax Example:

metabase=""

object-name=""

object-type=""

destination=""

overwrite="" (optional)

/>

或or

metabase=""

destination=""

object-type=""/>

命令Command

convert-sql 语句convert-sql-statement

context 指定架构名称。context specifies the schema name.

destination 指定是否应将输出存储在文件中。destination specifies whether the output should be stored in a file.

如果未指定此属性,则转换后的 T-sql 语句将显示在控制台上。If this attribute is not specified, then the converted T-SQL statement is displayed on the console. (可选特性)(optional attribute)

conversion-report-folder 指定存储评估报表的文件夹。 (可选特性)conversion-report-folder specifies folder where the assessment report is stored.(optional attribute)

conversion-report-overwrite 指定是否覆盖评估报告文件夹(如果已存在)。conversion-report-overwrite specifies whether to overwrite the assessment report folder if it already exists.

默认值: false。Default value: false. (可选特性)(optional attribute)

write-converted-sql-to 指定文件 (或) 文件夹路径,在其中存储已转换的 T-sql。write-converted-sql-to specifies the file (or) folder path where the converted T-SQL is to be stored. 如果文件夹路径与属性一起指定,则 sql-files 每个源文件都将具有在指定文件夹下创建的相应目标 t-sql 文件。When a folder path is specified along with the sql-files attribute, each source file will have a corresponding target T-SQL file created under the specified folder. 当文件夹路径与属性一起指定时 sql ,转换后的 t-sql 会写入到指定文件夹下名为 Result 的文件中。When a folder path is specified along with the sql attribute, the converted T-SQL is written to a file named Result.out under the specified folder.

sql 指定要转换的 MySQL sql 语句,可以使用 ";" 分隔一条或多条语句sql specifies the MySQL sql statements to be converted, one or more statements can be separated using a ";"

sql-files 指定必须转换为 T-sql 代码的 sql 文件的路径。sql-files specifies the path of the sql files which has to be converted to T-SQL code.

write-summary-report-to 指定将在其中生成汇总报表的路径。write-summary-report-to specifies the path where the summary report will be generated. 如果仅提到文件夹路径,则创建按名称 ConvertSQLReport.XML 文件。If only the folder path is mentioned, then file by name ConvertSQLReport.XML is created. (可选特性)(optional attribute)

报表创建还有2个子类别,即:Report creation has 2 further sub-categories, viz..,:

报告错误 (= "true/false",默认值为 "false" (可选属性) # A3。report-errors (="true/false", with default as "false" (optional attributes)).

详细 (= "true/false",默认值为 "false" (可选属性) # A3。verbose (="true/false", with default as "false" (optional attributes)).

脚本Script

需要一个或多个元数据库节点作为命令行参数。Requires one or several metabase nodes as command-line parameter.

语法示例:Syntax Example:

context=""

conversion-report-folder=""

conversion-report-overwrite=""

write-summary-report-to="" (optional)

verbose="" (optional)

report-errors="" (optional)

destination="stdout/file" (optional)

write-converted-sql-to=""

sql="SELECT 1 FROM DUAL;">

或or

context=""

conversion-report-folder=""

conversion-report-overwrite=""

write-summary-report-to="" (optional)

verbose="" (optional)

report-errors="" (optional)

destination="" (optional)

write-converted-sql-to=""

sql-files="\*.sql"

/>

或or

context=""

conversion-report-folder=""

conversion-report-overwrite=""

sql-files="\*.sql"

/>

下一步Next Step

下一步取决于项目要求:The next step depends on your project requirements:

若要指定密码或导出/导入密码,请参阅 管理密码 (MySQLToSQL)。For specifying a password or export/ import passwords, see Managing Passwords (MySQLToSQL).

有关生成报表的详细 (,请参阅 )中生成报表。

有关控制台中问题的疑难解答,请参阅 排查 (MySQLToSQL)。For troubleshooting issues in console, see Troubleshooting (MySQLToSQL).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值