如何安装Oracle Database Examples

Posted dingdingfish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何安装Oracle Database Examples相关的知识,希望对你有一定的参考价值。

此处下载Oracle Database Examples,本例为21c版本,大小近800MB:

$ ls -lh /vagrant/LINUX.X64_213000_examples.zip
-rwxrwxrwx. 1 vagrant vagrant 796M Dec 30 10:37 /vagrant/LINUX.X64_213000_examples.zip

21c的Database Examples Installation Guide

解压:

cd ~oracle
unzip /vagrant/LINUX.X64_213000_examples.zip -d .

加压后为1.1GB:

$ cd examples/
$ du -sh .
1.1G    .

其实文档也有提到:

1.1 GB of free disk space on UNIX systems.

查看解压后的文件:

$ ls -l
total 20
drwxr-xr-x.  4 oracle oinstall  191 Jul 28  2021 install
drwxrwxr-x.  2 oracle oinstall   34 Jul 28  2021 response
-rwxr-xr-x.  1 oracle oinstall 8854 Jul 28  2021 runInstaller
drwxr-xr-x. 13 oracle oinstall 4096 Jul 28  2021 stage
-rwxrwxr-x.  1 oracle oinstall  500 Feb  7  2013 welcome.html

response目录下有response文件:

$ cat response/*.rsp


###############################################################################
## Copyright(c) Oracle Corporation 1998,2021. All rights reserved.           ##
##                                                                           ##
## Specify values for the variables listed below to customize                ##
## your installation.                                                        ##
##                                                                           ##
## Each variable is associated with a comment. The comment                   ##
## can help to populate the variables with the appropriate                   ##
## values.                                                                   ##
##                                                                           ##
###############################################################################

#-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_demosinstall_response_schema_v21.0.0

#-------------------------------------------------------------------------------
# Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=

#-------------------------------------------------------------------------------
# Complete path of the Oracle Home
#-------------------------------------------------------------------------------
ORACLE_HOME=

#-------------------------------------------------------------------------------
# Complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=

获取这些参数:

$ orabase
/opt/oracle

$ echo $ORACLE_HOME
/opt/oracle/product/21c/dbhome_1

$ id -gn oracle
oinstall

修改后的response文件如下:

oracle.install.responseFileVersion=/oracle/install/rspfmt_demosinstall_response_schema_v21.0.0
UNIX_GROUP_NAME=oinstall
ORACLE_HOME=/opt/oracle/product/21c/dbhome_1
ORACLE_BASE=/opt/oracle

静默安装。注意-responseFile后必须为绝对路径:

$ ./runInstaller -silent -responseFile /home/oracle/examples/response/examples_install.rsp

日志如下:

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 415 MB.   Actual 16478 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4083 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2023-01-03_10-13-10PM. Please wait ...[oracle@oracle-21c-vagrant examples]$ The response file for this session can be found at:
 /opt/oracle/product/21c/dbhome_1/install/response/examples_2023-01-03_10-13-10PM.rsp

You can find the log of this install session at:
 /opt/oraInventory/logs/installActions2023-01-03_10-13-10PM.log
Successfully Setup Software.
The installation of Oracle Database 21c Examples was successful.
Please check '/opt/oraInventory/logs/silentInstall2023-01-03_10-13-10PM.log' for more details.

安装的Example位于$ORACLE_HOME/rdbms/demo目录下。
但是这个目录很小,有343个文件:

$ du -sh $ORACLE_HOME/rdbms/demo
6.1M    /opt/oracle/product/21c/dbhome_1/rdbms/demo

所以应该也不仅限于以上目录:

$ cd $ORACLE_HOME
$ find . -name demo -type d -exec ls -ld  \\;
drwxr-x---. 5 oracle oinstall 12288 Jan  3 22:49 ./rdbms/demo
drwxr-xr-x. 3 oracle oinstall 61 Jan  3 22:13 ./ldap/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan  3 22:40 ./plsql/demo
drwxr-xr-x. 2 oracle oinstall 270 Jul 28  2021 ./sdk/demo
drwxr-xr-x. 2 oracle oinstall 45 Jan  3 22:38 ./sqlplus/demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan  3 22:13 ./sqlj/demo
drwxr-xr-x. 5 oracle oinstall 44 Jan  3 22:13 ./precomp/demo
drwxr-x---. 5 oracle oinstall 38 Jan  3 22:13 ./xdk/demo
drwxr-xr-x. 3 oracle oinstall 60 Jan  3 22:13 ./nls/gdk/demo
drwxr-xr-x. 2 oracle oinstall 98 Jan  3 22:13 ./nls/demo
drwxr-xr-x. 14 oracle oinstall 249 Jan  3 22:13 ./md/demo
drwxr-xr-x. 3 oracle oinstall 19 Jan  3 22:13 ./odbc/demo
drwxr-xr-x. 3 oracle oinstall 20 Jul 28  2021 ./demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan  3 22:13 ./jpub/demo

其中带Jan 3的都是新安装的。

在文档的1.2.2节: Required Products,

Explains the products that are required to use Oracle Database Examples.
Before you can use the Oracle Database Examples, you must install the sample schemas in an Oracle Database. When you install Oracle Database, or use Database Configuration Assistant to create a database, you can choose to include the sample schemas. You can also manually install the sample schemas in an existing database.

这说明Database Examples也有一些会依赖Oracle Sample Schema。

还有一些Database Example可以通过以下GitHub项目安装,如Data Mining:

  • https://github.com/oracle/oracle-db-examples

在文档Database Administrator’s Reference for Linux and UNIX System-Based Operating Systems的第7章:SQLLoader and PL/SQL Demonstrations,有讲到SQLLoader Demonstrations和PL/SQL Demonstrations。

6.3.1节,有讲到Pro*C/C++ Demonstration Programs。其它的语言,如FORTRAN,OCI,OCCI也有说明。

文档Oracle® Database Database Utilities的7.13节 SQL*Loader Case Studies有对SQL Loader示例的详细说明。

补充

2023年1月10日,又在一个19c的环境下做了实验。主要收获是2点。

第一点是确定了安装的大小确实是1G左右,之前还有点怀疑。第二是确定了新安装文件的目录。

第一点通过在安装前后运行df来比较,差异就是1G:

$ diff /tmp/1 /tmp/2
8c8
< /dev/sda4       200G   25G  165G  14% /u01
---
> /dev/sda4       200G   26G  164G  14% /u01

第2点也是通过安装前后运行以下命令来比较:

cd $ORACLE_HOME
find . -name demo -type d -exec ls -ld  \\;

安装前的输出:

drwxr-xr-x. 3 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/21.2/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.4/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.4/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.4/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.1/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.1/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.1/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.6/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.6/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.6/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.2/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.2/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.2/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.3/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.3/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.3/demo
drwxr-xr-x. 4 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.0/demo
drwxr-xr-x. 3 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/21.1/demo
drwxr-xr-x. 3 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/22.1/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.5/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.5/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.5/demo
drwxr-xr-x. 2 oracle oinstall 4096 Apr 17  2019 ./sdk/demo
drwxr-x---. 3 oracle oinstall 4096 Apr 17  2019 ./inventory/Templates/demo
drwxr-xr-x. 3 oracle oinstall 4096 Apr 17  2019 ./demo

安装后的输出:

drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./nls/gdk/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./nls/demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./sqlj/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./plsql/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./sqlplus/demo
drwxr-xr-x. 13 oracle oinstall 4096 Jan 10 06:49 ./md/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./jpub/demo
drwxr-x---. 5 oracle oinstall 4096 Jan 10 06:49 ./xdk/demo
drwxr-xr-x. 5 oracle oinstall 4096 Jan 10 06:49 ./precomp/demo
drwxr-xr-x. 3 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/21.2/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.4/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.4/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.4/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.1/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.1/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.1/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.6/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.6/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.6/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.2/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.2/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.2/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.3/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.3/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.3/demo
drwxr-xr-x. 4 oracle oinstall 4096 Jan 10 06:46 ./apex/images/themes/theme_42/1.0/demo
drwxr-xr-x. 3 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/21.1/demo
drwxr-xr-x. 3 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/22.1/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.5/js/demo
drwxr-xr-x. 2 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.5/css/demo
drwxr-xr-x. 4 oracle oinstall 4096 May 10  2022 ./apex/images/themes/theme_42/1.5/demo
drwxr-xr-x. 2 oracle oinstall 4096 Apr 17  2019 ./sdk/demo
drwxr-xr-x. 5 oracle oinstall 12288 Jan 10 06:49 ./rdbms/demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./odbc/demo
drwxr-x---. 3 oracle oinstall 4096 Apr 17  2019 ./inventory/Templates/demo
drwxr-xr-x. 3 oracle oinstall 4096 Apr 17  2019 ./demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./ldap/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./jdbc/demo

由于安装日期是1月10日,也可以通过以下的命令过滤出新安装的目录:

$ find . -name demo -type d -exec ls -ld  \\;|grep "Jan 10"|grep -v apex
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./nls/gdk/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./nls/demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./sqlj/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./plsql/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./sqlplus/demo
drwxr-xr-x. 13 oracle oinstall 4096 Jan 10 06:49 ./md/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./jpub/demo
drwxr-x---. 5 oracle oinstall 4096 Jan 10 06:49 ./xdk/demo
drwxr-xr-x. 5 oracle oinstall 4096 Jan 10 06:49 ./precomp/demo
drwxr-xr-x. 5 oracle oinstall 12288 Jan 10 06:49 ./rdbms/demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./odbc/demo
drwxr-xr-x. 3 oracle oinstall 4096 Jan 10 06:49 ./ldap/demo
drwxr-xr-x. 2 oracle oinstall 4096 Jan 10 06:49 ./jdbc/demo

错误的处理

在非19.3版本上安装时,都碰到了以下错误:

$ ./runInstaller -silent -responseFile /home/oracle/examples/response/demos_install.rsp
WARNING:OUI-10221:The install touches a component that is patched by interim patches 'Interim Patch# 34133642'. The interim patches affect other components not included in the install.
You may rollback the interim patches 'Interim Patch# 34133642' using OPatch for consistency before performing the upgrade.
You may also choose to ignore this warning and continue with the upgrade. If you choose to continue, the conflicting patches will be removed from the inventory. However, some files that are not updated during the upgrade may be left behind. Contact Support to check applicability and availability of interim patches 'Interim Patch# 34133642' for this install.
Do you want to ignore the patch conflicts and continue with the upgrade?
[FATAL]

我选择了回退输出中所说的patch,由于这个patch有依赖性,实际我是分3步完成的:

opatch rollback -id 33631337
opatch rollback -id 34113634
opatch rollback -id 34133642

当然,在生产环境不建议这么做。

没有在19c中找到runInstallers的-ignorePatchConflicts选项,同时发现OPatch的文档居然归类在Oracle Enterprise Manager下面,详见这里

以上是关于如何安装Oracle Database Examples的主要内容,如果未能解决你的问题,请参考以下文章

如何安装Oracle Database Examples

如何安装Oracle Database Examples

oracle 11g 安装包解压的问题

如何安装Oracle 12c数据库软件

win7 64位的 如何安装 oracle 9i

Oracle Database 11g安装教程