tencent cloud

文档反馈

DescribeBackupCommand

最后更新时间:2024-11-26 16:33:38

    1. API Description

    Domain name for API request: sqlserver.intl.tencentcloudapi.com.

    This API is used to query the commands of creating backups canonically.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeBackupCommand.
    Version Yes String Common Params. The value used for this API: 2018-03-28.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    BackupFileType Yes String Backup file type. Full: full backup. FULL_LOG: full backup which needs log increments. FULL_DIFF: full backup which needs differential increments. LOG: log backup. DIFF: differential backup.
    DataBaseName Yes String Database name
    IsRecovery Yes String Whether restoration is required. No: not required. Yes: required.
    LocalPath No String Storage path of backup files. If this parameter is left empty, the default storage path will be D:\.

    3. Output Parameters

    Parameter Name Type Description
    Command String Create a backup command
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Querying the Command of Creating a Full Backup

    This example shows you how to query the command to create a full backup and an incremental transaction log backup when you need to import the incremental transaction log backup. The full backup created does not need to be restored.
    \\n in the command means a line feed.

    Input Example

    https://sqlserver.intl.tencentcloudapi.com/?Action=DescribeBackupCommand
    &BackupFileType=FULL
    &DataBaseName=db1
    &IsRecovery=YES
    &LocalPath=E:/
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "Command": "declare @dbname varchar(100)\\\\ndeclare @localtime varchar(20)\\\\ndeclare @str varchar(8000)\\\\nset @dbname='db1'\\\\nset @localtime =replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')\\\\nset @str='BACKUP DATABASE [' + @dbname + '] TO  DISK = N''E:/' + @dbname + '_' + @localtime + '_2full2_2noreconvery2.bak'' WITH INIT'\\\\nexec(@str)\\\\ngo",
            "RequestId": "03199d88-9dda-49eb-a045-7c69eb4d3591"
        }
    }
    

    Example2 Querying the Command of Creating an Incremental Transaction Log Backup

    This example shows you how to obtain the recovered incremental backup of transaction logs by this API when an incremental import of transaction logs is needed.
    \\n in the command means a line feed.

    Input Example

    https://sqlserver.intl.tencentcloudapi.com/?Action=DescribeBackupCommand
    &BackupFileType=LOG
    &DataBaseName=db1
    &IsRecovery=YES
    &LocalPath=E:/
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "Command": "BACKUP DATABASE db1 TO DISK='E:/db1.bak' WITH INIT",
            "RequestId": "1de3aea3-5fef-4891-b8b0-faeb4e3b5543"
        }
    }
    

    Example3 Querying the Command of Creating a Full Backup and an Incremental Transaction Log Backup

    This example shows you how to obtain the full backup without recovery by this API when an incremental import of transaction logs is needed.\\n in the command means a line feed.

    Input Example

    https://sqlserver.intl.tencentcloudapi.com/?Action=DescribeBackupCommand
    &BackupFileType=FULL_LOG
    &DataBaseName=db1
    &IsRecovery=NO
    &LocalPath=E:/
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "Command": "declare @dbname varchar(100)\\\\ndeclare @localtime varchar(20)\\\\ndeclare @str varchar(8000)\\\\nset @dbname='db1'\\\\nset @localtime =replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')\\\\nset @str='BACKUP LOG [' + @dbname + '] TO  DISK = N''E:/' + @dbname + '_' + @localtime + '_2log2_2reconvery2.bak'' WITH FORMAT, INIT'\\\\nexec(@str)\\\\ngo",
            "RequestId": "8d53700f-b80b-415a-8738-0c340eff2057"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InvalidParameter.InputIllegal Input error.
    InvalidParameter.ParamsAssertFailed An error occurred while converting parameter assertion.
    UnauthorizedOperation.PermissionDenied CAM authentication error.