Skip to content

Commit

Permalink
[DOC-269] added prepare the target database in bulk data load (#21410)
Browse files Browse the repository at this point in the history
* added prepare target db as a prereq step

* change from review

* change from review
  • Loading branch information
aishwarya24 authored Mar 11, 2024
1 parent 3e1c403 commit 1419d93
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/content/preview/yugabyte-voyager/migrate/bulk-data-load.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,41 @@ The following page describes the steps to import data in CSV or TEXT format from

* Before you perform a bulk load, in your target YugabyteDB database, create the schema of the tables into which the data in the flat files will be imported.

## Prepare the target database

Prepare your target YugabyteDB database cluster by creating a user.

### Create a user

Create a user with [`SUPERUSER`](../../../api/ysql/the-sql-language/statements/dcl_create_role/#syntax) role.

* For a local YugabyteDB cluster or YugabyteDB Anywhere, create a user and role with the superuser privileges using the following command:

```sql
CREATE USER ybvoyager SUPERUSER PASSWORD 'password';
```

* For YugabyteDB Managed, create a user with [`yb_superuser`](../../../yugabyte-cloud/cloud-secure-clusters/cloud-users/#admin-and-yb-superuser) role using the following command:

```sql
CREATE USER ybvoyager PASSWORD 'password';
GRANT yb_superuser TO ybvoyager;
```

If you want yb-voyager to connect to the target YugabyteDB database over SSL, refer to [SSL Connectivity](../../reference/yb-voyager-cli/#ssl-connectivity).

{{< warning title="Deleting the ybvoyager user" >}}

After migration, all the migrated objects (tables, views, and so on) are owned by the `ybvoyager` user. You should transfer the ownership of the objects to some other user (for example, `yugabyte`) and then delete the `ybvoyager` user. Example steps to delete the user are:

```sql
REASSIGN OWNED BY ybvoyager TO yugabyte;
DROP OWNED BY ybvoyager;
DROP USER ybvoyager;
```

{{< /warning >}}

## Import data files from the local disk

If your data files are in CSV or TEXT format and are present on the local disk, and you have already created a schema in your target YugabyteDB database, you can use the following `yb-voyager import data file` command with required arguments to load the data into the target table directly from the flat file(s).
Expand Down

0 comments on commit 1419d93

Please sign in to comment.