I watched video tutorial at https://www.youtube.com/watch?v=IalqQN09OaA . My Oracle database version
select * from v$version;
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
I download sample at https://github.com/donhuvy/db-sample-schemas/tree/main/human_resources .
Inside Oracle SQL Developer version 22.x , with user system, Run command
@ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
I entered
Input 1: Password for HR: 123456
Input 2: Tablespace: SYSTEM
Input 3: Temporary tablespace: TEMP
Input 4: Password for SYSTEM user: 12345678
Input 5: Log path: C:\
Input 6: Connection string: localhost:1521/xe
My steps
localhost:1521/xe
Error
specify password for HR as parameter 1:
specify default tablespeace for HR as parameter 2:
specify temporary tablespace for HR as parameter 3:
specify password for SYS as parameter 4:
specify log path as parameter 5:
specify connect string as parameter 6:
Error starting at line : 86 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
DROP USER hr CASCADE
Error report -
ORA-01918: user 'HR' does not exist
01918. 00000 - "user '%s' does not exist"
*Cause: User does not exist in the system.
*Action: Verify the user name is correct.
Error starting at line : 95 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
CREATE USER hr IDENTIFIED BY &pass
Error report -
ORA-65096: invalid common user or role name
65096. 00000 - "invalid common user or role name"
*Cause: An attempt was made to create a common user or role with a name
that was not valid for common users or roles. In addition to the
usual rules for user and role names, common user and role names
must consist only of ASCII characters, and must contain the prefix
specified in common_user_prefix parameter.
*Action: Specify a valid common user or role name.
Error starting at line : 97 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
ALTER USER hr DEFAULT TABLESPACE &tbs
QUOTA UNLIMITED ON &tbs
Error report -
ORA-01918: user 'HR' does not exist
01918. 00000 - "user '%s' does not exist"
*Cause: User does not exist in the system.
*Action: Verify the user name is correct.
Error starting at line : 100 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
ALTER USER hr TEMPORARY TABLESPACE &ttbs
Error report -
ORA-01918: user 'HR' does not exist
01918. 00000 - "user '%s' does not exist"
*Cause: User does not exist in the system.
*Action: Verify the user name is correct.
Error starting at line : 102 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO hr
Error report -
ORA-01917: user or role 'HR' does not exist
01917. 00000 - "user or role '%s' does not exist"
*Cause: There is not a user or role by that name.
*Action: Re-specify the name.
Error starting at line : 103 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE , UNLIMITED TABLESPACE TO hr
Error report -
ORA-01917: user or role 'HR' does not exist
01917. 00000 - "user or role '%s' does not exist"
*Cause: There is not a user or role by that name.
*Action: Re-specify the name.
Connected.
Error starting at line : 110 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
GRANT execute ON sys.dbms_stats TO hr
Error report -
ORA-01917: user or role 'HR' does not exist
01917. 00000 - "user or role '%s' does not exist"
*Cause: There is not a user or role by that name.
*Action: Re-specify the name.
Error starting at line : 116 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
connect ...
Error report -
Connection Failed
USER = hr
URL = jdbc:oracle:thin:@localhost:1521/xe
Error Message = ORA-01017: invalid username/password; logon denied
Commit
SP2-0640: Not connected
SP2-0640: Not connected
Error starting at line : 124 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_cre
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_cre.sql"
Error starting at line : 130 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_popul
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_popul.sql"
Error starting at line : 136 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_idx
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_idx.sql"
Error starting at line : 142 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_code
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_code.sql"
Error starting at line : 148 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_comnt
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_comnt.sql"
Error starting at line : 154 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_analz
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_analz.sql"
How to fix?
Update
Use command
alter session set "_oracle_script"=true;
@ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
Session altered.
specify password for HR as parameter 1:
specify default tablespeace for HR as parameter 2:
specify temporary tablespace for HR as parameter 3:
specify password for SYS as parameter 4:
specify log path as parameter 5:
specify connect string as parameter 6:
User HR dropped.
User HR created.
User HR altered.
User HR altered.
Grant succeeded.
Grant succeeded.
Connected.
Grant succeeded.
Connected.
Session altered.
Session altered.
Error starting at line : 124 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_cre
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_cre.sql"
Error starting at line : 130 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_popul
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_popul.sql"
Error starting at line : 136 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_idx
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_idx.sql"
Error starting at line : 142 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_code
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_code.sql"
Error starting at line : 148 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_comnt
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_comnt.sql"
Error starting at line : 154 File @ C:\Users\Administrator\Downloads\db-sample-schemas-21.1\human_resources\hr_main.sql
In command -
@__SUB__CWD__/human_resources/hr_analz
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_analz.sql"
Connection created by CONNECT script command disconnected
PL/SQL procedure successfully completed.
DBMS_SYSTEM.GET_ENV
Alias sqlcl_int_runme dropped
How to fix error
Error report -
SP2-0310: Unable to open file: "__SUB__CWD__/human_resources/hr_idx.sql"
Unfortunately the default sample script installation process is not great for the novice. Please head over to this blog post
https://connor-mcdonald.com/2021/11/02/quick-and-easy-sample-data/
which describes why this is the case, but more importantly will give you a workaround which involves just running a single script in SQL*Plus. That script will also try to guide you through the process to avoid any errors, eg