设为首页 加入收藏

TOP

利用脚本建立scott模式(一)
2014-11-24 02:33:11 来源: 作者: 【 】 浏览:4
Tags:利用 脚本 建立 scott 模式

利用脚本建立scott模式
首先看下我的 数据库版本
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
www.2cto.com
1.利用脚本创建scott用户
要创建SCOTT演示表,步骤很简单。
10g版本: --需要验证
(1)cd $ORACLE_HOME/sqlplus/demo
(2)以任意用户身份连接后运行demobld.sql
demobld.sql会创建5个表并为其填入数据。执行结束后,它会自动退出SQL*Plus,所以运行完这个脚本后SQL*Plus窗口将消失,对此不要感到奇怪,这是正常的。
11g版本 --经测试
(1)cd &ORACLE_HOME/rdbms/admin
(2)以任意用户身份连接后运行utlsampl.sql
[oracle@elvis admin]$ pwd
/u01/oracle/product/11.2.0/dbhome_1/rdbms/admin
[oracle@elvis admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 13 10:41:21 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @utlsampl.sql
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@elvis admin]$
SQL> col username format a15;
SQL> set linesize 100;
SQL> select username,user_id,account_status from dba_users;
USERNAME USER_ID ACCOUNT_STATUS
--------------- ---------- --------------------------------
SYS 0 OPEN
SYSTEM 5 OPEN
SCOTT 61 OPEN
OUTLN 9 EXPIRED & LOCKED
FLOWS_FILES 57 EXPIRED & LOCKED
MDSYS 55 EXPIRED & LOCKED
ORDDATA 52 EXPIRED & LOCKED
ORDSYS 51 EXPIRED & LOCKED
ANONYMOUS 44 EXPIRED & LOCKED
EXFSYS 42 EXPIRED & LOCKED
DBSNMP 30 EXPIRED & LOCKED
USERNAME USER_ID ACCOUNT_STATUS
--------------- ---------- --------------------------------
WMSYS 32 EXPIRED & LOCKED
XDB 43 EXPIRED & LOCKED
APPQOSSYS 31 EXPIRED & LOCKED
ORDPLUGINS 53 EXPIRED & LOCKED
APEX_030200 60 EXPIRED & LOCKED
SI_INFORMTN_SCH 54 EXPIRED & LOCKED
EMA
DIP 14 EXPIRED & LOCKED
APEX_PUBLIC_USE 58 EXPIRED & LOCKED
R
USERNAME USER_ID ACCOUNT_STATUS
--------------- ---------- --------------------------------
ORACLE_OCM 21 EXPIRED & LOCKED
XS$NULL 2147483638 EXPIRED & LOCKED
21 rows selected.
2.在不使用脚本的情况下创建模式
如果你无法访问utlsampl.sql,可以使用以下脚本执行(也就是 系统自带的脚本贴出来了,哇哈哈) www.2cto.com
[oracle@elvis admin]$ cat utlsampl.sql
Rem Copyright (c) 1990, 2006, Oracle. All rights reserved.
Rem NAME
REM UTLSAMPL.SQL
Rem FUNCTION
Rem NOTES
Rem MODIFIED
Rem lburgess 04/02/06 - lowercase passwords
Rem menash 02/21/01 - remove unnecessary users for security reasons
Rem gwood 03/23/99 - make all dates Y2K compliant
Rem jbellemo 02/27/97 - dont connect as system
Rem akolk 08/06/96 - bug 368261: Adding date formats
Rem glumpkin 10/21/92 - Renamed from SQLBLD.SQL
Rem blinden 07/27/92 - Added primary and foreign keys to EMP and DEPT
Rem rl
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇数据库PL/SQL脚本语言函数学习笔记 下一篇oracle使用脚本创建数据表空间和..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: