Skip to content

Create an Oracle database

Fill in the variables above and set the user’s password in the script. In Oracle a user is a schema — creating the user is what other engines call creating a database, and the schema carries the user’s name. There is no separate CREATE DATABASE step:

oracle-init.sql
ALTER SESSION SET "_ORACLE_SCRIPT"=true;
CREATE USER ${{ USERNAME }} IDENTIFIED BY "put_your_password";
GRANT CONNECT, RESOURCE TO ${{ USERNAME }};
GRANT CREATE SESSION TO ${{ USERNAME }};
GRANT UNLIMITED TABLESPACE TO ${{ USERNAME }};
GRANT SELECT ON SYS.DBA_RECYCLEBIN TO ${{ USERNAME }};
QUIT

Set the SYS password in your shell, then run the script:

Terminal window
export SYS_PASSWORD=put_your_sys_password
sqlplus sys/$SYS_PASSWORD@${{ HOSTNAME }}:1521/ORCLCDB as SYSDBA @/oracle-init.sql;