之前安装oracle的时候,没有安装默认的示例,练习过程中,教程常用的hr等用户都没有,可以从官网下载示例来安装。
下载官方example包 登录http://www.oracle.com 到下载页浏览就可以找到名为 linux.x64_11gR2_examples.zipunzip linux.x64_11gR2_examples.zip
编辑rsp静默安装文件 cp examples/response/demos_install.rsp .
egrep -v "^$|^#" /home/oracle/demos_install.rsp
1 2 3 4 5 6 ORACLE_HOSTNAME=siluxa_oracle UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory/ SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 ORACLE_BASE=/u01/app/oracle
静默安装example ./runInstaller -silent -responseFile /home/oracle/demos_install.rsp -ignorePrereq
执行sql脚本文件,安装特定模式 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [oracle@siluxa_oracle human_resources]$ sqlplus sys/solution as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri May 4 18:01:11 2018 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SYS@orcl> @?/demo/schema/human_resources/hr_main.sql specify password for HR as parameter 1: Enter value for 1: 123 specify default tablespeace for HR as parameter 2: Enter value for 2: users specify temporary tablespace for HR as parameter 3: Enter value for 3: temp specify password for SYS as parameter 4: Enter value for 4: solution specify log path as parameter 5: Enter value for 5: $ORACLE_HOME/demo/schema/log/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 HR@orcl> select table_name from user_tables; TABLE_NAME ------------------------------ REGIONS LOCATIONS JOB_HISTORY JOBS EMPLOYEES DEPARTMENTS COUNTRIES 7 rows selected.
这样就算安装完成了,可以使用hr进行学习了。
参考地址:https://blog.csdn.net/smstong/article/details/45891187