Skip to content

Creating Users

Create a new database schema and APEX workspace in one command:

Terminal window
local-26ai.sh create-user movies

The command does the following:

  • Creates a schema with the name that you give
  • Stores the schema password in the .env file
  • Saves the connection in the connection store of SQLcl
  • Adds the development grants
  • Gives access to the datapump directories
  • Creates an APEX workspace
  • Sets the workspace settings for session length, maximum emails, REST messages, and password lifetime

If you only need a database schema without an APEX workspace:

Terminal window
local-26ai.sh create-user myschema --skip-workspace

Add --compress to enable Advanced Compression on the tablespace of the new schema. Oracle Database Free includes this feature.

The database then compresses every table and index that you create later. Tables get advanced row compression. B-tree indexes get advanced index compression. The schema uses less disk space as it grows.

Terminal window
local-26ai.sh create-user movies --compress
# Combine with other flags as needed:
local-26ai.sh create-user myschema --skip-workspace --compress

Drop all objects in a schema and keep the schema itself. Use this command when you test an install script many times:

Terminal window
local-26ai.sh clear-schema movies
# Asks for confirmation before proceeding

To skip the confirmation prompt, use the -y flag. Use this flag in scripts and CI jobs:

Terminal window
local-26ai.sh clear-schema movies -y

Drop a schema and all its objects. The command also drops the tablespace of the schema and its datafile. The database returns the disk space to the operating system, so no orphan file stays behind:

Terminal window
local-26ai.sh drop-user movies
# Asks for confirmation before proceeding

To skip the confirmation prompt, use the -y flag. Use this flag in scripts and CI jobs:

Terminal window
local-26ai.sh drop-user movies -y

create-user stores every new user in the connection store of SQLcl:

Terminal window
# Connect using the stored connection
sql -name local-26ai-movies
# Connect to sys user
sql -name local-26ai-sys

The connections also appear in the VS Code SQL Developer extension. After you create a user, refresh the connection list.

Use these connection details for other development tools:

  • Host: localhost
  • Port: 1521
  • Service: FREEPDB1
  • Username: Your schema name
  • Password: The <NAME>_USER_PASSWORD value in the .env file