在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
相关文档:
今天删除的表空间包含物化视图报错,ORA-23515: 实体化视图和/或它们的索引存在于表空间中
看来是需要删除物化视图,执行删除操作,因为数据太大了,半天也没弄完,取消了,上网查另外一种方法,删除用户,指定cascade 参数,这样就可以了
我试了一下感觉用
drop user user_name cascade;
删除的还是挺快的,比删除物 ......
本人以前整理的数据库文件迁移过程,希望能够对大家有所帮助
1、sqlplus "sys/sys@服务名 as sysdba"
2、修改控制文件:
alter system set control_files='E:\oracle\oradata\myOracle_1\control01.ctl',
'E:\oracle\oradata\myOracle_1\control02.ctl','E:\oracle\oradata\my ......
如何远程判断Oracle数据库的安装平台
select * from v$version;
查看表空间的使用情况
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTE ......
SQL> select * from ta;
ID NAME
---------- --------------------
1 gorey
2 gorey2
SQL> select * from tb;
I ......