经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Oracle » 查看文章
Oracle 11g R2 Sample Schemas 安装
来源:cnblogs  作者:H_Johnny  时间:2019/5/21 9:21:58  对本文有异议

最近准备对之前学习SQL*Loader的笔记进行整理,希望通过官方文档中的示例学习(Case Studies)来进行,但是官方文档中示例学习相关的脚本文件在数据库软件安装完成之后默认并没有提供,而是整合在另外一个安装介质中,需通过安装Oracle Examples介质来获取相应的示例学习脚本。

数据库示例(Oracle Database Examples)包含了一系列的示例脚本和产品功能演示的Schema信息,在学习Oracle数据库的过程中可以通过这些示例更好的掌握数据库相关的选项和功能特性。关于Oracle的示例Schema,更详细的说明可以参考官方文档:Database Sample Schemas

根据我的数据库版本,需要下载Oracle 11g R2对应的examples安装介质。如果数据库版本是11.2.0.1,则可以到官网上进行下载示例安装介质:Oracle Database 11g Release 2 Examples。本文使用的数据库版本为11.2.0.4,相应的examples安装介质可通过Oracle MOS上进行获取,根据11.2.0.4的Patch说明,对应的examples安装介质为:p13390677_112040_platform_6of7.zip

安装准备

首先上传对应压缩包p13390677_112040_platform_6of7.zip到相应的目录下。

  1. # rz
  2. rz waiting to receive.
  3. Upload Zmodem
  4. p13390677_112040_Linux-x86-64_6of7.zip (465.75 MB, 0:10 min = 46.57 MB/sec)

对压缩包进行解压,将文件放在/tmp目录下。

  1. # unzip p13390677_112040_Linux-x86-64_6of7.zip -d /tmp/
  2. # ls /tmp/examples/
  3. install readme.html response runInstaller stage welcome.html

变更安装文件的属主和属组。

  1. # chown -R oracle.oinstall /tmp/examples/
  2. # ls -ld /tmp/examples/
  3. drwxr-xr-x 5 oracle oinstall 109 Aug 27 2013 /tmp/examples/

查看安装介质解压后的文件结构,Oracle Database Examples可以使用Oracle Installer软件安装器进行安装,其中安装种类可以通过图形界面或是静默安装的方式,为了更快速的完成安装,这里通过静默安装,同时需要结合response响应文件指定安装选项。

准备响应文件

安装介质中提供了一个响应文件模板,位于response目录下。

  1. $ ls /tmp/examples/response/
  2. demos_install.rsp

