Oracle相关操作总结1

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 ;   --基于主键的日志



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值