在Oracle数据库创建脚本中如何初始化某些表
Sample
表空间:IMPTEMP
表:Roles 、Users
通过PL/SQL导出的数据库脚本
-----------------------------------------------------
-- Export file for user IMPTEMP --
-- Created by Administrator on 2010-1-29, 14:14:25 --
-----------------------------------------------------
spool sample.log
prompt
prompt Creating table ROLES
prompt ====================
prompt
create table IMPTEMP.ROLES
(
ROLENAME NVARCHAR2(50) not null,
ROLEXML NCLOB
)
tablespace IMPTEMP
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
alter table IMPTEMP.ROLES
add constraint ROLES_PRIMARY_KEY primary key (ROLENAME)
using index
tablespace IMPTEMP
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
prompt
prompt Creating table USERS
prompt ====================
prompt
create table IMPTEMP.USERS
(
USERID NVARCHAR2(50) not null,
USERNAME NVARCHAR2(50),
ROLENAME NVARCHAR2(50),
PASSWORD NVARCHAR2(50),
USERXML NCLOB,
USERDN NVARCHAR2(100),
ISLOCAL NUMBER(1)
)
tablespace IMPTEMP
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
comment on column IMPTEMP.USERS.ISLOCAL
is '0-ISNOTLOCAL : 1-ISLOCAL';
alter table IMPTEMP.USERS
add constraint USERS_PRIMARY_KEY primary key (USERID)
using index
tablespace IMPTEMP
pctfree 10
initrans 2
相关文档:
经常有同事咨询oracle数据库字符集相关的问题,如在不同数据库做数据迁移、同其它系统交换数据等,常常因为字符集不同而导致迁移失败或数据库内数据变成乱码。现在我将oracle字符集相关的一些知识做个简单总结,希望对大家今后的工作有所帮助。
一、什么是oracle字符集
Oracle字符集是一个字节数据的解释的符号集 ......
今天删除的表空间包含物化视图报错,ORA-23515: 实体化视图和/或它们的索引存在于表空间中
看来是需要删除物化视图,执行删除操作,因为数据太大了,半天也没弄完,取消了,上网查另外一种方法,删除用户,指定cascade 参数,这样就可以了
我试了一下感觉用
drop user user_name cascade;
删除的还是挺快的,比删除物 ......
1. 在oracle 下创建表
t_user(
ID varchar(20),
Name varchar(20)
)
2. 添加数据
&nb ......
TO_DATE格式
Day:
dd number 12
dy abbreviated fri
day spelled out friday
ddspth spelled out, ordinal twelfth
Month:
mm number 03
mon abbreviated mar
month spelled out march
Year:
yy two digits 98  ......
Oracl 数据库也没有个半段表是否存在,存在则删除的语句,经过研究和改写他人的方法先隆重推出绝对能用性的Oracle判断表是否存在,存在则删除方法,在Oracle10g上试验通过。
方法
CREATE OR REPLACE FUNCTION PROC_NAME(T_NAME IN VARCHAR2) RETURN NUMBER IS
V_CNT number;
V_SQL VARCHAR2(100);
......