oracle数据库的备份与恢复

来源:互联网 发布:钉宫骂观众 知乎 编辑:程序博客网 时间:2024/05/16 17:29
数据库的备份与恢复
一.逻辑备份与恢复
逻辑备份时指使用工具export将数据对象的结构和数据导出到文件的过程,逻辑恢复时指当数据库对象被误删操作而
损坏后使用工具import利用备份的文件吧数据对象导入到数据库的过程。
逻辑备份和恢复只能在open的状态下进行。
1.导出
1)导出表(导出时,要到oracle的bin目录下)
导出表,导出方案,导出数据库
导出使用exp命令来完成的
<1>导出自己的表
exp userid=scott/Changeme_123@orcl tables=(emp) file=d:\1.dmp  (导出成什么文件都可以)
<2>导出其他方案的表(需要dba的权限)
exp userid=system/Changeme_123@orcl tables=(scott.emp) file=d:\1.dmp  
<3>导出表结构
exp userid=system/Changeme_123@orcl tables=(scott.emp) file=d:\1.dmp rows=n
<4>直接导出表,比常规导出要快
exp userid=system/Changeme_123@orcl tables=(scott.emp) file=d:\1.dmp direct=y
2)导出方案
<1>导出自己的方案
exp userid=scott/Changeme_123@orcl owner=scott file=d:\1.dmp  
<2>导出其他方案(需要dba的权限)
exp userid=system/Changeme_123@orcl owner=(system,scott) file=d:\1.dmp  
3)导出数据库
exp userid=system/Changeme_123@orcl full=y inctype=complete file=d:\1.dmp


2.导入
1)导入表
<1>导入自己的表
imp userid=scott/Changeme_123@orcl tables=(emp) file=d:\1.dmp  (导出成什么文件都可以)
<2>导入其他方案的表(需要dba的权限)
imp userid=system/Changeme_123@orcl tables=(scott.emp) file=d:\1.dmp  touser=scott
<3>导入表结构
imp userid=system/Changeme_123@orcl tables=(scott.emp) file=d:\1.dmp rows=n
<4>导入数据
imp userid=system/Changeme_123@orcl tables=(scott.emp) file=d:\1.dmp ignore=y
2)导入方案
<1>导入自己的方案
imp userid=scott/Changeme_123@orcl file=d:\1.dmp  
<2>导入其他方案(需要dba的权限)
imp userid=system/Changeme_123@orcl file=d:\1.dmp fromuser=system touser=scott
3)导入数据库
imp userid=system/Changeme_123@orcl full=y file=d:\1.dmp
原创粉丝点击