查看响应文件对应的文件内容,其中有各个选项的说明。

  1. $ cat /tmp/examples/response/demos_install.rsp
  2. ###############################################################################
  3. ## Copyright(c) Oracle Corporation 1998,2013. All rights reserved. ##
  4. ## ##
  5. ## Specify values for the variables listed below to customize ##
  6. ## your installation. ##
  7. ## ##
  8. ## Each variable is associated with a comment. The comment ##
  9. ## can help to populate the variables with the appropriate ##
  10. ## values. ##
  11. ## ##
  12. ###############################################################################
  13. #-------------------------------------------------------------------------------
  14. # Do not change the following system generated value.
  15. #-------------------------------------------------------------------------------
  16. oracle.install.responseFileVersion=/oracle/install/rspfmt_demosinstall_response_schema_v11_2_0
  17. #-------------------------------------------------------------------------------
  18. # This variable holds the hostname of the system as set by the user.
  19. # It can be used to force the installation to use an alternative
  20. # hostname rather than using the first hostname found on the system
  21. # (e.g., for systems with multiple hostnames and network interfaces).
  22. #-------------------------------------------------------------------------------
  23. ORACLE_HOSTNAME=
  24. #-------------------------------------------------------------------------------
  25. # Unix group to be set for the inventory directory.
  26. #-------------------------------------------------------------------------------
  27. UNIX_GROUP_NAME=
  28. #-------------------------------------------------------------------------------
  29. # Inventory location.
  30. #-------------------------------------------------------------------------------
  31. INVENTORY_LOCATION=
  32. #-------------------------------------------------------------------------------
  33. # Languages in which the components will be installed.
  34. #
  35. # en : English ja : Japanese
  36. # fr : French ko : Korean
  37. # ar : Arabic es : Latin American Spanish
  38. # bn : Bengali lv : Latvian
  39. # pt_BR: Brazilian Portuguese lt : Lithuanian
  40. # bg : Bulgarian ms : Malay
  41. # fr_CA: Canadian French es_MX: Mexican Spanish
  42. # ca : Catalan no : Norwegian
  43. # hr : Croatian pl : Polish
  44. # cs : Czech pt : Portuguese
  45. # da : Danish ro : Romanian
  46. # nl : Dutch ru : Russian
  47. # ar_EG: Egyptian zh_CN: Simplified Chinese
  48. # en_GB: English (Great Britain) sk : Slovak
  49. # et : Estonian sl : Slovenian
  50. # fi : Finnish es_ES: Spanish
  51. # de : German sv : Swedish
  52. # el : Greek th : Thai
  53. # iw : Hebrew zh_TW: Traditional Chinese
  54. # hu : Hungarian tr : Turkish
  55. # is : Icelandic uk : Ukrainian
  56. # in : Indonesian vi : Vietnamese
  57. # it : Italian
  58. #
  59. # all_langs : All languages
  60. #
  61. # Specify value as the following to select any of the languages.
  62. # Example : SELECTED_LANGUAGES=en,fr,ja
  63. #
  64. # Specify value as the following to select all the languages.
  65. # Example : SELECTED_LANGUAGES=all_langs
  66. #-------------------------------------------------------------------------------
  67. SELECTED_LANGUAGES=en
  68. #-------------------------------------------------------------------------------
  69. # Complete path of the Oracle Home
  70. #-------------------------------------------------------------------------------
  71. ORACLE_HOME=
  72. #-------------------------------------------------------------------------------
  73. # Complete path of the Oracle Base.
  74. #-------------------------------------------------------------------------------
  75. ORACLE_BASE=
  76. #------------------------------------------------------------------------------
  77. # Specify the auto-updates option. It can be one of the following:
  78. # - MYORACLESUPPORT_DOWNLOAD
  79. # - OFFLINE_UPDATES
  80. # - SKIP_UPDATES
  81. #------------------------------------------------------------------------------
  82. oracle.installer.autoupdates.option=
  83. #------------------------------------------------------------------------------
  84. # In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where
  85. # the updates are to be downloaded.
  86. # In case OFFLINE_UPDATES option is chosen, specify the location where the updates
  87. # are present.
  88. #------------------------------------------------------------------------------
  89. oracle.installer.autoupdates.downloadUpdatesLoc=
  90. #------------------------------------------------------------------------------
  91. # Specify the My Oracle Support Account Username which has the patches download privileges
  92. # to be used for software updates.
  93. # Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com
  94. #------------------------------------------------------------------------------
  95. AUTOUPDATES_MYORACLESUPPORT_USERNAME=
  96. #------------------------------------------------------------------------------
  97. # Specify the My Oracle Support Account Username password which has the patches download privileges
  98. # to be used for software updates.
  99. #
  100. # Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password
  101. #------------------------------------------------------------------------------
  102. AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
  103. #------------------------------------------------------------------------------
  104. # Specify the Proxy server name. Length should be greater than zero.
  105. #
  106. # Example : PROXY_HOST=proxy.domain.com
  107. #------------------------------------------------------------------------------
  108. PROXY_HOST=
  109. #------------------------------------------------------------------------------
  110. # Specify the proxy port number. Should be Numeric and at least 2 chars.
  111. #
  112. # Example : PROXY_PORT=25
  113. #------------------------------------------------------------------------------
  114. PROXY_PORT=
  115. #------------------------------------------------------------------------------
  116. # Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
  117. # blank if your proxy server requires no authentication.
  118. #
  119. # Example : PROXY_USER=username
  120. #------------------------------------------------------------------------------
  121. PROXY_USER=
  122. #------------------------------------------------------------------------------
  123. # Specify the proxy password. Leave PROXY_USER and PROXY_PWD
  124. # blank if your proxy server requires no authentication.
  125. #
  126. # Example : PROXY_PWD=password
  127. #------------------------------------------------------------------------------
  128. PROXY_PWD=
  129. #------------------------------------------------------------------------------
  130. # Specify the proxy realm.
  131. #
  132. # Example : PROXY_REALM=metalink
  133. #------------------------------------------------------------------------------
  134. PROXY_REALM=

