一、EXP实现逻辑备份
EXP/IMP是Oracle比较传统的数据库逻辑备份工具,实现全库或表空间的逻辑备份,不支持用户的交互模式,基于客户端。
EXP导出方式
a)传统路径方式:采用SQL语句把要导出的表的数据检索出来,通过网络将这些数据传输到客户端,并生成转储文件。既然是SQL语句的方式,就需要在shared_pool中解析生成执行计划以后,将数据缓存到buffer中,然后传到客户端,该方式是默认的导出方式。
b)直接路径方式:直接获得数据块,并绕过shared_pool和buffer cache,将数据块里的数据直接抽出来后直接传递到客户端上,速度较快。导出时需加上direct=y,有一些限制,不能导出含有LOB,BFILE等大对象的表。
EXP指令
在Windows平台,可以输入EXP HELP=Y,查看帮助信息。
D:\backup>exp help=y
Export: Release 11.2.0.1.0 - Production on Tue Jun 27 09:06:54 2017
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
You can let Export prompt you for parameters by entering the EXP
command followed by your username/password:
Example: EXP SCOTT/TIGER
Or, you can control how Export runs by entering the EXP command followed
by various arguments. To specify parameters, you use keywords:
Format: EXP KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
Example: EXP SCOTT/TIGER GRANTS=Y TABLES=(EMP,DEPT,MGR)
or TABLES=(T1:P1,T1:P2), if T1 is partitioned table
USERID must be the first parameter on the command line.
Keyword Description (Default) Keyword Description (Default)
--------------------------------------------------------------------------
USERID username/password FULL export entire file (N)
BUFFER size of data buffer OWNER list of owner usernames
FILE output files (EXPDAT.DMP) TABLES list of table names
COMPRESS import into one extent (Y) RECORDLENGTH length of IO record
GRANTS export grants (Y) INCTYPE incremental export type
INDEXES export indexes (Y) RECORD track incr. export (Y)
DIRECT direct path (N) TRIGGERS export triggers (Y)
LOG log file of screen output STATISTICS analyze objects (ESTIMATE)
ROWS export data rows (Y) PARFILE parameter filename
CONSISTENT cross-table consistency(N) CONSTRAINTS export constraints (Y)
OBJECT_CONSISTENT transaction set to read only during object export (N)
FEEDBACK display progress every x rows (0)
FILESIZE maximum size of each dump file
FLASHBACK_SCN SCN used to set session snapshot back to
FLASHBACK_TIME time used to get the SCN closest to the specified time
QUERY select clause used to export a subset of a table
RESUMABLE suspend when a space related error is encountered(N)
RESUMABLE_NAME text string used to identify resumable statement
RESUMABLE_TIMEOUT wait time for RESUMABLE
TTS_FULL_CHECK perform full or partial dependency check for TTS
TABLESPACES list of tablespaces to export
TRANSPORT_TABLESPACE export transportable tablespace metadata (N)
TEMPLATE template name which invokes iAS mode export
Export terminated successfully without warnings.
D:\backup>
演示基于EXP的数据导出
1)EXP导出整个数据库