Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7316
  • 博文数量: 5
  • 博客积分: 21
  • 博客等级: 民兵
  • 技术积分: 35
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-23 23:29
文章分类

全部博文(5)

文章存档

2012年(4)

2011年(1)

我的朋友
最近访客

分类:

2012-08-30 11:36:28

原文地址:SQL学习环境配置 作者:GangLin_Lan

 

安装oracle软件,创建数据库,执行以下sql脚本创建学习账户和表结构

 

  1. [oracle@server2 labs]$ more creteach.sql
  2. REM Script: CRETEACH.SQL
  3. REM Purpose: To create a "teach" account for instructor
  4. REM Created: By Nagavalli Pataballa on 16-MAR-2001
  5. REM for the Introduction to Oracle9i:SQL course
  6. REM This script is invoked by the CRESCHEM.SQL script

  7. CONNECT / as sysdba

  8. DROP USER teach CASCADE;
  9. CREATE USER teach IDENTIFIED BY oracle;
  10. ALTER USER teach DEFAULT TABLESPACE users
  11.       QUOTA UNLIMITED ON users;
  12. ALTER USER teach TEMPORARY TABLESPACE temp;

  13. GRANT CREATE SESSION, CREATE TABLE, CREATE PROCEDURE
  14.     , CREATE SEQUENCE, CREATE TRIGGER, CREATE VIEW
  15.     , CREATE SYNONYM, ALTER SESSION, CREATE ANY INDEX
  16.     , CREATE PUBLIC SYNONYM, CREATE USER, CREATE ROLE
  17. TO teach;

  18. REM connect to teach account and invoke the scripts that create schema objects.

  19. CONNECT teach/oracle
  20. @@hr_cre
  21. @@hr_popul
  22. @@hr_idx
  23. @@hr_code
  24. @@hr_comnt
  25. @@del_data

  26. CONNECT / as sysdba
  27. GRANT CREATE ANY DIRECTORY, QUERY REWRITE, DROP PUBLIC SYNONYM TO teach;

  28. REM verify the number of rows created for each table
  29. select count(*) NUM_EMP from employees;
  30. select count(*) NUM_DEP from departments;
  31. select count(*) NUM_LOC from locations;
  32. select count(*) NUM_REG from regions;
  33. select count(*) NUM_CTR from countries;
  34. select count(*) NUM_JOB from jobs;
  35. select count(*) NUM_JH from job_history;

进入sqlplus执行以上脚本:

  1. [oracle@server2 labs]$ sqlplus / as sysdba

  2. SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 29 08:57:06 2012

  3. Copyright (c) 1982, 2009, Oracle. All rights reserved.


  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  7. SQL> @/home/oracle/lanv/9isql/labs/creteach.sql



 

阅读(196) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~