可以对模版响应文件进行简化处理,去掉相应的注释内容和空行,复制生成一份响应文件dbabd_demos_install.rsp,关于响应文件中选项的设置可以参考另一篇博文关于响应文件的部分说明:CentOS 7静默安装Oracle 11g R2数据库软件

  1. $ cat /tmp/examples/response/demos_install.rsp | grep -v '^$' | grep -v '^#' > /tmp/examples/response/dbabd_demos_install.rsp
  2. $ cat /tmp/examples/response/dbabd_demos_install.rsp
  3. oracle.install.responseFileVersion=/oracle/install/rspfmt_demosinstall_response_schema_v11_2_0
  4. ORACLE_HOSTNAME=dbabd
  5. UNIX_GROUP_NAME=oinstall
  6. INVENTORY_LOCATION=/data/app/oraInventory
  7. SELECTED_LANGUAGES=en,zh_CN
  8. ORACLE_HOME=/data/app/oracle/product/11.2.0/db_1
  9. ORACLE_BASE=/data/app/oracle
  10. oracle.installer.autoupdates.option=
  11. oracle.installer.autoupdates.downloadUpdatesLoc=
  12. AUTOUPDATES_MYORACLESUPPORT_USERNAME=
  13. AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
  14. PROXY_HOST=
  15. PROXY_PORT=
  16. PROXY_USER=
  17. PROXY_PWD=
  18. PROXY_REALM=

执行静默安装

响应文件完成之后就可以进行静默安装了,需要使用oracle用户进行安装。

  1. # su - oracle
  2. $ cd /tmp/examples/
  3. $ /tmp/examples/runInstaller -silent -force -ignorePrereq -ignoreSysPrereqs -responseFile /tmp/examples/response/dbabd_demos_install.rsp
  4. Starting Oracle Universal Installer...
  5. Checking Temp space: must be greater than 120 MB. Actual 36731 MB Passed
  6. Checking swap space: must be greater than 150 MB. Actual 5103 MB Passed
  7. Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-05-18_08-54-52PM. Please wait ...
  8. You can find the log of this install session at:
  9. /data/app/oraInventory/logs/installActions2019-05-18_08-54-52PM.log
  10. The installation of Oracle Database 11g Examples was successful.
  11. Please check '/data/app/oraInventory/logs/silentInstall2019-05-18_08-54-52PM.log' for more details.
  12. Successfully Setup Software.

通过简要的安装信息可以看出安装成功,如果需要详细的日志信息可以查询提示信息中涉及的日志文件。

完成安装

至此,关于数据库示例(Oracle Database Examples)对应的安装介质就安装完成了。通过查看目录$ORACLE_HOME/rdbms/demo下的以ulcase命名的一系列文件就是Oracle针对SQL*Loader示例学习文件。在没有安装之前,这个目录下是没有文件的。

  1. $ cd $ORACLE_HOME/rdbms/demo
  2. $ ls ulcase*
  3. ulcase10.ctl ulcase11.sql ulcase2.dat ulcase4.dat ulcase5.sql ulcase7.ctl ulcase8.ctl ulcase92.dat ulcase96.dat
  4. ulcase10.sql ulcase1.ctl ulcase3.ctl ulcase4.sql ulcase6.ctl ulcase7.dat ulcase8.dat ulcase93.dat ulcase9.ctl
  5. ulcase11.ctl ulcase1.sql ulcase3.sql ulcase5.ctl ulcase6.dat ulcase7e.sql ulcase8.sql ulcase94.dat ulcase9.sql
  6. ulcase11.dat ulcase2.ctl ulcase4.ctl ulcase5.dat ulcase6.sql ulcase7s.sql ulcase91.dat ulcase95.dat ulcase.sh

