随笔 - 237  文章 - 0  评论 - 7  阅读 - 21万

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=用户名
posted on   洞幺人生  阅读(2150)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
历史上的今天:
2013-09-23 Oracle DataGuard 物理Standby 搭建(上)
2013-09-23 Oracle DataGuard 物理Standby 搭建(下)
2013-09-23 Oracle DataGuard搭建(二)
2013-09-23 Oracle DataGuard搭建(一)
2013-09-23 Linux 安装oracle10g 配置dataguard 介绍和步骤
2013-09-23 Oracle DataGuard数据备份方案详解
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示