In Oracle10g, if we didn't select the installation sample when we created the instance, we can also create it with a script under $ORACLE_HOME/demo/schema after we created the instance. The official documentation has detailed instructions on how to create it:
SampleSchema Scripts and Object Descriptions
http://download.oracle.com/docs/cd/B19306_01/server.102/b14198/scripts.htm#sthref77
There are also related creation scripts in 11gR1:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28328/installation.htm#COMSC00002
These scripts create a series of sample users, including HR, OE, and so on. These user data allows us to simply perform some functional testing, and many examples of Oracle documentation use these users as well.
However, in 11gR2 we can no longer find the mksample .sql file under $ORACLE_HOME/demo/schema/directory, and there is no longer an SQL script in each individual subdirectory that creates the sample user.
In fact, Oracle separates the installation of these sample users into an installation disk, such as
for Linuxx86-64, which can be downloaded directly from OTN:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
Oracle Database 11g Release 2Examples is the sample user installation file we need. But now this installation file has more than 500 M, if you do not expect to download such large content, or you just need HR and OE users, then you can directly download the following URL ready-made SQL script, decompression can be run later.
http://st-curriculum.oracle.com/obe/jdev/obe11jdev/11/common/files/sample_schema_scripts.zip
TAKE HR USERS, FOR EXAMPLE:
$ ls
hr_cre.sql hr_main.sql hr_popul.sql
$ sqlplus / as sysdba
SQL> @hr_main.sql
-------------------------------------------------------------------------------------------------------
QQ:492913789
Email:[email protected]
Blog: http://www.cndba.cn/dave
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware
DBA1 GROUP: 62697716 (FULL); DBA2 GROUP: 62697977 (FULL) DBA3 GROUP: 62697850 (FULL)
DBA SUPERGROUP: 63306533 (FULL); DBA4 GROUP: 83829929 (FULL) DBA5 GROUP: 142216823 (FULL)
DBA6 GROUP: 158654907 (FULL) CHAT GROUP: 40132017 (FULL) CHAT GROUP 2: 69087192 (FULL)
--Adding groups is required to explain the relationship between Oracle table space and data files in the notes, otherwise the request will be rejected