All scripts necessary to install sample schemas reside in $ORACLE_HOME
/demo/schema
directory. Before you install sample schemas by running these scripts, follow these guidelines:
-
You must connect as a system administrator using the
SYSDBA
privilege. -
When prompted to enter a password for the schema, enter a secure password that meets the requirements described in Oracle Database Security Guide.
-
When prompted for tablespace names while running scripts:
-
Enter an appropriate tablespace name, for example,
users
as the default tablespace for a schema -
Enter
temp
as the temporary tablespace for a schema
-
-
When prompted for the log directory name, enter
$ORACLE_HOME
/demo/schema/log/
or any other existing directory name.
Note:
Make sure that you end the log directory name with a trailing slash, for example,$ORACLE_HOME
/demo/schema/log/
Installing the HR Schema
All scripts necessary to create the Human Resource (HR) schema reside in $ORACLE_HOME
/demo/schema/human_resources
.
You need to call only one script, hr_main.sql
, to create all the objects and load the data. The following steps provide a summary of the installation process:
-
Log on to SQL*Plus as
SYS
andconnect
using theAS SYSDBA
privilege.sqlplus connect sys as sysdba Enter password: password
-
To run the
hr_main.sql
script, use the following command:SQL> @?/demo/schema/human_resources/hr_main.sql
-
Enter a secure password for HR
specify password for HR as parameter 1: Enter value for 1:
See Also:
Oracle Database Security Guide for the minimum password requirements -
Enter an appropriate tablespace, for example,
users
as the default tablespace forHR
specify default tablespace for HR as parameter 2: Enter value for 2:
-
Enter
temp
as the temporary tablespace forHR
specify temporary tablespace for HR as parameter 3: Enter value for 3:
-
Enter your
SYS
passwordspecify password for SYS as parameter 4: Enter value for 4:
-
Enter the directory path, for example,
$ORACLE_HOME
/demo/schema/log/
, for your log directoryspecify log path as parameter 5: Enter value for 5:
After the hr_main.sql
script runs successfully and the HR
schema is installed, you are connected as the user HR.
To verify that the schema was created, use the following command:
SQL> SELECT table_name FROM user_tables;
Running hr_main.sql
accomplishes the following tasks:
-
Removes any previously installed
HR
schema -
Creates the user
HR
and grants the necessary privileges -
Connects as
HR
-
Calls the scripts that create and populate the schema objects