默认情况下是不创建hr用户和表的,我们可以通过dbca和script两种方式创建,我们这里通过script方式创建
现在我通过script方式创建hr用户和表
1、从网上得到hr用户的脚本
2、把脚本放入$ORACLE_HOME/demo/schema/human_resources目录
hr_analz.sql hr_comnt.sql hr_dn_c.sql hr_drop.sql hr_main.sql
hr_code.sql hr_cre.sql hr_dn_d.sql hr_idx.sql hr_popul.sql
把以上脚本放入$ORACLE_HOME/demo/schema/human_resources目录中
cd $ORACLE_HOME/demo/schema/human_resources
[root@IM-8-201 human_resources]# sqlplus sys/sys as sysdba @hr_main.sql
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Nov 15 21:40:44 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
specify password for HR as parameter 1:
Enter value for 1: hr
specify default tablespeace for HR as parameter 2:
Enter value for 2: user
specify temporary tablespace for HR as parameter 3:
Enter value for 3: temp
specify password for SYS as parameter 4:
Enter value for 4: sys
specify log path as parameter 5:
Enter value for 5:/home/oracle
..............................
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
SQL>
3、验证
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
COUNTRIES
7 rows selected.