oracle 10g 手动创建scott(tiger) schema
转自:http://cnhtm.itpub.net/post/39970/496967
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;
DROP TABLE DEPT;
DROP TABLE BONUS;
DROP TABLE SALGRADE;
DROP TABLE DUMMY;
CREATE TABLE EMP
(EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDAT
相关文档:
通过 select * from table whereid=16701 for update 锁住一张表
通过以下语句可查询出被锁住的对象
SELECT OBJECT_ID,
SESSION_ID,
SERIAL#,
ORACLE_USERNAME,
&nb ......
Oracle 数据类型及存储方式
袁光东 原创
概述
通过实例,全面而深入的分析oralce的基本数据类型及它们的存储方式。以ORACLE 10G为基础,介绍oralce
10g引入的新的数据类型。让你对or ......
2010-04-21 14:04
oracle中构造数组的例子:
declare
type t_varray is varray(4) of number;
arr t_varray;
begin
arr := t_varray(1,2,3,4);
for i in 1..arr.count loop
dbms_output.put_line(arr(i));
end loop;
end;
构造二维数组的例子:
declare
type t_varray ......
什么是合并多行字符串(连接字符串)呢,例如:
SQL> desc test;
Name Type Nullable Default Comments
------- ------------ -------- ------- --------
COUNTRY VARCHAR2(20) Y
CITY VARCHAR2(20) Y
SQL> select * from test;
COUNTRY CITY
-------------------- --------------------
中国 台北
中国 香 ......
商业和数据库很多时候必须跨时区工作,从9i开始,oracle环境开始有了时区意识,通过指定数据库的时区和使用TIMESTAMP WITH TIME ZONE和TIMESTAMP WITH LOCAL TIME ZONE数据类型来实现该功能。
TIMESTAMP WITH TIME ZONE不会存储数据库时区,但是有一个指示用来说明该时间所使用的时区。TIMESTAMP WITH LOCAL TIME ZONE会同 ......