1、数据库导入导出
1).进入DOS模式
2.)导出数据库
exp username/password@servname owner=username indexes=y file=d:/export.dmp
将username用户下的酷导出为dmp文件备份。
3).导入数据库
imp username/password@servname full=y indexes=y 回车
输入dmp文件所在位置,回车
2、oracle用户创建及授权
1).创建新用户
create user username identified by password;
2).授权管理
grant create table, create view, create procedure, create materialized view, create index, create sequence, create session, create database link, unlimited tablespace to username;
grant insert any table to user;
grant select any table to user;
grant update any table to user;
grant delete any table to user;
grant dba to user;
3.oracle 下创建dblink
create database link linkName use 用户名 identified by 密码 using 远程数据库名;
例如:
create database link link名 connect to sims20_js identified by sims20_js using 'ora10g';
使用dblink 方法:
select * from tableName@dblinkName;
4.创建物化视图
普通视图仅仅是临时查找数据库相关表组成的一个假表,而物化视图则为一个真实存在的表,他是占物理内存的。物化视图的数据与真实表的数据相关联,视图内数据的更新有删除和插入行为(隐世,非人为操作,当然人为的删除也允许)。
create materialized view vv_ivr_sp_analysis_coop
refresh ON DEMAND start with sysdate
next sysdate + 1/86400 --自动刷新时间 单位:天
with primary key
as
select
t.sp_code,
t.access_code,
decode(t.sp_type_id, '2', '短信', '4', '彩信', '9', 'IVR') sp_type_name,
c.cn_name,
t.income,
t.check_month,
t.sp_type_id,
t.target_sims_id,
t.sims_id,
t.idx_1,
t.idx_2,
t.idx_3,
t.idx_4,
t.idx_5,
t.idx_6,
t.idx_7,
t.idx_8,
t.idx_9
from v_ivr_sp_analysis_coop t, company c, sp sp
where t.sp_code = sp.sp_code
and t.sp_type_id = sp.sp_type_id
and sp.company_id = c.company_id
;
-- 物化视图刷新日志
create materialized view log on COOPERATE_ANALYSIS_SERV_INFO ; --基于主键的日志