Oracle Database 12cリリース2 以降では、最新バージョンのサンプル・スキーマのスクリプトを GitHub (https://github.com/oracle/db-sample-schemas/releases/latest) で入手できます。
Oracle Databaseサンプル・スキーマは、様々なチャネルを介して商品を販売する架空のサンプル会社に基づいています。この会社は、製品の注文を履行するために世界中で業務を行っています。いくつかの部門が存在し、そのそれぞれはサンプル・データベース・スキーマで表されます。
- Human Resources スキーマ (hr) は基本トピックの紹介に役立ちます。このスキーマの拡張機能では、Oracle Internet Directoryのデモをサポートしています。
- Customer Orders (co)スキーマ は、E-Commerceのトランザクションのデモに役立つ最新のスキーマです。JSONを使用して半構造化データを保存できます。
- Sales History (sh) スキーマ は大量のデータを使用するデモ向けに設計されています。このスキーマの拡張機能では、拡張分析処理をサポートしています。
次のスキーマは更新されなくなりましたが、引き続き使用できます:
- Order Entry (oe) スキーマ はそれほど複雑ではない問題の処理に役立ちます。このスキーマでは、非スカラー・データ型を含む多数のデータ型を使用できます。
- Online Catalog (oc) スキーマ は、oeスキーマ内部に作成されたオブジェクト・リレーショナル・データベースのオブジェクトの集合です。
- Product Media (pm) スキーマ は印刷媒体データ型専用です。
![]() |
![]() |
![]() |
![]() |
ということで、GitHubリポジトリから最新のサンプル・スキーマ 23c を Oracle Database 19c へインストールしてみてみます。
■ サンプル・スキーマ ダウンロード
GitHubからサンプル・スキーマをインストールする手順は、次のとおりです。
最新バージョンのサンプル・スキーマのインストール・スクリプトを見つけるため、GitHub Webサイト https://github.com/oracle/db-sample-schemas/releases/latest に移動
今回は最新の Sample Schemas 23c をインストールしてみてみます。
1) サンプル・スキーマ URI コピー
画面にある Source code(zip) のリンクをコピーします。
2) サンプル・スキーマ ダウンロード
直接 wget で Oracle Database Serverへダウンロード
[oracle@basedb19c ~]$ wget https://github.com/oracle-samples/db-sample-schemas/archive/refs/tags/v23.3.zip
--2025-08-12 14:28:36-- https://github.com/oracle-samples/db-sample-schemas/archive/refs/tags/v23.3.zip
Resolving github.com (github.com)... 20.27.177.113
Connecting to github.com (github.com)|20.27.177.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/oracle-samples/db-sample-schemas/zip/refs/tags/v23.3 [following]
--2025-08-12 14:28:36-- https://codeload.github.com/oracle-samples/db-sample-schemas/zip/refs/tags/v23.3
Resolving codeload.github.com (codeload.github.com)... 20.27.177.114
Connecting to codeload.github.com (codeload.github.com)|20.27.177.114|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘v23.3.zip’
v23.3.zip [ <=> ] 11.61M 5.76MB/s in 2.0s
2025-08-12 14:28:39 (5.76 MB/s) - ‘v23.3.zip’ saved [12172258]
2) ファイル解凍
[oracle@basedb19c ~]$ ls -l
total 40112
-rw-r--r-- 1 oracle oinstall 12172258 Aug 12 14:28 v23.3.zip
[oracle@basedb19c ~]$ unzip v23.3.zip
Archive: v23.3.zip
e3325a83e56c516815844025418a96ecaf219751
creating: db-sample-schemas-23.3/
extracting: db-sample-schemas-23.3/.gitignore
inflating: db-sample-schemas-23.3/LICENSE.txt
inflating: db-sample-schemas-23.3/README.md
inflating: db-sample-schemas-23.3/README.txt
・・・
inflating: db-sample-schemas-23.3/sales_history/sh_uninstall.sql
inflating: db-sample-schemas-23.3/sales_history/supplementary_demographics.csv
inflating: db-sample-schemas-23.3/sales_history/times.csv
[oracle@basedb19c ~]$ ls -l
total 40116
drwxr-xr-x 7 oracle oinstall 4096 Mar 28 2024 db-sample-schemas-23.3
-rw-r--r-- 1 oracle oinstall 12172258 Aug 12 14:28 v23.3.zip
3) 解凍ディレクトリ db-sample-schemas-23.3 確認
解凍ディレクトリに サンプル・スキーマのディレクトリがあることを確認できます。
・ customer_orders: COスキーマ
・ human_resources: HRスキーマ
・ order_entry: OEスキーマ
・ product_media: PMスキーマ
・ sales_history: SHスキーマ
[oracle@basedb19c db-sample-schemas-23.3]$ ls -l db-sample-schemas-23.3/
total 36
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 customer_orders
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 human_resources
-rw-r--r-- 1 oracle oinstall 1094 Mar 28 2024 LICENSE.txt
drwxr-xr-x 3 oracle oinstall 4096 Mar 28 2024 order_entry
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 product_media
-rw-r--r-- 1 oracle oinstall 3784 Mar 28 2024 README.md
-rw-r--r-- 1 oracle oinstall 3613 Mar 28 2024 README.txt
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 sales_history
-rw-r--r-- 1 oracle oinstall 1737 Mar 28 2024 SECURITY.md
4) README 読解
ダウンロードしたファイルに READMEがあります。この手順に従って サンプルスキーマをインストールします。
[oracle@basedb19c db-sample-schemas-23.3]$ cat README.txt
・・・
To install the `HR` schema, complete the following steps:
1. `cd` into the `human_resources` folder.
2. Connect to the target database with a privileged user.
3. Run the `hr_install.sql` script and provide inputs for the prompts.
```shell
cd human_resources
sql <system>@<connect_string>
@hr_install.sql
```
・・・
■ HR Schema インストール
HR
schema スクリプトは、human_resources ディレクトリにあります。
そこにある READMEにある手順に従いインストールます。
HRサンプル・スキーマは、人事(Human Resources)部門では、会社の従業員と施設に関する情報を管理しています。Human Resource (hr)レコードには、従業員ごとに識別番号、電子メール・アドレス、職種識別コード、給料および管理者が含まれています。給料に加えて歩合給を受け取る従業員もいます。
また、会社は組織内での職種についての情報も記録しています。各職種には、識別コード、役職、その職種の給料の上限と下限があります。長期間勤務している従業員の中には、複数の役割を担当している人もいます。従業員が退職すると、その従業員が勤務していた期間、職種識別番号および部署が記録されます。
サンプルになっている会社は様々な地域に分かれているため、倉庫および部署の所在地を記録しています。各従業員は、部署に配属されており、また各部署は、一意の部署番号または短縮名のいずれかで識別されます。各部署は、1つの所在地に関連付けられており、またそれぞれの所在地には、通りの名前、郵便番号、都市、州または県、国コードを含む完全な住所があります。
部署および倉庫の所在地には、国名、通貨記号、通貨名、地理的に位置する地域などの詳細を記録します。
● HR Schema README 確認
詳細手順は README に記載あるので確認しときます。
[oracle@basedb19c ~]$ ls -l ~/db-sample-schemas-23.3/
total 36
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 customer_orders
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 human_resources
-rw-r--r-- 1 oracle oinstall 1094 Mar 28 2024 LICENSE.txt
drwxr-xr-x 3 oracle oinstall 4096 Mar 28 2024 order_entry
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 product_media
-rw-r--r-- 1 oracle oinstall 3784 Mar 28 2024 README.md
-rw-r--r-- 1 oracle oinstall 3613 Mar 28 2024 README.txt
drwxr-xr-x 2 oracle oinstall 4096 Mar 28 2024 sales_history
-rw-r--r-- 1 oracle oinstall 1737 Mar 28 2024 SECURITY.md
[oracle@basedb19c db-sample-schemas-23.3]$ cd human_resources
[oracle@basedb19c human_resources]$ ls -l
total 92
-rw-r--r-- 1 oracle oinstall 3849 Mar 28 2024 hr_code.sql
-rw-r--r-- 1 oracle oinstall 17112 Mar 28 2024 hr_create.sql
-rw-r--r-- 1 oracle oinstall 8275 Mar 28 2024 hr_install.sql
-rw-r--r-- 1 oracle oinstall 41301 Mar 28 2024 hr_populate.sql
-rw-r--r-- 1 oracle oinstall 2920 Mar 28 2024 hr_uninstall.sql
-rw-r--r-- 1 oracle oinstall 2642 Mar 28 2024 README.md
-rw-r--r-- 1 oracle oinstall 2666 Mar 28 2024 README.txt
[oracle@basedb19c human_resources]$ cat README.txt
Updated 03-FEB-2022
Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions rem of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
NAME
README.txt - ReadMe text file for HR schema
DESCRIPTION
HR (Human Resources) is a small sample schema resembling an HR department
SCHEMA VERSION
21
RELEASE DATE
03-FEB-2022
SUPPORTED with DB VERSIONS
19c and higher
MAJOR CHANGES IN THIS RELEASE
1. all date data is updated
2. updated phone numbers in US for globalization
3. regions are updated
4. countries are updated: replaced UK United Kingdom with GB
United Kingdom of Great Britain and Northern Ireland
5. country_name column changed from varchar2(40) to varchar2(60)
SCHEMA DEPENDENCIES AND REQUIREMENTS
Required access to hr_install.sql, hr_create.sql, hr_populate.sql, hr_code.sql
INSTALL INSTRUCTIONS
1. Run as privileged user with rights to create another user
(SYSTEM, ADMIN, etc.)
2. Run the hr_install.sql script to create the HR (human resources) schema
3. You are prompted for:
a. password - enter an Oracle Database compliant password
b. tablespace - if you do not enter a tablespace, the default
database tablespace is used
Note: If the HR schema already exists, it is removed/dropped and
a fresh HR schema is installed
UNINSTALL INSTRUCTIONS
1. Run as privileged user with rights to create another user
(SYSTEM, ADMIN, etc.)
2. Run the hr_uninstall.sql script to remove the HR (human resources) schema
NOTES
Scripts need to be run as a privileged user with rights to create
another user (SYSTEM, ADMIN, etc.)
--------------------------------------------------------------------------
● HR Schema インストール
1) Databasaeへログイン
SQLcl や SQL*Plus などのクライアントプログラムから、他のユーザーを作成および削除する権限を持つ特権ユーザーとしてデータベースに接続します。たとえば、SYSTEM または ADMIN として接続します。
[oracle@basedb19c human_resources]$ sql system/password@PDB
SQLcl: Release 21.4 Production on Tue Aug 12 14:42:10 2025
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Last Successful login time: Tue Aug 12 2025 14:42:11 +00:00
Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
SQL>
2) hr_install.sql 実行
*_install.sqlインストールスクリプトを実行します。この場合は、 hr_install.sql を実行して HRスキーマを作成します
hr_install.sql を実行すると プロンプトで求められる 次の情報を入力して進めていきます。
・スキーマの安全なパスワードを入力します。
・スキーマのデフォルトとして使用する表領域を入力します。表領域を入力しない場合は、デフォルトのデータベース表領域が使用されます。
・既存のスキーマを上書きするかどうかを指定するには、 yesまたは noと入力します。デフォルトの回答は yesです。
SQL> host ls
hr_code.sql hr_create.sql hr_install.log hr_install.sql hr_populate.sql hr_uninstall.sql README.md README.txt
SQL> @hr_install.sql
Thank you for installing the Oracle Human Resources 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 'hr_install.log' log file.
Enter a password for the user HR: ********
Enter a tablespace for HR [USERS]:
Do you want to overwrite the schema, if it already exists? [YES|no]: YES
Old HR schema has been dropped.
****** Creating REGIONS table ....
Table REGIONS created.
INDEX REG_ID_PK created.
Table REGIONS altered.
****** Creating COUNTRIES table ....
Table COUNTRIES created.
Table COUNTRIES altered.
****** Creating LOCATIONS table ....
Table LOCATIONS created.
INDEX LOC_ID_PK created.
Table LOCATIONS altered.
Sequence LOCATIONS_SEQ created.
****** Creating DEPARTMENTS table ....
Table DEPARTMENTS created.
INDEX DEPT_ID_PK created.
Table DEPARTMENTS altered.
Sequence DEPARTMENTS_SEQ created.
****** Creating JOBS table ....
Table JOBS created.
INDEX JOB_ID_PK created.
Table JOBS altered.
****** Creating EMPLOYEES table ....
Table EMPLOYEES created.
INDEX EMP_EMP_ID_PK created.
Table EMPLOYEES altered.
Table DEPARTMENTS altered.
Sequence EMPLOYEES_SEQ created.
****** Creating JOB_HISTORY table ....
Table JOB_HISTORY created.
INDEX JHIST_EMP_ID_ST_DATE_PK created.
Table JOB_HISTORY altered.
****** Creating EMP_DETAILS_VIEW view ...
View EMP_DETAILS_VIEW created.
****** Creating indexes ...
Index EMP_DEPARTMENT_IX created.
Index EMP_JOB_IX created.
Index EMP_MANAGER_IX created.
Index EMP_NAME_IX created.
Index DEPT_LOCATION_IX created.
Index JHIST_JOB_IX created.
Index JHIST_EMPLOYEE_IX created.
Index JHIST_DEPARTMENT_IX created.
Index LOC_CITY_IX created.
Index LOC_STATE_PROVINCE_IX created.
Index LOC_COUNTRY_IX created.
****** Adding table column comments ...
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Session altered.
****** Populating REGIONS table ....
PL/SQL procedure successfully completed.
****** Populating COUNTRIES table ....
PL/SQL procedure successfully completed.
****** Populating LOCATIONS table ....
PL/SQL procedure successfully completed.
****** Populating DEPARTMENTS table ....
Table DEPARTMENTS altered.
PL/SQL procedure successfully completed.
****** Populating JOBS table ....
PL/SQL procedure successfully completed.
****** Populating EMPLOYEES table ....
PL/SQL procedure successfully completed.
****** Populating JOB_HISTORY table ....
PL/SQL procedure successfully completed.
Commit complete.
Table DEPARTMENTS altered.
Procedure SECURE_DML compiled
Trigger SECURE_EMPLOYEES compiled
Trigger SECURE_EMPLOYEES altered.
Procedure ADD_JOB_HISTORY compiled
Trigger UPDATE_JOB_HISTORY compiled
Commit complete.
Installation verification
____________________________
Verification:
Table provided actual
______________ ___________ _________
regions 5 5
countries 25 25
departments 27 27
locations 23 23
employees 107 107
jobs 19 19
job_history 10 10
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 EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
■ OE Schema インストール
この会社は、コンピュータのハードウェアとソフトウェア、音楽、衣料、工具などいくつかの製品を販売しています。会社は、製品識別番号、その製品の分類、受注(OE)、重量によるグループ(出荷のため)、ある場合は保証期間、サプライヤ、製品の可用性ステータス、表示価格、最低販売価格、製造会社のURLアドレスを含む、これらの製品に関する情報を管理しています。また、在庫がある倉庫、在庫数などすべての製品に対する在庫情報も記録されます。世界中で製品が販売されているため、この会社は複数の言語で製品名と製品についての説明書を管理しています。
会社は、顧客の要望に応えるために、いくつかの場所に倉庫を設置しています。各倉庫には、倉庫識別番号、倉庫名、施設の説明および地域識別番号があります。
また、顧客情報も記録されています。各顧客には、識別番号があります。顧客レコードには、顧客の名前、町名、都市または県、国、電話番号(顧客ごとに最大5つまで)および郵便番号があります。インターネット経由で注文する顧客もいるため、電子メール・アドレスも記録されています。顧客は様々な言語を使用しているため、会社は顧客ごとに使用するネイティブ言語と地域を記録します。
また、顧客には一度に購入できる製品の総額を制限する与信限度額が設定されています。顧客管理者が任命されている顧客の場合は、この情報も記録されます。
顧客が発注すると、会社は受注日、受注方法、受注状況、出荷モード、受注数量および営業担当者を記録します。営業担当者は、顧客の顧客管理者と同一人物とはかぎりません。インターネット経由で受注した場合、営業担当者は記録されません。受注情報の他にも、受注した品目の数量、単価および製品も記録します。
スキーマOEには、XMLの注文書も含まれます。これらは、登録済のXMLスキーマpurchaseorder.xsdに対する検証後にOracle XML DB Repositoryに格納されます。これらのドキュメントには、SQLを使用した表purchaseorderの問合せ、パブリック・ビューRESOURCE_VIEWおよびPATH_VIEWの問合せ、XPath式を使用したリポジトリの問合せなど、様々な方法でアクセスできます。
XMLの注文書は、Oracle XML DB Repositoryフォルダ$ORACLE_HOME/rdbms/demo/order_entry/2002/monthに格納されます。ここで、monthとは3文字の月を表す略称(Jan、Feb、Marなど)です。
● OE Schema README 確認
詳細手順は README に記載あるので確認しときます。
手順を確認すると少々手間がかかります。
[oracle@basedb19c ~]$ cat db-sample-schemas-23.3/order_entry/README.md
# Order Entry Sample Schema (ARCHIVED!)
---
Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions rem of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
---
## DESCRIPTON
Order Entry (`OE`) is a sample schema modeling a company's order system.
### SCHEMA VERSION
**ARCHIVED!**
This schema is archived and no longer maintained.
### RELEASE DATE
08-APR-2021
### SUPPORTED with DB VERSIONS
19c and lower
## INSTALL INSTRUCTIONS
1. Run `perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat` in this folder
2. Connect as privileged user with rights to create another user (`SYSTEM`, `ADMIN`, etc.)
3. Run the `oe_main.sql` script passing on the following parameters:
1. `OE` schema name password
2. The tablespace name where to install the schema into
3. The temporary tablespace name for the `OE` user
4. The password of the `HR` user
5. The `SYS` password
6. The full path of this parent directory
7. The full path of a directory where to write the install log file to
8. The version number `3`
9. The connect string for the database you connected to
**Note:** If the `OE` schema already exists, it is removed/dropped and
a fresh `OE` schema is installed.
## UNINSTALL INSTRUCTIONS
1. Run as privileged user with rights to drop another user (`SYSTEM`, `ADMIN`, etc.)
2. Run `DROP USER oe CASCADE;`
## NOTES
This schema is archived and no longer maintained.
● OE Schema インストール
READMEに従い実行していきます。
1) Sample suchema 親ディレクトリ移動
OE Schema のある order_entry ディレクトリの1つ手前に移動
[oracle@basedb19c ~]$ cd db-sample-schemas-23.3/
[oracle@basedb19c db-sample-schemas-23.3]$ ls
customer_orders human_resources LICENSE.txt order_entry product_media README.md README.txt sales_history SECURITY.md
[oracle@basedb19c db-sample-schemas-23.3]$ pwd
/home/oracle/db-sample-schemas-23.3
2) perl スクリプト実行
この perlスクリップトで oe_main.sql スクリプトにあるファイルパスを今いる親ディレクトリ・パスへ変換します。
[oracle@basedb19c db-sample-schemas-23.3]$ perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat
Can't open *.sql: No such file or directory.
3) order_entry ディレクトリへ移動
[oracle@basedb19c ~]$ cd db-sample-schemas-23.3/order_entry/
[oracle@basedb19c order_entry]$ ls
2002 createFolders.sql.bak oc_popul.sql oe_p_dk.sql.bak oe_p_ja.sql oe_p_ru.sql.bak poe_v3.sql
bi_oe_oi.ctl createResources.sql oc_popul.sql.bak oe_p_d.sql oe_p_ja.sql.bak oe_p_sf.sql poe_v3.sql.bak
bi_oe_oi.dat createResources.sql.bak oe_analz.sql oe_p_d.sql.bak oe_p_ko.sql oe_p_sf.sql.bak POList.json
bi_oe_oi.dat.bak createUser.sql oe_analz.sql.bak oe_p_el.sql oe_p_ko.sql.bak oe_p_sk.sql pord_v3.sql
bi_oe_or.ctl createUser.sql.bak oe_comnt.sql oe_p_el.sql.bak oe_p_nl.sql oe_p_sk.sql.bak pord_v3.sql.bak
bi_oe_or.dat cwhs_v3.sql oe_comnt.sql.bak oe_p_esa.sql oe_p_nl.sql.bak oe_p_s.sql PurchaseOrders.dmp
bi_oe_or.dat.bak cwhs_v3.sql.bak oe_cre.sql oe_p_esa.sql.bak oe_p_n.sql oe_p_s.sql.bak purchaseOrder.xml
bi_oe_pi.ctl doe_v3.sql oe_cre.sql.bak oe_p_e.sql oe_p_n.sql.bak oe_p_th.sql purchaseOrder.xsd
bi_oe_pi.dat doe_v3.sql.bak oe_drop.sql oe_p_e.sql.bak oe_p_ord.sql oe_p_th.sql.bak purchaseOrder.xsl
bi_oe_pi.dat.bak doe_xml.sql oe_drop.sql.bak oe_p_frc.sql oe_p_ord.sql.bak oe_p_tr.sql pwhs_v3.sql
ccus_v3.sql doe_xml.sql.bak oe_idx.sql oe_p_frc.sql.bak oe_p_pd.sql oe_p_tr.sql.bak pwhs_v3.sql.bak
ccus_v3.sql.bak empdept.xsl oe_idx.sql.bak oe_p_f.sql oe_p_pd.sql.bak oe_p_us.sql README.md
cidx_v3.sql filelist.xml oe_main.sql oe_p_f.sql.bak oe_p_pi.sql oe_p_us.sql.bak xdb03usg.sql
cidx_v3.sql.bak loe_v3.sql oe_main.sql.bak oe_p_hu.sql oe_p_pi.sql.bak oe_p_whs.sql xdb03usg.sql.bak
cmnt_v3.sql loe_v3.sql.bak oe_p_ar.sql oe_p_hu.sql.bak oe_p_pl.sql oe_p_whs.sql.bak xdbConfiguration.sql
cmnt_v3.sql.bak oc_comnt.sql oe_p_ar.sql.bak oe_p_inv.sql oe_p_pl.sql.bak oe_p_zhs.sql xdbConfiguration.sql.bak
coe_v3.sql oc_comnt.sql.bak oe_p_ca.sql oe_p_inv.sql.bak oe_p_ptb.sql oe_p_zhs.sql.bak xdbSupport.sql
coe_v3.sql.bak oc_cre.sql oe_p_ca.sql.bak oe_p_i.sql oe_p_ptb.sql.bak oe_p_zht.sql xdbSupport.sql.bak
coe_xml.sql oc_cre.sql.bak oe_p_cs.sql oe_p_i.sql.bak oe_p_pt.sql oe_p_zht.sql.bak xdbUtilities.sql
coe_xml.sql.bak oc_drop.sql oe_p_cs.sql.bak oe_p_itm.sql oe_p_pt.sql.bak oe_views.sql xdbUtilities.sql.bak
cord_v3.sql oc_drop.sql.bak oe_p_cus.sql oe_p_itm.sql.bak oe_p_ro.sql oe_views.sql.bak
cord_v3.sql.bak oc_main.sql oe_p_cus.sql.bak oe_p_iw.sql oe_p_ro.sql.bak pcus_v3.sql
createFolders.sql oc_main.sql.bak oe_p_dk.sql oe_p_iw.sql.bak oe_p_ru.sql pcus_v3.sql.bak
4) Database接続
OEスキーマをインストールする Database へ接続
[oracle@basedb19c order_entry]$ sql system/password#@PDB
QLcl: Release 21.4 Production on Wed Aug 13 03:42:00 2025
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Last Successful login time: Wed Aug 13 2025 03:42:00 +00:00
Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
SQL>
5) oe_main.sql実行
READMEにあるように次の情報を入力してスクリプト実行していきます。
Enter value for 1: OEスキーマの Password を入力
Enter value for 2: OEスキーマの デフォルト表領域を入力
Enter value for 3: OEスキーマの デフォルト一時表領域を入力
Enter value for 4: HRスキーマの Password を入力
Enter value for 6: order_entry ディレクトリの FUll Path を入力
Enter value for 7: 出力ログの FUll Path を入力
Enter value for 8: v3 を入力
Enter value for 9: インストールDatabaseの接続記述子を入力(EZ CONNECT)でも可能
SQL> @oe_main.sql
specify password for OE as parameter 1:
Enter value for 1: Password
specify default tablespeace for OE as parameter 2:
Enter value for 2: USERS
specify temporary tablespace for OE as parameter 3:
Enter value for 3: TEMP
specify password for HR as parameter 4:
Enter value for 4: Password
specify password for SYS as parameter 5:
Enter value for 5: Password
specify directory path for the data files as parameter 6:
Enter value for 6: /home/oracle/db-sample-schemas-23.3/order_entry
writeable directory path for the log files as parameter 7:
Enter value for 7: /home/oracle
specify version as parameter 8:
Enter value for 8: v3
specify connect string as parameter 9:
Enter value for 9: PDB
SP2-0556: Invalid file name.
User OE dropped.
old:CREATE USER oe IDENTIFIED BY &pass
new:CREATE USER oe IDENTIFIED BY Password
User OE created.
old:ALTER USER oe DEFAULT TABLESPACE &tbs QUOTA UNLIMITED ON &tbs
new:ALTER USER oe DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS
User OE altered.
old:ALTER USER oe TEMPORARY TABLESPACE &ttbs
new:ALTER USER oe TEMPORARY TABLESPACE TEMP
User OE altered.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Grant succeeded.
Connected.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Session altered.
Session altered.
specify Sample Schema version as parameter 1:
specify password for OE as parameter 2:
PROMPT password for SYS as parameter 3:
specify connect string as parameter 4:
Type CUST_ADDRESS_TYP compiled
Type PHONE_LIST_TYP compiled
Table CUSTOMERS created.
INDEX CUSTOMERS_PK created.
Table CUSTOMERS altered.
Table WAREHOUSES created.
INDEX WAREHOUSES_PK created.
Table WAREHOUSES altered.
Table ORDER_ITEMS created.
INDEX ORDER_ITEMS_PK created.
INDEX ORDER_ITEMS_UK created.
Table ORDER_ITEMS altered.
Trigger INSERT_ORD_LINE compiled
Table ORDERS created.
INDEX ORDER_PK created.
Table ORDERS altered.
Table INVENTORIES created.
Index INVENTORY_IX created.
Table INVENTORIES altered.
Table PRODUCT_INFORMATION created.
Table PRODUCT_INFORMATION altered.
Table PRODUCT_DESCRIPTIONS created.
INDEX PRD_DESC_PK created.
Table PRODUCT_DESCRIPTIONS altered.
Table PROMOTIONS created.
Table PROMOTIONS altered.
Table ORDERS altered.
Table ORDERS altered.
Table WAREHOUSES altered.
Table CUSTOMERS altered.
Table INVENTORIES altered.
Table INVENTORIES altered.
Table ORDER_ITEMS altered.
Table ORDER_ITEMS altered.
Table PRODUCT_DESCRIPTIONS altered.
Synonym COUNTRIES created.
Synonym LOCATIONS created.
Synonym DEPARTMENTS created.
Synonym JOBS created.
Synonym EMPLOYEES created.
Synonym JOB_HISTORY created.
Sequence ORDERS_SEQ created.
specify password for OE as parameter 1:
PROMPT password for SYS as parameter 2:
specify connect string as parameter 3:
Connected.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
View DATABASE_SUMMARY created.
View DATABASE_SUMMARY created.
Grant succeeded.
Session altered.
Package COE_CONFIGURATION compiled
Package Body COE_CONFIGURATION compiled
LINE/COL ERROR
--------- -------------------------------------------------------------
89/4 PL/SQL: SQL Statement ignored
91/11 PL/SQL: ORA-00942: table or view does not exist
Errors: check compiler log
View DATABASE_SUMMARY created.
Package COE_CONFIGURATION altered.
View DATABASE_SUMMARY altered.
Grant succeeded.
Trigger NO_DML_OPERATIONS_ALLOWED compiled
SYNONYM COE_CONFIGURATION created.
Grant succeeded.
Call completed.
Session altered.
Session altered.
Package COE_NAMESPACES compiled
no rows selected
SYNONYM COE_NAMESPACES created.
Grant succeeded.
Package COE_DOM_HELPER compiled
no rows selected
Package Body COE_DOM_HELPER compiled
no rows selected
SYNONYM COE_DOM_HELPER created.
Grant succeeded.
Package COE_UTILITIES compiled
no rows selected
Package Body COE_UTILITIES compiled
no rows selected
Grant succeeded.
SYNONYM COE_UTILITIES created.
Package COE_TOOLS compiled
no rows selected
Package Body COE_TOOLS compiled
no rows selected
SYNONYM COE_TOOLS created.
Grant succeeded.
specify password for OE as parameter 1:
PROMPT password for SYS as parameter 2:
specify connect string as parameter 3:
PL/SQL procedure successfully completed.
Connected.
Error starting at line : 81 File @ /home/oracle/db-sample-schemas-23.3/order_entry/createUser.sql
In command -
DROP DIRECTORY SS_OE_XMLDIR
Error report -
ORA-04043: object SS_OE_XMLDIR does not exist
04043. 00000 - "object %s does not exist"
*Cause: An object name was specified that was not recognized by the system.
There are several possible causes:
- An invalid name for a table, view, sequence, procedure, function,
package, or package body was entered. Since the system could not
recognize the invalid name, it responded with the message that the
named object does not exist.
- An attempt was made to rename an index or a cluster, or some
other object that cannot be renamed.
*Action: Check the spelling of the named object and rerun the code. (Valid
names of tables, views, functions, etc. can be listed by querying
the data dictionary.)
Directory SS_OE_XMLDIR created.
Commit complete.
Connected.
Revoke succeeded.
Connected.
Connected.
Session altered.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Call completed.
Call completed.
PL/SQL procedure successfully completed.
Connected.
Revoke succeeded.
Connected.
Connected.
Revoke succeeded.
Revoke succeeded.
Revoke succeeded.
Package XDB.COE_CONFIGURATION dropped.
Package XDB.COE_NAMESPACES dropped.
Package XDB.COE_DOM_HELPER dropped.
Package XDB.COE_UTILITIES dropped.
Package XDB.COE_TOOLS dropped.
Trigger XDB.NO_DML_OPERATIONS_ALLOWED dropped.
View XDB.DATABASE_SUMMARY dropped.
Connected.
Commit complete.
specify Sample Schema version as parameter 1:
specify location for data and control files as parameter 2:
specify location for log files as parameter 3:
specify password for oe as parameter 4:
Setting FEEDBACK OFF for inserts
Setting FEEDBACK ON
1 row inserted.
1 row inserted.
Commit complete.
Table CUSTOMERS altered.
Session altered.
Session altered.
Commit complete.
View PRODUCTS created.
View SYDNEY_INVENTORY created.
View BOMBAY_INVENTORY created.
View TORONTO_INVENTORY created.
View PRODUCT_PRICES created.
View ACCOUNT_MANAGERS created.
Function GET_PHONE_NUMBER_F compiled
View CUSTOMERS_VIEW created.
View ORDERS_VIEW created.
Comment created.
Comment created.
Comment created.
Error starting at line : 48 File @ /home/oracle/db-sample-schemas-23.3/order_entry/cmnt_v3.sql
In command -
.
Error report -
Unknown Command
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Index WHS_LOCATION_IX created.
Index INV_PRODUCT_IX created.
Index ITEM_ORDER_IX created.
Index ITEM_PRODUCT_IX created.
Index ORD_SALES_REP_IX created.
Index ORD_CUSTOMER_IX created.
Index ORD_ORDER_DATE_IX created.
Index CUST_ACCOUNT_MANAGER_IX created.
Index CUST_LNAME_IX created.
Index CUST_EMAIL_IX created.
Index PROD_NAME_IX created.
Index PROD_SUPPLIER_IX created.
Index CUST_UPPER_NAME_IX created.
Session altered.
...creating subschema OC in OE
Type WAREHOUSE_TYP compiled
Type INVENTORY_TYP compiled
Type INVENTORY_LIST_TYP compiled
Type PRODUCT_INFORMATION_TYP compiled
Type ORDER_ITEM_TYP compiled
Type ORDER_ITEM_LIST_TYP compiled
Type CUSTOMER_TYP compiled
Type ORDER_TYP compiled
Type ORDER_LIST_TYP compiled
Type CUSTOMER_TYP compiled
Type CATEGORY_TYP compiled
Type SUBCATEGORY_REF_LIST_TYP compiled
Type PRODUCT_REF_LIST_TYP compiled
Type CORPORATE_CUSTOMER_TYP compiled
Type LEAF_CATEGORY_TYP compiled
Type Body LEAF_CATEGORY_TYP compiled
Type COMPOSITE_CATEGORY_TYP compiled
Type Body COMPOSITE_CATEGORY_TYP compiled
Type CATALOG_TYP compiled
Type Body CATALOG_TYP compiled
Table CATEGORIES_TAB created.
View OC_INVENTORIES created.
View OC_PRODUCT_INFORMATION created.
View OC_CUSTOMERS created.
View OC_CUSTOMERS created.
View OC_CORPORATE_CUSTOMERS created.
View OC_ORDERS created.
Trigger ORDERS_TRG compiled
Trigger ORDERS_ITEMS_TRG compiled
Commit complete.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
1 row inserted.
Type CATEGORY_TYP altered.
3 rows updated.
8 rows updated.
6 rows updated.
4 rows updated.
Commit complete.
Type CATALOG_TYP altered.
Type COMPOSITE_CATEGORY_TYP altered.
Type LEAF_CATEGORY_TYP altered.
PL/SQL procedure successfully completed.
Connected.
SYNONYM COE_CONFIGURATION created.
SYNONYM COE_NAMESPACES created.
SYNONYM COE_DOM_HELPER created.
SYNONYM COE_UTILITIES created.
SYNONYM COE_TOOLS created.
not spooling currently
SQL>
■ CO Schema インストール
CO schema スクリプトは、customer_orders ディレクトリにあります。
そこにある READMEにある手順に従いインストールます。
COサンプル・スキーマは、顧客オーダー(Customer Orders)部門は、顧客、製品、店舗および注文のデータを追跡します。Customer Orders (co)スキーマは、小売アプリケーションで行われたトランザクションの詳細を記録します。
coスキーマでは、JSONサポートなどの機能が強調されています。
この会社では、products表に保持される様々な製品を販売しています。各製品には、一意の識別番号、名前、価格、JSONオブジェクトに格納される詳細、および製品イメージの詳細があります。
顧客が発注した注文は、注文識別番号、注文が発注された日時、顧客の詳細、注文ステータスおよび店舗情報を使用してorders表で追跡されます。
特定の注文の製品の詳細は、注文識別番号を使用してorder_items表でも追跡されます。製品の詳細、購入時の価格、数量および出荷が記録されます。
注文した顧客の情報はcustomers表で追跡されます。各顧客には、注文のやり取りに使用される識別番号、名前および電子メール・アドレスがあります。
顧客は、店舗で製品を購入するか、会社のWebサイトを介してオンラインで購入できます。すべての店舗の情報と、それらに対応する物理的アドレスおよび仮想アドレスはstores表で追跡されます。店舗情報は注文詳細にも記録されます。
搬送先住所、顧客詳細、店舗情報、出荷ステータスなど注文の出荷詳細は、shipments表に格納されます。
inventory表には、各店舗で使用可能な数量など、各製品の詳細が格納されます。
● CO Schema README 確認
詳細手順は README に記載あるので確認しときます。
[oracle@basedb19c ~]$ ls -l db-sample-schemas-23.3/customer_orders/
total 1288
-rw-r--r-- 1 oracle oinstall 19570 Mar 28 2024 co_create.sql
-rw-r--r-- 1 oracle oinstall 8141 Mar 28 2024 co_install.sql
-rw-r--r-- 1 oracle oinstall 1274129 Mar 28 2024 co_populate.sql
-rw-r--r-- 1 oracle oinstall 2917 Mar 28 2024 co_uninstall.sql
-rw-r--r-- 1 oracle oinstall 2384 Mar 28 2024 README.md
-rw-r--r-- 1 oracle oinstall 2467 Mar 28 2024 README.txt
[oracle@basedb19c ~]$ cat db-sample-schemas-23.3/customer_orders/README.txt
Created 18-JUL-2019
Updated 08-FEB-2022
Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions rem of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
NAME
README.txt - ReadMe text file for CO schema
DESCRIPTION
CO (Customer Orders) is a sample schema resembling a generic customer orders management schema.
SCHEMA VERSION
21
RELEASE DATE
08-FEB-2022
SUPPORTED with DB VERSIONS
19c and higher
MAJOR CHANGES IN THIS RELEASE
1. simplified installation
2. all date data is updated
SCHEMA DEPENDENCIES AND REQUIREMENTS
Required access to cp_install.sql, co_create.sql, co_populate.sql
INSTALL INSTRUCTIONS
1. Run as privileged user with rights to create another user
(SYSTEM, ADMIN, etc.)
2. Run the co_install.sql script to create the CO (Customer Orders) schema
3. You are prompted for:
a. password - enter an Oracle Database compliant password
b. tablespace - if you do not enter a tablespace, the default
database tablespace is used
Note: If the CO schema already exists, it is removed/dropped and
a fresh CO schema is installed
UNINSTALL INSTRUCTIONS
1. Run as privileged user with rights to create another user
(SYSTEM, ADMIN, etc.)
2. Run the co_uninstall.sql script to remove the CO (Customer Orders) schema
NOTES
Scripts need to be run as a privileged user with rights to create
another user (SYSTEM, ADMIN, etc.)
--------------------------------------------------------------------------
● CO Schema インストール
*_install.sqlインストールスクリプトを実行します。この場合は、 co_install.sql を実行して HRスキーマを作成します
co_install.sql を実行すると プロンプトで求められる 次の情報を入力して進めていきます。
・スキーマの安全なパスワードを入力します。
・スキーマのデフォルトとして使用する表領域を入力します。表領域を入力しない場合は、デフォルトのデータベース表領域が使用されます。
・既存のスキーマを上書きするかどうかを指定するには、 yesまたは noと入力します。デフォルトの回答は yesです。
1) Databasaeへログイン
SQLcl や SQL*Plus などのクライアントプログラムから、他のユーザーを作成および削除する権限を持つ特権ユーザーとしてデータベースに接続します。たとえば、SYSTEM または ADMIN として接続します。
[oracle@basedb19c human_resources]$ sql system/password@PDB
SQLcl: Release 21.4 Production on Tue Aug 12 14:42:10 2025
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Last Successful login time: Tue Aug 12 2025 14:42:11 +00:00
Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
SQL>
2) co_install.sql 実行
SQL> host ls db-sample-schemas-23.3/customer_orders/
co_create.sql co_install.sql co_populate.sql co_uninstall.sql README.md README.txt
SQL> @db-sample-schemas-23.3/customer_orders/co_install.sql
Thank you for installing the Oracle Customer Orders 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 'co_install.log' log file.
Enter a password for the user CO: ********
Enter a tablespace for CO [USERS]:
Do you want to overwrite the schema, if it already exists? [YES|no]: YES
****** Creating CUSTOMERS table ....
Table CUSTOMERS created.
****** Creating STORES table ....
Table STORES created.
****** Creating PRODUCTS table ....
Table PRODUCTS created.
****** Creating ORDERS table ....
Table ORDERS created.
****** Creating SHIPMENTS table ....
Table SHIPMENTS created.
****** Creating ORDER_ITEMS table ....
Table ORDER_ITEMS created.
****** Creating INVENTORY table ....
Table INVENTORY created.
****** Create views
View CUSTOMER_ORDER_PRODUCTS created.
View STORE_ORDERS created.
View PRODUCT_REVIEWS created.
View PRODUCT_ORDERS created.
****** Creating indexes ...
Index CUSTOMERS_NAME_I created.
Index ORDERS_CUSTOMER_ID_I created.
Index ORDERS_STORE_ID_I created.
Index SHIPMENTS_STORE_ID_I created.
Index SHIPMENTS_CUSTOMER_ID_I created.
Index ORDER_ITEMS_SHIPMENT_ID_I created.
Index INVENTORY_PRODUCT_ID_I created.
****** Adding constraints to tables ...
Table CUSTOMERS altered.
Table CUSTOMERS altered.
Table STORES altered.
Table STORES altered.
Table STORES altered.
Table PRODUCTS altered.
Table PRODUCTS altered.
Table ORDERS altered.
Table ORDERS altered.
Table ORDERS altered.
Table ORDERS altered.
Table SHIPMENTS altered.
Table SHIPMENTS altered.
Table SHIPMENTS altered.
Table SHIPMENTS altered.
Table ORDER_ITEMS altered.
Table ORDER_ITEMS altered.
Table ORDER_ITEMS altered.
Table ORDER_ITEMS altered.
Table ORDER_ITEMS altered.
Table INVENTORY altered.
Table INVENTORY altered.
Table INVENTORY altered.
Table INVENTORY altered.
****** Adding table column comments ...
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Session altered.
****** Populating CUSTOMERS table ....
PL/SQL procedure successfully completed.
****** Populating PRODUCTS table ....
PL/SQL procedure successfully completed.
****** Populating STORES table ....
PL/SQL procedure successfully completed.
****** Populating ORDERS table ....
PL/SQL procedure successfully completed.
****** Populating SHIPMENTS table ....
PL/SQL procedure successfully completed.
****** Populating ORDER_ITEMS table ....
PL/SQL procedure successfully completed.
****** Populating INVENTORY table ....
PL/SQL procedure successfully completed.
Commit complete.
****** Resetting values for IDENTITY columns ....
Table PRODUCTS altered.
Table STORES altered.
Table CUSTOMERS altered.
Table ORDERS altered.
Table SHIPMENTS altered.
Table INVENTORY altered.
Installation verification
____________________________
Verification:
Table provided actual
______________ ___________ _________
customers 392 392
stores 23 23
products 46 46
orders 1950 1950
shipments 1892 1892
order_items 3914 3914
inventory 566 566
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 EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
残りのサンプル・スキーマも同様にインストールできます。
shスキーマをインストールするには、SQLclまたはSQL Developerを使用する必要があります。
SQLcl を使用してデータベースに接続する方法の詳細については、「データベースへの接続」を参照してください。
■ SH Schema インストール
サンプルの会社では、大規模な事業を行っているため、意思決定支援のために事業統計レポートを作成します。これらのレポートの多くは、時間ベースで作成され蓄積されます。つまり、過去のデータ傾向を分析できます。データをデータ・ウェアハウスにロードして、これらのレポート用の統計を定期的に収集します。これらのレポートでは、年、四半期、月、週ごとの売上げが製品別に表示されます。これらのレポートは、スキーマSales History (SH)を使用して格納されます。
また、販売が行われる流通チャネルのレポートも出力します。製品に対して特別な販売促進を実施する場合は、販売促進の効果を分析できます。地域によって販売を分析することもできます。
● SH Schema README 確認
詳細手順は README に記載あるので確認しときます。
[oracle@basedb19c db-sample-schemas-23.3]$ cd db-sample-schemas-23.3/sales_history/
[oracle@basedb19c sales_history]$ ls
costs.csv promotions.csv sales.csv sh_create.sql.bak sh_install.sql.bak sh_populate.sql.bak sh_uninstall.sql.bak times.csv
customers.csv README.md sh_create.sql sh_install.sql sh_populate.sql sh_uninstall.sql supplementary_demographics.csv
[oracle@basedb19c sales_history]$ cat README.md
# Sales History Sample Schema
---
Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions rem of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
---
## Description
Sales History `(SH)` schema models a company's sales transactions and reports.
### Schema Version
21.1
### Release Date
06-DEC-2022
### Supported with Database Versions
19c and higher
### Major Changes in this Release
1. All DATE data is updated
2. New install mechanism
### Schema Dependencies and Requirements
- **Requires [SQLcl](https://oracle.com/sqlcl) command prompt!**
- Required access to `sh_install.sql`, `sh_create.sql`, `sh_populate.sql`
## Install Instruction
1. Connect as privileged user with rights to create another user (`SYSTEM`, `ADMIN`, etc.)
2. Run the `sh_install.sql` script to create the `SH` (Sales History) schema
3. You are prompted for:
1. `password` - enter an Oracle Database compliant password
2. `tablespace` - if you do not enter a tablespace, the default database tablespace is used
**Note:** If the `SH` schema already exists, it is removed/dropped and
a fresh `SH` schema is installed
## Uninstall Instructions
1. Connect as privileged user with rights to create another user (`SYSTEM`, `ADMIN`, etc.)
2. Run the `SH_uninstall.sql ` script to remove the `SH` (Sales History) schema
## Notes
Scripts need to be run as a privileged user with rights to create and drop another user (`SYSTEM`, `ADMIN`, etc.).
● SH Schema インストール
1) Databasaeへログイン
[oracle@basedb19c sales_history]$ sql system/Password@PDB
SQLcl: Release 21.4 Production on Wed Aug 13 04:35:48 2025
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Last Successful login time: Wed Aug 13 2025 04:35:48 +00:00
Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
SQL>
2) sh_install.sql 実行
sh_install.sql を実行すると プロンプトで求められる 次の情報を入力して進めていきます。
・スキーマの安全なパスワードを入力します。
・スキーマのデフォルトとして使用する表領域を入力します。表領域を入力しない場合は、デフォルトのデータベース表領域が使用されます。
・既存のスキーマを上書きするかどうかを指定するには、 yesまたは noと入力します。デフォルトの回答は yesです。
SQL> host ls
costs.csv promotions.csv sales.csv sh_create.sql.bak sh_install.sql.bak sh_populate.sql.bak sh_uninstall.sql.bak times.csv
customers.csv README.md sh_create.sql sh_install.sql sh_populate.sql sh_uninstall.sql supplementary_demographics.csv
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]:
Do you want to overwrite the schema, if it already exists? [YES|no]: YES
Start time: 13-AUG-25 04.36.12.247667 AM +00:00
****** Creating COUNTRIES table ....
Table COUNTRIES created.
****** Creating CUSTOMERS table ....
Table CUSTOMERS created.
****** Creating PROMOTIONS table ....
Table PROMOTIONS created.
****** Creating PRODUCTS table ....
Table PRODUCTS created.
****** Creating TIMES table ....
Table TIMES created.
****** Creating CHANNELS table ....
Table CHANNELS created.
****** Creating SALES table ....
Table SALES created.
****** Creating COSTS table ....
Table COSTS created.
****** Creating SUPPLEMENTAL_DEMOGRAPHICS table ....
Table SUPPLEMENTARY_DEMOGRAPHICS created.
****** Creating views ....
View PROFITS created.
****** Creating materialized views ....
Materialized view CAL_MONTH_SALES_MV created.
Materialized view FWEEK_PSCAT_SALES_MV created.
****** Adding comments to tables...
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Comment created.
Session altered.
****** Disabling table constraints for the load
Table SALES altered.
Table SALES altered.
Table SALES altered.
Table SALES altered.
Table SALES altered.
Table CUSTOMERS altered.
Table COSTS altered.
Table COSTS altered.
Table COSTS altered.
Table COSTS altered.
Table TIMES altered.
Table CHANNELS altered.
Table COUNTRIES altered.
Table PROMOTIONS altered.
Table PRODUCTS altered.
Table CUSTOMERS 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.
****** Populating COSTS table ....
Load data into table SH.COSTS
csv
column_names on
delimiter ,
enclosures ""
encoding UTF8
row_limit off
row_terminator default
skip_rows 0
skip_after_names
batch_rows 10000
batches_per_commit 1
clean_names transform
column_size rounded
commit on
date_format YYYY-MM-DD
errors 50
map_column_names off
method insert
timestamp_format
timestamptz_format
locale
scan_rows 100
truncate off
unknown_columns_fail on
#INFO Number of rows processed: 82,112
#INFO Number of rows in error: 0
#INFO Last row processed in final committed batch: 82,112
SUCCESS: Processed without errors
****** Populating CUSTOMERS table ....
Load data into table SH.CUSTOMERS
csv
column_names on
delimiter ,
enclosures ""
encoding UTF8
row_limit off
row_terminator default
skip_rows 0
skip_after_names
batch_rows 10000
batches_per_commit 1
clean_names transform
column_size rounded
commit on
date_format YYYY-MM-DD
errors 50
map_column_names off
method insert
timestamp_format
timestamptz_format
locale English United States
scan_rows 100
truncate off
unknown_columns_fail on
#INFO Number of rows processed: 55,500
#INFO Number of rows in error: 0
#INFO Last row processed in final committed batch: 55,500
SUCCESS: Processed without errors
****** Populating PROMOTIONS table ....
Load data into table SH.PROMOTIONS
csv
column_names on
delimiter ,
enclosures ""
encoding UTF8
row_limit off
row_terminator default
skip_rows 0
skip_after_names
batch_rows 10000
batches_per_commit 1
clean_names transform
column_size rounded
commit on
date_format YYYY-MM-DD
errors 50
map_column_names off
method insert
timestamp_format
timestamptz_format
locale English United States
scan_rows 100
truncate off
unknown_columns_fail on
#INFO Number of rows processed: 503
#INFO Number of rows in error: 0
#INFO Last row processed in final committed batch: 503
SUCCESS: Processed without errors
****** Populating SALES table ....
Load data into table SH.SALES
csv
column_names on
delimiter ,
enclosures ""
encoding UTF8
row_limit off
row_terminator default
skip_rows 0
skip_after_names
batch_rows 10000
batches_per_commit 1
clean_names transform
column_size rounded
commit on
date_format YYYY-MM-DD
errors 50
map_column_names off
method insert
timestamp_format
timestamptz_format
locale English United States
scan_rows 100
truncate off
unknown_columns_fail on
#INFO Number of rows processed: 918,843
#INFO Number of rows in error: 0
#INFO Last row processed in final committed batch: 918,843
SUCCESS: Processed without errors
****** Populating TIMES table ....
Load data into table SH.TIMES
csv
column_names on
delimiter ,
enclosures ""
encoding UTF8
row_limit off
row_terminator default
skip_rows 0
skip_after_names
batch_rows 10000
batches_per_commit 1
clean_names transform
column_size rounded
commit on
date_format YYYY-MM-DD
errors 50
map_column_names off
method insert
timestamp_format
timestamptz_format
locale English United States
scan_rows 100
truncate off
unknown_columns_fail on
#INFO Number of rows processed: 1,826
#INFO Number of rows in error: 0
#INFO Last row processed in final committed batch: 1,826
SUCCESS: Processed without errors
****** Populating SUPPLEMENTARY_DEMOGRAPHICS table ....
Load data into table SH.SUPPLEMENTARY_DEMOGRAPHICS
csv
column_names on
delimiter ,
enclosures ""
encoding UTF8
row_limit off
row_terminator default
skip_rows 0
skip_after_names
batch_rows 10000
batches_per_commit 1
clean_names transform
column_size rounded
commit on
date_format YYYY-MM-DD
errors 50
map_column_names off
method insert
timestamp_format
timestamptz_format
locale English United States
scan_rows 100
truncate off
unknown_columns_fail on
#INFO Number of rows processed: 4,500
#INFO Number of rows in error: 0
#INFO Last row processed in final committed batch: 4,500
SUCCESS: Processed without errors
****** Enabling table constraints
Table TIMES altered.
Table CHANNELS altered.
Table COUNTRIES altered.
Table PROMOTIONS altered.
Table PRODUCTS altered.
Table CUSTOMERS altered.
Table SALES altered.
Table SALES altered.
Table SALES altered.
Table SALES altered.
Table SALES altered.
Table CUSTOMERS altered.
Table COSTS altered.
Table COSTS altered.
Table COSTS altered.
Table COSTS altered.
****** Creating indexes for SALES table ....
INDEX SALES_PROD_BIX created.
INDEX SALES_CUST_BIX created.
INDEX SALES_TIME_BIX created.
INDEX SALES_CHANNEL_BIX created.
INDEX SALES_PROMO_BIX created.
Index SUP_TEXT_IDX created.
****** Creating indexes for COSTS table ....
INDEX COSTS_PROD_BIX created.
INDEX COSTS_TIME_BIX created.
****** Creating indexes for PRODUCTS table ....
INDEX PRODUCTS_PROD_STATUS_BIX created.
Index PRODUCTS_PROD_SUBCAT_IX created.
Index PRODUCTS_PROD_CAT_IX created.
INDEX CUSTOMERS_GENDER_BIX created.
INDEX CUSTOMERS_MARITAL_BIX created.
INDEX CUSTOMERS_YOB_BIX created.
INDEX FW_PSC_S_MV_SUBCAT_BIX created.
INDEX FW_PSC_S_MV_CHAN_BIX created.
INDEX FW_PSC_S_MV_PROMO_BIX created.
INDEX FW_PSC_S_MV_WD_BIX created.
****** Creating dimensions ....
Dimension CUSTOMERS_DIM created.
Dimension PRODUCTS_DIM created.
Dimension TIMES_DIM created.
Dimension CHANNELS_DIM created.
Dimension PROMOTIONS_DIM created.
****** Gathering statistics for schema ...
PL/SQL procedure successfully completed.
End time: 13-AUG-25 04.36.35.156497 AM +00:00
1 row selected.
Installation verification
____________________________
Verification:
Table provided actual
_____________________________ ___________ _________
channels 5 5
costs 82112 82112
countries 35 35
customers 55500 55500
products 72 72
promotions 503 503
sales 918843 918843
times 1826 1826
supplementary_demographics 4500 4500
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 EE High Perf Release 19.0.0.0.0 - Production
Version 19.24.0.0.0
■ サンプルスキーマのリセット
通常、サンプルスキーマを初めてインストールする場合と、以前インストールしたバージョンに上書きして再インストールする場合に違いはありません。デフォルトでは、*_install.sqlスクリプトによって以前のインストールからスキーマユーザーとそのすべてのオブジェクトが削除されます。
■ サンプルスキーマのアンインストール
サンプル スキーマをアンインストールするには、 _uninstall.sqlSQLPlus から対応するスクリプトを実行します。
他のユーザーを作成および削除する権限を持つ特権ユーザーとしてデータベースに接続します。
たとえば、 SYSTEM または ADMIN として接続します。
*_uninstall.sql アンインストール スクリプトを実行します。。たとえば、hrスキーマをアンインストールするには、 hr_uninstall.sqlスクリプトを実行します。
■ 参考
・ Documents
- Database Sample Schemasデータベースサンプルスキーマ
- サンプルスキーマのインストール
- サンプルスキーマ図
・ GitHub
- Oracle Database Sample Schemas