创建hr用户和表


默认情况下是不创建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目录中

  1. cd $ORACLE_HOME/demo/schema/human_resources  
  2. [root@IM-8-201 human_resources]# sqlplus sys/sys as sysdba @hr_main.sql  
  3.   
  4. SQL*Plus: Release 10.2.0.4.0 - Production on Tue Nov 15 21:40:44 2011  
  5.   
  6. Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.  
  7.   
  8.   
  9. Connected to:  
  10. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production  
  11. With the Partitioning, OLAP, Data Mining and Real Application Testing options  
  12.   
  13.   
  14. specify password for HR as parameter 1:  
  15. Enter value for 1: hr  
  16.   
  17. specify default tablespeace for HR as parameter 2:  
  18. Enter value for 2: user  
  19.   
  20. specify temporary tablespace for HR as parameter 3:  
  21. Enter value for 3: temp  
  22.   
  23. specify password for SYS as parameter 4:  
  24. Enter value for 4: sys  
  25. specify log path as parameter 5:  
  26. Enter value for 5:/home/oracle  
  27. ..............................  
  28. PL/SQL procedure successfully completed.  
  29.   
  30.   
  31. PL/SQL procedure successfully completed.  
  32.   
  33. SQL>  
3、验证
  1. SQL> select table_name from user_tables;  
  2.   
  3. TABLE_NAME  
  4. ------------------------------   
  5. REGIONS  
  6. LOCATIONS  
  7. DEPARTMENTS  
  8. JOBS  
  9. EMPLOYEES  
  10. JOB_HISTORY  
  11. COUNTRIES  
  12.   
  13. rows selected.  

相关内容