加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle数据导入导出,定时备份

发布时间:2020-12-12 15:48:48 所属栏目:百科 来源:网络整理
导读:导出数据命令行 文件 expdata.bat parfile指向expdata.par文件 exp parfile=D:expexpdata.par file=txgl.dmp filesize=600M log=dl.log 文件expdata.par a target=_blank href="mailto:userid=txgl/123456@ZZSorcl"userid=txgl/123456@ZZSorcl/abuffer=819
  1. 导出数据命令行
    文件 expdata.bat parfile指向expdata.par文件
    exp parfile=D:expexpdata.par file=txgl.dmp filesize=600M log=dl.log

    文件expdata.par
    <a target=_blank href="mailto:userid=txgl/123456@ZZSorcl">userid=txgl/123456@ZZSorcl</a>
    buffer=8192000
    compress=n
    grants=n
  2. 导入数据
    文件impdata.bat
    imp system/password@orcl fromuser=sntap touser=snt parfile=impdata.par


    文件impdata.par
    file=oraclebak.dmp
    buffer=2048000
    ignore=n
    commit=y

  3. 导入数据 不写par
    imp system/password@orcl fromuser=from_user touser=to_user file=E:testbaktest.dmp log=E:testbaktest.log buffer=2048000 ignore=y commit=y

    如果是不同的表空间,touser要一个权限,不然clob类型字段的表会出错:GRANT UNLIMITED TABLESPACE TO TO_USER

  4. Windows定时备份
    新建bat文件 内容:
    @echo off   
    echo 正在备份 Oracle 数据库,请稍等......   
    set riqi=%date:~0,4%%date:~5,2%%date:~8,2%
    exp system/password@orcl file=E:oraclebakoraclebak%riqi%.dmp log=F:oraclebakoraclebak%riqi%.log buffer=960000  
    echo 任务完成!
    echo 开始清理备份文件
    forfiles /p "E:oraclebak" /s /m *.* /d -6 /c "cmd /c del @path"

    在window计划任务里面添加定时任务,设置备份的间隔时间,每天执行的时间,在“操作”选项卡里面选择新建好的bat文件。“常规”选项卡里面选择“不管用户是否登录都要运行”


------------------------------------------------------------------------------------------------------------------------------------------- 创建Oracle用户:
create user newuser
  identified by "password"
  --default tablespace TBS_DATA01 
  --temporary tablespaceTBS_DATA01_temp 
  profile DEFAULT
  --表空间
  quota unlimited on newuser;
-- Grant/Revoke role privileges
--用户
grant connect to newuser;
-- Grant/Revoke system privileges
grant create any index to newuser;
grant create any sequence to newuser;
grant create any table to newuser;
grant create any trigger to newuser;
grant create any view to newuser;
grant create procedure to newuser;
grant select any dictionary to newuser;
grant select any sequence to newuser;
GRANT UNLIMITED TABLESPACE TO newuser;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读