WEB开发网
开发学院数据库Oracle Oracle利用脚本建立scott模式 阅读

Oracle利用脚本建立scott模式

 2012-10-13 21:18:23 来源:WEB开发网   
核心提示:首先看下我的数据库版本SQL> select * from v$version;BANNEROracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionPL/SQL Release 11.2.0.1.0 - ProductionCOR

首先看下我的数据库版本
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
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
[[email protected] admin]$ pwd
/u01/oracle/product/11.2.0/dbhome_1/rdbms/admin
[[email protected] 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
[[email protected] 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,可以使用以下脚本执行(也就是系统自带的脚本贴出来了,哇哈哈)

1 2 3  下一页

Tags:Oracle 利用 脚本

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接