# standalone

## Description
A collection of scripts that were helpful during the migration learning and discovery process.

## create_db_user_schema.sql
Creates a standard PostgreSQL db, user, and schema, with the necessary grants and extensions. Similar to `..\helper\SQL-Create-Db_User-Schema.sql`

### Usage
```
psql -U enterprisedb -h localhost -p 5444 -d postgres -v v1=schema_name -f create_db_user_schema.sql
```
## create_db_user_schema_usedb.sql
Similar to `create_db_user_schema.sql`, skips creating the db.

### Usage
```
psql -U enterprisedb -h localhost -p 5444 -d db_name -v v1=schema_name -f create_db_user_schema_usedb.sql
```

## drop_user.sql
### Usage
```
psql -U enterprisedb -h localhost -p 5444 -d postgres -v v1=user_name -f drop_user.sql
```

## vacuum_schema.sql
Vacuums every table explicitly in the schema.

### Usage
```
psql -U enterprisedb -h localhost -p 5444 -d db_name -v v1=schema_name -f vacuum_schema.sql
```

## pg_copy_schema.ps1
Clone a schema inside a PostgreSQL database. Creates a new user with the new schema name and `_user` and schema name as the password.

### Requires
 * `create_db_user_schema_usedb.sql`
 * `vacuum_schema.sql`

### Usage
```
.\pg_copy_schema.ps1 -ServerHost localhost -Port 5444 -Database db_name -Username user_name -Password user_pass -OldSchema existing_schema -NewSchema new_schema -AdminUsername enterprisedb -AdminPassword admin_pass
```

## compile_check_schema.ps1
Recompiles all objects in an Oracle database and notifies the user of any invalid objects.
### Usage
```
.\compile_check_schema.ps1 -Schema schema_name -ConnString "oracleuser/oraclepass@oraclserver:oracleport/oracleservice"
```

## Obsolete scripts
* `edb_ddl_processor.ps1`
* `edb_migration_portal_postprocessor.sql`
