日期:2014-05-16  浏览次数:20464 次

oracle 中scott用户的创建方法

oracle 9i/10g中,如果数据库实例中没有scott模式,可以手工创建,方法如下:

登录数据库

ora_test@oracle[/home/oracle]> sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 24 09:21:26 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

创建scott用户

sys@CNHTM> create user scott identified by tiger;

User created.

为scott用户分配权限

sys@CNHTM> grant connect,resource to scott;

Grant succeeded.

用scott用户登录

sys@CNHTM> conn scott/tiger
Connected.

执行demobld.sql脚本

  • 在oracle 9i中,demobld.sql脚本位于 <ORACLE_HOME>/sqlplus/demo 目录中
  • 在oracle10g中,这个脚本在单独的光盘"Oracle Database 10g Companion CD Release 2"中,可以从otn下载安装。或者手工创建这个文件,本文最后有这个文件的内容
    scott@CNHTM> @?/sqlplus/demo/demobld.sql
    Building demonstration tables. Please wait.
    Demonstration table build is complete.
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options

    附件:demobld.sql 脚本内容

    ----------------------demobld.sql begin-----------------------
    --
    -- Copyright (c) Oracle Corporation 1988, 2000. All Rights Reserved.
    --
    -- NAME
    -- demobld.sql
    --
    -- DESCRIPTION
    -- This script. creates the SQL*Plus demonstration tables in the
    -- current schema. It should be STARTed by each user wishing to
    -- access the tables. To remove the tables use the demodrop.sql
    -- script.
    --
    -- USAGE
    -- From within SQL*Plus, enter:
    -- START demobld.sql

    SET TERMOUT ON
    PROMPT Building demonstration tables. Please wait.
    SET TERMOUT OFF

    DROP TABLE EMP;
    D