其中ulcase.sh的内容如下:

  1. $ cat ulcase.sh
  2. #!/bin/sh
  3. #
  4. # $Header: ulcase.sh 06-sep-2007.13:54:17 jstenois Exp $
  5. #
  6. # ulcase.sh
  7. #
  8. # Copyright (c) 1999, 2007, Oracle. All rights reserved.
  9. #
  10. # NAME
  11. # ulcase.sh - run sqlldr demos
  12. #
  13. # DESCRIPTION
  14. # Shell script to run sqlldr demos.
  15. # Please append to script as more ulcase* demos are added.
  16. #
  17. # MODIFIED (MM/DD/YY)
  18. # jstenois 09/06/07 - remove password from demo script
  19. # krich 01/26/04 - adding case study 11
  20. # cmlim 07/20/99 - create shell script for running all sqlldr demos
  21. # cmlim 07/20/99 - Creation
  22. #
  23. echo " "
  24. echo "- This script runs through all of the SQL Loader demos."
  25. echo "- It uses SQLPlus to create the necessary objects and then"
  26. echo "- calls SQL Loader to load data. This script uses schema"
  27. echo "- SCOTT for all of the tests. Whenever the script executes"
  28. echo "- SQLPlus or SQL Loader utilities, it will prompt you for"
  29. echo "- password of the SCOTT user. You will need to enter this"
  30. echo "- password every time for the script to continue. The"
  31. echo "- default password for user SCOTT is TIGER."
  32. echo " "
  33. # CASE1
  34. echo " "
  35. echo " Starting case 1"
  36. echo " Calling SQL Plus to do setup for case 1"
  37. sqlplus scott @ulcase1
  38. echo " Calling SQL Loader to load data for case 1"
  39. sqlldr scott ulcase1.ctl
  40. # CASE2
  41. echo " "
  42. echo " Starting case 2"
  43. echo " Calling SQL Loader to load data for case 2"
  44. sqlldr scott ulcase2
  45. # CASE3
  46. echo " "
  47. echo " Starting case 3"
  48. echo " Calling SQL Plus to do setup for case 3"
  49. sqlplus scott @ulcase3
  50. echo " Calling SQL Loader to load data for case 3"
  51. sqlldr scott ulcase3
  52. # CASE4
  53. echo " "
  54. echo " Starting case 4"
  55. echo " Calling SQL Plus to do setup for case 4"
  56. sqlplus scott @ulcase4
  57. echo " Calling SQL Loader to load data for case 4"
  58. sqlldr scott ulcase4
  59. # CASE5
  60. echo " "
  61. echo " Starting case 5"
  62. echo " Calling SQL Plus to do setup for case 5"
  63. sqlplus scott @ulcase5
  64. echo " Calling SQL Loader to load data for case 5"
  65. sqlldr scott ulcase5
  66. # CASE6
  67. echo " "
  68. echo " Starting case 6"
  69. echo " Calling SQL Plus to do setup for case 6"
  70. sqlplus scott @ulcase6
  71. echo " Calling SQL Loader to load data for case 6"
  72. sqlldr scott ulcase6 direct=true
  73. # CASE7
  74. echo " "
  75. echo " Starting case 7"
  76. echo " Calling SQL Plus to do setup for case 7"
  77. sqlplus scott @ulcase7s
  78. echo " Calling SQL Loader to load data for case 7"
  79. sqlldr scott ulcase7
  80. echo " Calling SQL Plus to do cleanup for case 7"
  81. sqlplus scott @ulcase7e
  82. # CASE8
  83. echo " "
  84. echo " Starting case 8"
  85. echo " Calling SQL Plus to do setup for case 8"
  86. sqlplus scott @ulcase8
  87. echo " Calling SQL Loader to load data for case 8"
  88. sqlldr scott ulcase8
  89. # CASE9
  90. echo " "
  91. echo " Starting case 9"
  92. echo " Calling SQL Plus to do setup for case 9"
  93. sqlplus scott @ulcase9
  94. echo " Calling SQL Loader to load data for case 9"
  95. sqlldr scott ulcase9
  96. # CASE10
  97. echo " "
  98. echo " Starting case 10"
  99. echo " Calling SQL Plus to do setup for case 10"
  100. sqlplus scott @ulcase10
  101. echo " Calling SQL Loader to load data for case 10"
  102. sqlldr scott ulcase10
  103. # CASE11
  104. echo " "
  105. echo " Starting case 11"
  106. echo " Calling SQL Plus to do setup for case 11"
  107. sqlplus scott @ulcase11
  108. echo " Calling SQL Loader to load data for case 11"
  109. sqlldr scott ulcase11

参考

https://docs.oracle.com/cd/E11882_01/server.112/e10831/toc.htm
https://docs.oracle.com/cd/E11882_01/install.112/e24501/toc.htm#BABGFCIH
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html

☆〖本人水平有限,文中如有错误还请留言批评指正!〗☆

原文链接:http://www.cnblogs.com/dbabd/p/10892435.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号