The restore command is used to restore an object from the frozen state to the readable state.

Note The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.

Command syntax

./ossutil restore cloud_url [--encoding-type url] [--payer requester] [-r] [-f] [--output-dir=odir] [-c file] [local_xml_file]

Examples

  • Restore an archived object
    ./ossutil restore oss://bucket/object
  • Restore archived objects whose names contain a specified prefix
    ./ossutil restore oss://bucket/path/ -r                         
    Note
    • The restore operation requires one minute. You cannot read an object that is being restored.
    • By default, the object remains in the readable state for 24 hours and returns to the frozen state. To increase the duration by 24 hours, run the restore command. The maximum duration of the readable state is seven days.
  • Restore a Cold Archive object
    ./ossutil restore oss://bucket/object ./config.xml
    config.xml is a local XML file that contains parameters to restore Cold Archive objects. Example:
    <RestoreRequest>
        <Days>3</Days>
        <JobParameters>
            <Tier>Bulk</Tier>
        </JobParameters>
    </RestoreRequest>
    • Days: specifies the time for which the Cold Archive object remains in the readable state. Unit: days. Valid values: 1 to 7.
    • Tier: specifies the restore mode for the Cold Archive object. Valid values: Expedited, Standard, and Bulk.
      • Expedited: indicates the highest priority. In this mode, the object is restored within one hour.
      • Standard: indicates the standard restore mode. In this mode, the object is restored in two to five hours.
      • Bulk: indicates that multiple objects are restored at a time. In this mode, objects are restored in 5 to 12 hours.

      The actual restoration time may vary with the size of the object to restore.

  • Restore a specified version of an Archive object from a versioning-enabled bucket
    ./ossutil restore oss://bucket1/test.jpg --version-id  CAEQARiBgID8rumR2hYiIGUyOTAyZGY2MzU5MjQ5ZjlhYzQzZjNlYTAyZDE3MDRk
    To use the --version-id option, you must run the ls --all-versions command to query version IDs of the object.
    Note The --version-id option can be used only for objects in versioning-enabled buckets. For more information about the command that is used to enable versioning on a bucket, see bucket-versioning.

Common options

The following table describes the options you can add to the restore command.
Option Description
-r, --recursive Performs operations on objects in a bucket. If this option is specified, commands that support this option will perform operations on all objects in a bucket that meet the specified conditions. If this option is not specified, the commands will perform operations only on the specified object.
-f, --force Forces an operation without prompting the user for confirmation.
-j, --jobs Specifies the number of concurrent jobs performed across multiple objects. Valid values: 1 to 10000. Default value: 3.
--encoding-type Specifies the encoding type of the object name. If this option is specified, this value must be url. If this option is not specified, the object name is not encoded. Bucket names cannot be URL-encoded.
--output-dir= Specifies the directory in which output objects reside. Output objects include report objects generated due to errors that occur when you use the cp command to copy multiple objects. For more information about the report objects, see the help information of the cp command. The default value is the ossutil_output directory in the current directory.
--version-id Specifies the version ID of an object in a versioning-enabled bucket.
--loglevel Specifies the log level. The default value is null, which indicates that no log files are generated. Valid values:
  • info: generates prompt logs.
  • debug: generates detailed logs that contain corresponding HTTP request and response information.
--retry-times Specifies the number of times an operation is retried if the operation fails. Valid values: 1 to 500. Default value: 10.
--payer Specifies the payer of the request. To enable pay-by-requester, set this option to requester.
--proxy-host Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. Examples: http://120.79. **.**:3128 and socks5://120.79. **. **:1080.
--proxy-user Specifies the username of the proxy server. The default value is null.
--proxy-pwd Specifies the password of the proxy server. The default value is null.
Note For more information about common options, see View options.