2 Installation of the Sample Schemas

To use the sample schemas, download the installable .zip file from the GitHub repository.

Installing the Sample Schemas

You can install the sample schemas independently.

Each sample schema comes with its own set of scripts, including an installation script. The following steps describe how to install the hr schema, but you can complete similar steps to install any of the sample schemas.

Note:

  • You use a client program such as SQL*Plus or SQLcl to install the schemas. You can also use SQL Developer, Visual Studio Code with the Oracle SQL Developer extension, or any other client program that supports running SQL scripts and connecting to the database as a privileged user with rights to create and drop other users.
  • To install or uninstall the sh schema, you must use SQLcl, SQL Developer, or Visual Studio Code with the Oracle SQL Developer extension. You cannot use SQL*Plus to install the sh schema.
  • When you install any of the Oracle Database sample schemas, you are prompted to drop (remove) any previously installed schema with the same name, and the default answer is yes. If you accept the default, the previous schema is dropped and a fresh schema is installed.
  • Do not use the sample schemas for your personal or business data and applications. The sample schemas are meant to be used for demonstration purposes only.
  1. To find the latest version of the sample schemas installation scripts, go to the following GitHub location :
    https://github.com/oracle/db-sample-schemas/releases/latest
    Previous versions of the sample schemas are available at the following location:
    https://github.com/oracle-samples/db-sample-schemas/releases
  2. Clone the GitHub repository, or download the .zip file from GitHub and then extract the files.
  3. Navigate to the folder that contains the schema that you want to install. In this case, navigate to the human_resources folder.

    (The co schema is in the customer_orders folder, and the sh schema is in the sales_history folder.)

  4. From the client program such as SQLcl or SQL*Plus, connect to the database as a privileged user with rights to create and drop other users. For example, connect as SYSTEM or ADMIN. To install the sh schema, you must use SQLcl or SQL Developer.

    For more information on connecting to a database by using SQLcl, see Connecting to a Database.

    For more information on connecting to a database by using SQL*Plus, see Starting SQL*Plus.

  5. Run the *_install.sql installation script. In this case, run hr_install.sql to create the hr schema.
    • Enter a secure password for the schema.
    • Enter a tablespace to use as the default for the schema. If you do not enter a tablespace, the default database tablespace is used.
    • Type yes or no to indicate whether to overwrite an existing schema. The default answer is yes.
  6. Examine the script output and the log file to verify that the installation completed successfully.

Resetting Sample Schemas

Typically, there is no difference between installing a sample schema for the first time or reinstalling it over a previously installed version. By default, the *_install.sql scripts drop the schema users and all of their objects from the previous installation.

Therefore, to reset the sample schemas, follow the steps mentioned in the section Installing the Sample Schemas.

Uninstalling Sample Schemas

To uninstall a sample schema, run the corresponding *_uninstall.sql script from a client program such as SQL*Plus or SQLcl.

  1. Connect to the database as a privileged user with rights to create and drop other users.
    For example, connect as SYSTEM or ADMIN.
  2. Run the *_uninstall.sql uninstall script.
    For example, to uninstall the hr schema, run the hr_uninstall.sql script.