SSMA 控制台中的命令行选项 (AccessToSQL) Command-line options in the SSMA Console (AccessToSQL)

Microsoft 为你提供了一组强大的命令行选项来执行和控制 SSMA 活动。Microsoft provides you with a robust set of command-line options to execute and control SSMA activities. 后续部分提供了更多详细信息。The ensuing sections provide additional detail.

SSMA 控制台中的命令行选项Command-line options in the SSMA Console

本文介绍了控制台命令选项。Described herein are the console command options.

出于本部分的目的,术语 "option" 也称为 "switch"。For the purpose of this section, the term 'option' is also referred to as 'switch'.

选项不区分大小写,并且可以以 " - " 或 " / " 字符开头。Options are not case-sensitive and may start with either the '-' or '/' character.

如果指定了选项,则必须指定相应的选项参数。If options are specified, it is mandatory that you specify the corresponding option parameters.

选项参数必须与选项字符之间用空格分隔。Option parameters must be separated from the option character by white space.

语法示例:Syntax examples:

C:\> SSMAforAccessConsole.EXE -s scriptfile

C:\> SSMAforAccessConsole.EXE -s "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\AssessmentReportGenerationSample.xml" -v "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\VariableValueFileSample.xml" -c "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ServersConnectionFileSample.xml"

应将包含空格的文件夹或文件名指定为双引号。Folder or file names containing spaces should be specified in double quotes.

命令行项和错误消息的输出存储在 STDOUT 或指定文件中。The output of command-line entries and error messages is stored in STDOUT or in a specified file.

脚本文件选项:-s/脚本Script file option: -s/script

脚本文件路径/名称是必需的开关,指定 SSMA 要执行的命令序列的脚本。A mandatory switch, the script file path/name specifies the script of command sequences to be executed by SSMA.

语法示例:Syntax examples:

C:\>SSMAforAccessConsole.EXE -s "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml"

变量值文件选项:-v/variableVariable value file option: -v/variable

变量值文件包含脚本文件中使用的变量。The variable value file comprises variables used in the script file. 开关是可选的。The switch is optional. 如果变量未在变量文件中声明并在脚本文件中使用,则应用程序将生成错误并终止控制台执行。If variables are not declared in variable file and used in the script file, the application generates an error and terminates the console execution.

语法示例:Syntax examples:

  • 在多个变量值文件中定义的变量,可能有一个具有默认值的变量,另一个是特定于实例的值(如果适用)。Variables defined in multiple variable value files, perhaps one with a default value and another with an instance-specific value when applicable. 在命令行参数中指定的最后一个变量文件采用首选项,以防出现重复的变量:The last variable file specified in the command-line arguments takes the preference, in case there is a duplication of variables:

    C:\>SSMAforAccessConsole.EXE -s

    "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml" -v c:\migration

    projects\global_variablevaluefile.xml -v "c:\migrationprojects\instance_variablevaluefile.xml"

服务器连接文件选项:-c/microsoft.sqlserver.management.common.serverconnection>Server connection file option: -c/serverconnection

此文件包含每个服务器的服务器连接信息。This file contains server connection information for each server. 每个服务器定义由唯一的服务器 ID 标识。Each server definition is identified by a unique Server ID. 脚本文件中引用了与连接相关的命令的服务器 Id。The Server IDs are referenced in the script file for connection-related commands.

服务器定义可以是服务器连接文件和/或脚本文件的一部分。Server definition can be a part of server connection file and/or script file. 脚本文件中的服务器 id 优先于服务器连接文件,以防出现服务器 id 重复。Server id in script file takes precedence over the server connection file, in case there is a duplication of server id.

语法示例:Syntax examples:

  • 服务器 Id 在脚本文件中使用。Server IDs are used in the script file. 它们在单独的服务器连接文件中定义。They are defined in a separate server connection file. 此文件使用变量值文件中定义的变量:This file uses variables that are defined in the variable value file:

    C:\>SSMAforAccessConsole.EXE -s "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml" -v

    c:\SsmaProjects\myvaluefile1.xml -c

    c:\SsmaProjects\myserverconnectionsfile1.xml

  • 服务器定义嵌入到脚本文件中:Server definition is embedded in the script file:

    C:\>SSMAforAccessConsole.EXE -s "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml"

XML output 选项:-x/xmloutput [xmloutputfile]XML output option: -x/xmloutput [xmloutputfile]

此命令用于将 xml 格式的命令输出消息输出到控制台或 xml 文件。This command is used for outputting the command output messages in an xml format either to console or to an xml file.

Xmloutput 提供了两个选项,即:There are two options available for xmloutput, namely:

  • 如果在 xmloutput 开关之后提供了 filepath,则会将输出重定向到文件。If the filepath is provided after the xmloutput switch, the output is redirected to the file.

    语法示例:Syntax example:

    C:\>SSMAforAccessConsole.EXE -s

    "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml" -x d:\xmloutput\project1output.xml

  • 如果在 xmloutput 开关之后未提供 filepath,则 xmlout 将显示在控制台上。If no filepath is provided after the xmloutput switch, then the xmlout is displayed on the console itself.

    语法示例:Syntax example:

    C:\>SSMAforAccessConsole.EXE -s "C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml" -xmloutput

