---
title: "import schema reference"
url: "https://docs.yugabyte.com/stable/yugabyte-voyager/reference/schema-migration/import-schema/"
---

# import schema reference

YugabyteDB Voyager import schema reference

yb-voyager import schema

[Import the schema](/stable/yugabyte-voyager/migrate/migrate-steps/#import-schema "Import the schema") to the YugabyteDB database.

During migration, run the import schema command twice, first without the [--post-snapshot-import](#arguments "--post-snapshot-import") argument and then with the argument. The second invocation creates indexes and triggers in the target schema, and must be done after [import data](/stable/yugabyte-voyager/migrate/migrate-steps/#import-data "import data") is complete.

For Oracle migrations

For Oracle migrations using YugabyteDB Voyager v1.1 or later, the Orafce extension is installed on the target database by default. This enables you to use a subset of predefined functions, operators, and packages from Oracle. The extension is installed in the public schema, and when listing functions or views, extra objects will be visible on the target database which may confuse you. You can remove the extension using the [DROP EXTENSION](/stable/api/ysql/the-sql-language/statements/ddl_drop_extension "DROP EXTENSION") command.

Deprecated flags

The `--post-import-data` and `--refresh-mviews` flags are deprecated. Use [finalize-schema-post-data-import](/stable/yugabyte-voyager/reference/schema-migration/finalize-schema-post-data-import/ "finalize-schema-post-data-import") instead.

## Syntax

```text
Usage: yb-voyager import schema [ <arguments> ... ]
```

### Arguments

The following table lists the valid CLI flags and parameters for `import schema` command.

When run at the same time, flags take precedence over configuration flag settings.

CLI flag

Config file parameter Description 

--continue-on-error

```yaml
import-schema:
  continue-on-error:
```

Continue to import all the exported schema even if there are errors, and output all the erroneous DDLs to the `failed.sql` file in the `export-dir/schema` directory.  
Default: false  
Example: `yb-voyager import schema ... --continue-on-error true`  
Accepted parameters: true, false, yes, no, 0, 1 

--enable-orafce

```yaml
import-schema:
  enable-orafce:
```

Enables Orafce extension on target (if source database type is Oracle).  
Default: true  
Accepted parameters: true, false, yes, no, 0, 1 

--exclude-object-type-list

```yaml
import-schema:
  exclude-object-type-list:
```

Comma-separated list of schema object types (object types are case-insensitive) to exclude while importing schema (ignored if --object-type-list is used).  
Example: `--exclude-object-type-list 'FUNCTION,PROCEDURE'` 

--ignore-exist

```yaml
import-schema:
  ignore-exist:
```

Ignore if an object already exists on the target database.  
Default: false  
Example: `yb-voyager import schema ... --ignore-exist true`  
Accepted parameters: true, false, yes, no, 0, 1 

--object-type-list,  
\--exclude-object-type-list

```yaml
import-schema:
  object-type-list:
  exclude-object-type-list:
```

Comma-separated list of objects to import (--object-type-list) or not (--exclude-object-type-list). You can provide only one of the arguments at a time.  
Example: `yb-voyager import schema …. -object-type-list "TABLE,FUNCTION,VIEW"`  
Accepted parameters:

- Oracle: TYPE, SEQUENCE, TABLE, PARTITION, INDEX, PACKAGE, TRIGGER, FUNCTION, PROCEDURE, MVIEW, SYNONYM
- PostgreSQL: SCHEMA, COLLATION, EXTENSION, TYPE, DOMAIN, SEQUENCE, TABLE, INDEX, FUNCTION, AGGREGATE, PROCEDURE, VIEW, TRIGGER, MVIEW, RULE, COMMENT
- MySQL: TABLE, PARTITION, INDEX, VIEW, TRIGGER, FUNCTION, PROCEDURE

--straight-order

```yaml
import-schema:
  straight-order:
```

Imports the schema objects in the order specified via the `--object-type-list` flag.  
Default: false  
Example: `yb-voyager import schema ... --object-type-list 'TYPE,TABLE,VIEW...' --straight-order true`  
Accepted parameters: true, false, yes, no, 0, 1 

--target-db-type

```yaml
import-schema:
  target-db-type
```

Target database type to import into.  
Accepted values: yugabytedb (default), yugabytedb-amp (more details coming soon) 

--target-db-host

```yaml
target:
  db-host:
```

Domain name or IP address of the machine on which target database server is running.  
Default: 127.0.0.1 

--target-db-name

```yaml
target:
  db-name:
```

Target database name.  
Default: yugabyte 

--target-db-password

```yaml
target:
  db-password:
```

Target database password. Alternatively, you can also specify the password by setting the environment variable `TARGET_DB_PASSWORD`. If you don't provide a password via the CLI or environment variable during any migration phase, yb-voyager will prompt you at runtime for a password. If the password contains special characters that are interpreted by the shell (for example, # and $), enclose the password in single quotes. 

--target-db-port

```yaml
target:
  db-port:
```

Port number of the target database server.  
Default: 5433 

--target-db-schema

```yaml
source:
  db-schema:
```

Schema name of the target YugabyteDB database. MySQL and Oracle migrations only. 

--target-db-user

```yaml
target:
  db-user:
```

Username of the target YugabyteDB database. 

[--target-ssl-cert](/stable/yugabyte-voyager/reference/yb-voyager-cli/#yugabytedb-options "--target-ssl-cert")

```yaml
target:
  ssl-cert:
```

Path to a file containing the certificate which is part of the SSL `<cert,key>` pair. 

[--target-ssl-key](/stable/yugabyte-voyager/reference/yb-voyager-cli/#yugabytedb-options "--target-ssl-key")

```yaml
target:
  ssl-key:
```

Path to a file containing the key which is part of the SSL `<cert,key>` pair. 

[--target-ssl-crl](/stable/yugabyte-voyager/reference/yb-voyager-cli/#yugabytedb-options "--target-ssl-crl")

```yaml
target:
  ssl-crl:
```

Path to a file containing the SSL certificate revocation list (CRL). 

--target-ssl-mode

```yaml
target:
  ssl-mode:
```

Specify the SSL mode for the target database as one of `disable`, `allow`, `prefer` (default), `require`, `verify-ca`, or `verify-full`. 

[--target-ssl-root-cert](/stable/yugabyte-voyager/reference/yb-voyager-cli/#yugabytedb-options "--target-ssl-root-cert")

```yaml
target:
  ssl-root-cert:
```

Path to a file containing SSL certificate authority (CA) certificate(s). 

-e, --export-dir

```yaml
export-dir:
```

Path to the export directory. This directory is a workspace used to store exported schema DDL files, export data files, migration state, and a log file. 

--send-diagnostics

```yaml
send-diagnostics:
```

Enable or disable sending [diagnostics](/stable/yugabyte-voyager/reference/diagnostics-report/ "diagnostics") information to Yugabyte.  
Default: true  
Accepted parameters: true, false, yes, no, 0, 1 

-l, --log-level

```yaml
log-level:
```

Log level for yb-voyager.  
Accepted values: trace, debug, info, warn, error, fatal, panic  
Default: info 

--log-max-size-mb

```yaml
log-max-size-mb:
```

Maximum size in MB of a yb-voyager log file before it is rotated. Also applies to the Debezium log file during live migration.  
Default: 200 

--log-max-backups

```yaml
log-max-backups:
```

Maximum number of rotated log files to retain. Older files are deleted. Use -1 to retain all rotated log files.  
Default: 10 

--post-snapshot-import — **\[Deprecated]** Perform schema related tasks on the target YugabyteDB after data import is complete. Use --refresh-mviews along with this flag to refresh materialized views.  
Default: false  
Accepted parameters: true, false, yes, no, 0, 1 

--refresh-mviews — **\[Deprecated]** Refreshes the materialized views on target during the post-import-data phase.  
Default: false  
Accepted parameters: true, false, yes, no, 0, 1 

-y, --yes — Answer yes to all prompts during the export schema operation.  
Default: false 

-h, --help — Command line help. 

-c, --config-file — Path to a [configuration file](/stable/yugabyte-voyager/reference/configuration-file "configuration file").

### Examples

Configuration file:

```yaml
yb-voyager import schema --config-file <path-to-config-file>
```

CLI:

```sh
yb-voyager import schema --export-dir /dir/export-dir \
        --target-db-host 127.0.0.1 \
        --target-db-user ybvoyager \
        --target-db-password 'password' \
        --target-db-name target_db \
        --target-db-schema target_schema
```

Example of import schema with [--post-snapshot-import](/stable/yugabyte-voyager/migrate/migrate-steps/#post-snapshot-import "--post-snapshot-import") and --refresh-mviews flags are as follows:

```sh

yb-voyager import schema --export-dir /dir/export-dir \
        --target-db-host 127.0.0.1 \
        --target-db-user ybvoyager \
        --target-db-password 'password' \
        --target-db-name target_db \
        --target-db-schema target_schema \
        --post-snapshot-import true \
        --refresh-mviews true
```
