最新的Oracle 数据库Sample Schema安装指南

今天根据之前博客如何使用github安装Oracle 数据库Sample Schema (示例Schema) ,发现居然报错了。
网站上看了下,发现确实有些变化,现描述如下。

第一个变化是OE和PM两个Schema进入归档状态,目前建议使用的是HR,SH和CO。

第二个变化是以前的一键式安装所有schema不支持了,必须逐个schema安装。
对于HR,SH和CO的安装和卸载,用以下脚本就好:

[oracle@ocp19c db-sample-schemas]$ find . -name *install*.sql
./sales_history/sh_install.sql
./sales_history/sh_uninstall.sql
./human_resources/hr_install.sql
./human_resources/hr_uninstall.sql
./customer_orders/co_install.sql
./customer_orders/co_uninstall.sql

一个需要特别注意的地方是,安装必须使用SQLcl,也就是sql命令而非sqlplus。因为加载命令用了sql的LOAD,而非SQL Loader。否则,看似成功,你会发现表中没有数据,例如SH.sales表,应该有918843条数据。

sql登录成功后,记得切换路径到安装目录,否则会报找不到安装文件。例如安装SH schema时:

$ sql system/$SYSPWD@orclpdb1


SQLcl: Release 21.4 Production on Tue May 23 10:32:24 2023

Copyright (c) 1982, 2023, Oracle.  All rights reserved.

Last Successful login time: Tue May 23 2023 10:32:26 +00:00

Connected to:
Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

SQL> pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/sqldeveloper/sqldeveloper/bin/
SQL> cd /home/oracle/db-sample-schemas/sales_history
SQL> pwd
/home/oracle/db-sample-schemas/sales_history

例如安装SH Sample Schema,看到以下输出,就表示安装成功了:

   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 Extreme Perf Release 19.0.0.0.0 - Production

安装HR Schema时的成功输出:

   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!

安装CO成功时的输出:

   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!

所有的Sample Schema版本历史可参见这里

猜你喜欢

转载自blog.csdn.net/stevensxiao/article/details/130832612