• oracle备份数据库


    oracle备份数据库

     
    1. 连接远程数据库
    打开cmd
    执行sqlplus/nolog
    执行connect 用户名/密码@IP:端口/服务名
    例:connect system/ETYY@114.116.211.102:1521/ETYY
    2. 创建directory,首先要保证存在该文件夹
    create directory 名字 as '路径';
    例:create directory expdir as 'E:\expdir';
    3. 授权
    grant read,write on directory expdir to 用户;
    例:grant read,write on directory expdir to yl_etyy;
    4. 执行导出
        1)exp 用户名/密码@IP:端口/服务名 file=路径:文件名 owner=(用户),只导出该用户下的表
        例:exp yl_etyy/sx_etyy@114.116.211.102:1521/ETYY file=E:\20220224.dmp owner=(yl_etyy)
        2)expdp 用户名/密码@IP:端口/服务名 schemas=用户名 directory=expdir dumpfile=文件名
        例:expdp yl_etyy/sx_etyy@114.116.211.102:1521/ETYY schemas=yl_etyy directory=expdir dumpfile=20220224.dmp
    说明:第二种方式在远程备份的时候执行报错了,错误信息:

    连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Pr

    With the Partitioning, OLAP, Data Mining and Real Application Testing

    ORA-39002: 操作无效

    ORA-39070: 无法打开日志文件。

    ORA-29283: 文件操作无效

    ORA-06512: 在 "SYS.UTL_FILE", line 488

    ORA-29283: 文件操作无效等类似的错误。

    网上查询资料解释是:expdp只能在服务器端执行,在客户端执行会出现上述错误

    参考另一篇笔记:expdp,impdp导出导入远程数据库到本地

    5. oracle导出导入指定表

    从源数据库导出:

    exp user1/pwd@server1 file=c:\temp\exp.dmp tables=(table1, table2)
    导入到目标数据库:

    imp user2/pwd@server2 file=c:\temp\exp.dmp tables=(table1, table2)

    导入到指定用户下:
    imp user/pwd@IP:端口/服务名 file=c:\temp\exp.dmp fromuser=用户名 touser=用户名
  • 相关阅读:
    在网页中实现截屏粘贴的功能
    CSS3 @font-face 做自定义图标
    Visual Studio报错一箩筐(持续更新)
    Axure实现vcg官网首页原型图
    Axure实现bootstrap首页线框图
    Web第一天——准备篇
    vue动态加载组件
    组件封装之将代码放到npm上
    node连接mysql生成接口,vue通过接口实现数据的增删改查(二)
    autoCAD2007 快捷键 标注
  • 原文地址:https://www.cnblogs.com/fhuafeng/p/16722161.html
Copyright © 2020-2023  润新知