如果想在Oracle11gR2下安裝樣本使用者,以便於示範oracle官方文檔中提供的樣本。可以選擇在建立執行個體的時候同時建立樣本。也可以在安裝完資料庫軟體資料庫以後建立。
在linux下樣本檔案本來存放的位置:$ORACLE_HOME/demo/schema
[oracle@www.bkjia.com ~]$ cd $ORACLE_HOME/demo/schema //在oracle10g,oracle11gR1中建立樣本的指令碼存放在這邊。
[oracle@www.bkjia.com schema]$ ll
total 80
drwxr-xr-x. 2 oracle oinstall 4096 Feb 5 20:57 bus_intelligence
-rw-r--r--. 1 oracle oinstall 2322 Apr 3 2009 drop_sch.sql
drwxr-xr-x. 2 oracle oinstall 4096 Feb 5 20:56 human_resources
drwxr-xr-x. 2 oracle oinstall 4096 Feb 5 21:19 log
-rw-r--r--. 1 oracle oinstall 1754 Feb 5 21:34 mk_dir.sql
-rw-r--r--. 1 oracle oinstall 1754 Feb 5 21:34 mk_dir.sql.ouibak
-rw-r--r--. 1 oracle oinstall 1600 Aug 16 2006 mk_dir.sql.sbs
-rw-r--r--. 1 oracle oinstall 27373 Jun 30 2007 mkplug.sql
drwxr-xr-x. 3 oracle oinstall 4096 Feb 5 21:19 order_entry
drwxr-xr-x. 2 oracle oinstall 4096 Feb 5 20:57 sales_history
-rw-r--r--. 1 oracle oinstall 15246 May 10 2005 sted_mkplug.sql.dbl
但是這裡已經不存在mksample.sql指令碼了,裡面的指令碼都不能用於建立oracle demo.
oracle在oracle11gR2中提供了獨立的500多MB安裝檔案,用於安裝樣本:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
需要下載安裝的安裝包的名是:Oracle Database 11g Release 2 Examples
oracle對該安裝包的解釋是:
Contains examples of how to use the Oracle Database. Download if you are new
to Oracle and want to try some of the examples presented in the Documentation。
如果僅需要hr使用者,用於示範可以從這個連結下載:
http://st-curriculum.oracle.com/obe/jdev/obe11jdev/11/common/files/sample_schema_scripts.zip
把下載檔案解壓在hr目錄下,用FileZilla傳進虛擬機器中
[oracle@www.bkjia.com hr]$ ls
hr_cre.sql hr_main.sql hr_popul.sql
[oracle@www.bkjia.com hr]$ sqlplus / as sysdba
SQL> @hr_main.sql
注另外常用到的scott使用者的建立指令碼位於:%ORACLE_HOME%\rdbms\admin\scott.sql
在linux下oracle11gR2中scott.sql並不在此目錄中。