Sunday, November 30, 2025

Sample DB installation on Oracle DB

$> sqlplus
Enter username: system (or whatever) and the password; Firstly, set the session container as pdb:

SQL> SHOW PDBS;
SP2-0382: The SHOW PDBS command is not available
SQL> SELECT name, open_mode FROM v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY

ORCLPDB
READ WRITE


SQL> ALTER SESSION SET CONTAINER=ORCLPDB;

Session altered.

SQL> SHOW CON_NAME;

CON_NAME
------------------------------
ORCLPDB
SQL> @sh_install.sql

Thank you for installing the Oracle Sales History Sample Schema.
This installation script will automatically exit your database session
at the end of the installation or if any error is encountered.
The entire installation will be logged into the 'sh_install.log' log file.

Enter a password for the user SH:


Enter a tablespace for SH [USERS]: USERS
Do you want to overwrite the schema, if it already exists? [YES|no]:
CREATE USER sh IDENTIFIED BY "oracle"
            *
ERROR at line 1:
ORA-65096: invalid common user or role name


Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
That's why we need to create sh user.
SQL> CREATE USER sh IDENTIFIED BY oracle
  2    DEFAULT TABLESPACE users
  3    TEMPORARY TABLESPACE temp
  4    QUOTA UNLIMITED ON users;

User created.

SQL> GRANT CONNECT, RESOURCE, CREATE VIEW, CREATE PROCEDURE TO sh;

Grant succeeded.

SQL> GRANT UNLIMITED TABLESPACE TO sh;

Grant succeeded.
Let's try to install again:
SQL> @sh_install.sql

Thank you for installing the Oracle Sales History Sample Schema.
This installation script will automatically exit your database session
at the end of the installation or if any error is encountered.
The entire installation will be logged into the 'sh_install.log' log file.

Enter a password for the user SH:


Enter a tablespace for SH [USERS]: USERS
Do you want to overwrite the schema, if it already exists? [YES|no]: YES
Old SH schema has been dropped.

Start time: 30-NOV-25 04.23.31.746000 PM +03:00
******  Creating COUNTRIES table ....

Table created.

******  Creating CUSTOMERS table ....

Table created.

******  Creating PROMOTIONS table ....

Table created.

******  Creating PRODUCTS table ....

Table created.

******  Creating TIMES table ....

Table created.

******  Creating CHANNELS table ....

Table created.

******  Creating SALES table ....

Table created.

******  Creating COSTS table ....

Table created.

******  Creating SUPPLEMENTAL_DEMOGRAPHICS table ....

Table created.

******  Creating views ....

View created.

******  Creating materialized views ....

Materialized view created.


Materialized view created.

******  Adding comments to tables...

Comment created.


...


Comment created.


Session altered.

******  Disabling table constraints for the load

Table altered.


...


Table altered.

******  Populating CHANNELS table ....

PL/SQL procedure successfully completed.

******  Populating COUNTIRES table ....

PL/SQL procedure successfully completed.

******  Populating PRODUCTS table ....

PL/SQL procedure successfully completed.


Commit complete.

SP2-0158: unknown SET option "LOAD"
******  Populating COSTS table ....
SP2-0734: unknown command beginning "LOAD costs..." - rest of line ignored.
******  Populating CUSTOMERS table ....
SP2-0734: unknown command beginning "LOAD custo..." - rest of line ignored.
******  Populating PROMOTIONS table ....
SP2-0734: unknown command beginning "LOAD promo..." - rest of line ignored.
******  Populating SALES table ....
SP2-0734: unknown command beginning "LOAD sales..." - rest of line ignored.
******  Populating TIMES table ....
SP2-0734: unknown command beginning "LOAD times..." - rest of line ignored.
******  Populating SUPPLEMENTARY_DEMOGRAPHICS table ....
SP2-0734: unknown command beginning "LOAD suppl..." - rest of line ignored.
******  Enabling table constraints

Table altered.

...


Table altered.

******  Creating indexes for SALES table ....

Index created.


...

Index created.

******  Creating indexes for COSTS table ....

Index created.


Index created.

******  Creating indexes for PRODUCTS table ....

Index created.


...

Index created.

******  Creating dimensions ....

Dimension created.


...

Dimension created.


Dimension created.

******  Gathering statistics for schema ...

PL/SQL procedure successfully completed.


End time: 30-NOV-25 04.23.37.822000 PM +03:00

1 row selected.


Installation
-------------
Verification:

Table                        provided     actual
-------------------------- ---------- ----------
channels                            5          5
costs                           82112          0
countries                          35         35
customers                       55500          0
products                           72         72
promotions                        503          0
sales                          918843          0
times                            1826          0
supplementary_demographics       4500          0

Thank you!
--------------------------------------------------------
The installation of the sample schema is now finished.
Please check the installation verification output above.

You will now be disconnected from the database.

Thank you for using Oracle Database!

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

No comments:

Post a Comment