# Copying tables

Using the tools copy subcommand, you can create a copy of one or more DB tables. The copy operation leaves the source table unchanged while the copy contains all the source table data.

General format of the command:

ydb [global options...] tools copy [options...]


View a description of the command to copy a table:

ydb tools copy --help


## Parameters of the subcommand

Parameter name Parameter description
--timeout The time within which the operation should be completed on the server.
--item <property>=<value>,... Operation properties. You can specify the parameter more than once to copy several tables in a single transaction.
Required properties:
• destination, dst, d: Path to target table. If the destination path contains folders, they must be created in advance. No table with the destination name should exist.
• source, src, s: Path to source table.

## Examples

Note

The examples use the db1 profile. To learn more, see Creating a connection profile.

Create the backup folder in the DB:

ydb -p db1 scheme mkdir backup


Copy the series table to a table called series-v1, the seasons table to a table called seasons-v1, and episodes to episodes-v1 in the backup folder:

ydb -p db1 tools copy --item destination=backup/series-v1,source=series --item destination=backup/seasons-v1,source=seasons --item destination=backup/episodes-v1,source=episodes


View the listing of objects in the backup folder:

ydb -p db1 scheme ls backup


Result:

episodes-v1  seasons-v1  series-v1