SQL: Oracle Database Sample Schemas and SQL *Plus


 

Oracle Database comes with sample schemas, such as the EMP_DETAILS_VIEW view of the Human Resources (HR) sample schema used in the tutorial and guide.  This schema contains records for a made up company. 

For column details for the view EMP_DETAILS_VIEW, enter: DESCRIBE EMP_DETAILS_VIEW.
 

Unlocking the Sample Tables:

As part of the default Oracle Database installation, the Human Resources (HR) Sample Schema comes installed.  By default, the HR account is locked.

Before you can use the HR sample schema, you must unlock the HR account.  To do this, log in using the SYSTEM user information, and enter the following command, where your_password is the password that needs to be defined for the user HR:

ALTER USER HR IDENTIFIED BY your_password ACCOUNT UNLOCK;

The HR user is necessary in order to run the examples in this guide, and is primarily to let you access the HR sample schema.
 

Do the following in order to create HR tables from command-line SQL*Plus:

1. Get your Oracle Database account information (username and password) from your DBA director, and then log in to SQL *Plus.

2. Do one of the following:

  • Enter the following command at the SQL *Plus prompt on UNIX: SQL> @?/DEMO/SCHEMA/HUMAN_RESOURCES/HR_MAIN.SQL
     
  • Enter the following command at the SQL *Plus prompt on Windows: SQL>@?\DEMO\SCHEMA\HUMAN_RESOURCES\HR_MAIN.SQL

NOTE:  Perform the same steps, but replace HR_MAIN.SQL with HR.DROP.SQL to remove the sample tables.


Referenced from: W3Schools
 

13594
10/13/2023 3:43:40 PM