日志文件选项:-l/日志Log file option: -l/log

控制台应用程序中的所有 SSMA 操作都记录在一个日志文件中,并且开关是可选的。All the SSMA operations in the Console application are recorded in a log file, and the switch is optional. 如果在命令行中指定了日志文件及其路径,则会在指定的位置生成日志。If a log file and its path are specified at the command line, the log gets generated in the specified location. 否则,它将在其默认位置生成。Otherwise, it gets generated in its default location.

语法示例:Syntax example:

C:\>SSMAforAccessConsole.EXE

"C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml" -l c:\SsmaProjects\migration1.log

项目环境文件夹选项:-e/projectenvironmentProject environment folder option: -e/projectenvironment

此可选开关表示当前 SSMA 项目的项目环境设置文件夹。This optional switch denotes the project environment settings folder for the current SSMA project.

语法示例:Syntax example:

C:\>SSMAforAccessConsole.EXE -s

"C:\Program Files\Microsoft SQL Server Migration Assistant for Access\Sample Console Scripts\ConversionAndDataMigrationSample.xml" -e c:\SsmaProjects\CommonEnvironment

安全密码选项:-p/securepasswordSecure password option: -p/securepassword

此选项指示服务器连接的加密密码。This option indicates the encrypted password for server connections. 它与所有其他选项的不同之处在于,它不会执行任何与迁移相关的活动中的任何脚本或帮助,但有助于管理迁移项目中使用的服务器连接的密码加密。It differs from all other options in that it does not execute any script or help in any migration-related activities, but helps manage password-encryption for the server connections used in the migration project.

不能输入任何其他选项或密码作为命令行参数。You cannot enter any other option or password as the command-line parameter. 否则,会导致错误。Otherwise, it results in an error. 有关详细信息,请参阅 管理密码 部分。For more information, see the Managing Passwords section.

支持以下子选项 -p/securepasswordThe following suboptions are supported for -p/securepassword:

  • 若要为指定的服务器 ID 或服务器连接文件中定义的所有服务器 Id 添加密码或更新现有密码,请执行以下操作:To add a password, or update an existing password, to protected storage for a specified Server ID or for all Server IDs defined in the server connection file:

    -p|-securepassword -a|add {"<server_id>[, .n]"|all}``-c|-serverconnection <server-connection-file> [-v|variable <variable-value-file>]``[-o|overwrite]

    -p|-securepassword -a|add {"<server_id>[, .n]"|all}``-s|-script <server-connection-file> [-v|variable <variable-value-file>] [-o|overwrite]

  • 若要从指定服务器 ID 或所有服务器 Id 的受保护存储中删除加密密码:To remove the encrypted password from the protected storage of the specified Server ID or for all Server IDs:

    -p/securepassword -r/remove {<server_id> [, ...n] | all}

  • 若要显示为其加密密码的服务器 Id 的列表,请执行以下操作:To display a list of Server IDs for which the password is encrypted:

    -p/securepassword -l/list

  • 将存储在受保护的存储中的密码导出到加密文件中。To export the passwords stored in protected storage to an encrypted file. 此文件是用用户指定的密码加密的。This file is encrypted with the user-specified pass-phrase.

    -p/securepassword -e/export {<server-id> [, ...n] | all} <encrypted-password -file>

  • 使用用户指定的密码短语,先前导出的加密文件将导入到本地受保护的存储中。The encrypted-file that was earlier exported is imported to local protected storage using the user-specified pass-phrase. 文件解密后,它将存储在新文件中,后者将在本地计算机上加密。Once the file is decrypted, it is stored in a new file, which in turn, is encrypted on the local machine.

    -p/securepassword -i/import {<server-id> [, ...n] | all} <encrypted-password -file>

    可以使用逗号分隔符指定多个服务器 Id。Multiple Server IDs can be specified using comma-separators.

帮助选项:-?/HelpHelp option: -?/Help

显示 SSMA 控制台选项的语法摘要:Displays the syntax summary of SSMA Console options:

C:\>SSMAforAccessConsole.EXE -?

如要表格显示 SSMA 控制台命令行选项,请参阅 附录 1 (AccessToSQL)For a tabular display of the SSMA Console command-line options, refer to Appendix - 1 (AccessToSQL).

SecurePassword 帮助选项:-SecurePassword-?/HelpSecurePassword Help option: -securepassword -?/Help

显示 SSMA 控制台选项的语法摘要:Displays the syntax summary of SSMA Console options:

C:\>SSMAforAccessConsole.EXE -securepassword -?

如要表格显示 SSMA 控制台命令行选项,请参阅 附录-1 (AccessToSQL)For a tabular display of the SSMA Console command-line options, refer to Appendix - 1 (AccessToSQL)

后续步骤Next steps

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

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

  2. 有关生成报表的详细 (,请参阅 )中生成报表 For generating reports, see Generating Reports (AccessToSQL).

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