DMA使用说明
DMA(Oracle Data Migration Agent)是ORACLE编写的UNIX下一个比较方便的数据迁移工具,可以在export的同时进行import,适合比较大数据量的exp/imp,能比较好的缩短数据迁移的时间。它是使用UNIX的管道,split和压缩来实现。把整个export dump文件用管道分割并压缩为多个Chunk文件,然后FTP到Target DB来import,这样只要产生一个Chunk文件,import就可以立刻开始,这样就缩短了时间。其实我们也可以自己使用shell写出类似的脚本,Oracle的脚本写的比较漂亮,非常适合研究。总共有四个文件(DMAServer.sh,dmaserver.cfg,DMAClient.sh,dmaclient.cfg),分为脚本和配置文件。DMAServer.sh和dmaserver.cfg放在Target DB,用于import, DMAClient.sh和dmaclient.cfg放在Source DB用于export.
需要注意的是,默认方式都是full=y的export,import方式,如果想要使用owner或tables方式,可以手工修改DMAServer.sh,DMAClient.sh关于exp/imp的语句。
如果时间还想缩短J,可以分多个这样的脚本和配置文件,把tables或owner平均分配在这几个中,就还能提高速度,不过前提是你的机器能撑的住。
Client端启动方式./DMAClient.sh –c dmaclient.cfg
Server端启动方式./DMAServer.sh –c dmaserver.cfg
也可以放在后台执行
nohup ./DMAClient.sh –c dmaclient.cfg &
nohup ./DMAServer.sh –c dmaserver.cfg &
Client端和Server端的启动顺序没要求。
在启动之前要先用TESTMODE执行一下,检查一些前提条件,比如FTP状态,是否数据库是否为restrict模式,当然你也可以改脚本让其可以在正常open的情况下export,你想怎么样尽管去修改你想要的,呵呵。运行时会产生脚本的Log和export或import的log,在配置文件中都有定义。
以下是关于配置文件的说明,原来的注释已经很清楚了,不过我又加了些中文的解释J.
1.Client端配置文件说明
# Oracle Connect String to use
#连接信息
CONNECT_STRING="system/manager"
# Directory to store work files
#导出的文件存放位置
OUTPUT_DIRECTORY=/abc/tsrs2i/dump
# Compression type to use: b(zip2), g(zip), c(ompress)
#压缩方式,一般选择gzip
COMPRESSION_TYPE=g
# Transfer method to use: c(p), f(tp), s(cp), S(ftp), n(one)
#传输方式选择
TRANSFER_METHOD=f
# Host to transfer this to (if scp, ftp or sftp)
#FTP地址
TARGET_HOST=ftp01.oracle.com
# Username on remote machine (for ftp only)
#FTP用户名
TARGET_USERNAME=abcd
# Password on remote machine (for ftp only)
#FTP密码
TARGET_PASSWORD=abcd
# Target directory on the (possibly remote) machine
#FTP目录地址
TARGET_DIRECTORY=PPQSTI/incoming
# Logging level: 0-Severe only, 1-Severe,Error, 2-Severe,Error,Warning, 3-Severe,Error,Warning,Information
#日志级别
LOG_LEVEL=3
# Log file for this script's log - If not specified, this will go to stdout
#脚本的日志路径
LOG_FILE=/abc/tsrs2i/dump/dmaclient.log
# Buffer size to use in export (5M is default)
#Buffer大小
BUFFER_SIZE=104857600
# Chunk size to break the dump file into - This can be specified according to
# man split(1): E.g. 51240, 51240b, 100k, 70m. Check "man split" for
# capabilties of split
#CHUNK文件大小
CHUNK_SIZE=400000000
# Note: Setting KEEP_DUMPFILE=Y will store the dump file, however it will also
# slow down the process
#是否保留DUMP文件,N表示FTP成功后删除
KEEP_DUMPFILE=Y
# Chunk name - this should be shared between the client and server programs
#CHUNK名称
CHUNK_NAME=tsrs2i
# EXPARGS - These are any other arguments you want passed to the exp utility
#添加额外的export条件
EXPARGS="STATISTICS=none COMPRESS=n"
# TESTMODE - Set this to Y to ensure that the client does not actually run
# Instead, all pre-requisite checking is done and a message is printed prior
# to exit
#是否TESTMODE
TESTMODE=Y
# WORKING DIRECTORY - This can be set to ensure that the fifo is created in a
# different directory than the output. Useful for example when the output is
# nfs attached and does not support mknod/mkfifo properly
#管道文件的存放位置
WORKING_DIRECTORY=/abc/tsrs2i/dump
# MD5SUMS: Set this to Y if you would like md5 check sums of the compressed
# chunk files to be displayed in the dmaclient log
#是否启用MD5校验
MD5SUMS=N
2.Server端配置文件说明
# Oracle Connect String to use
#连接信息
CONNECT_STRING="sys/manager"
# Directory to get the chunk files from
#Dump file位置
INPUT_DIRECTORY=/abc/tsrs2i/dump
# Working directory to create fifo, log files etc.
#管道文件存放位置
WORKING_DIRECTORY=/abc/tsrs2i/import
# Logging level: 0-Severe only, 1-Severe,Error, 2-Severe,Error,Warning, 3-Severe,Error,Warning,Information
#日志级别
LOG_LEVEL=3
# Log file for this script's log
#脚本日志存放位置
LOG_FILE=/abc/tsrs2i/import/dumpdmaserver.log
# Buffer size to use in export (5M is default)
#Import BUFFER大小
BUFFER_SIZE=52428800
# Chunk name - this should be shared between the client and server programs
#CHUNK名称
CHUNK_NAME=tsrs2i
# IMPARGS - These are any other arguments you wish to pass to the imp utility
#添加你想要的import条件
IMPARGS=" commit=y"
# TESTMODE - Set this to Y to ensure that the server does not actually run
# Instead, all pre-requisite checking is done and a message is printed prior
# to exit
#是否TESTMODE
TESTMODE=Y
# CREATEDUMPFILE - This can be set to Y to make the server create the dump
# file from the chunk files, without running the imp command.
# MD5SUMS: Set this to Y if you would like md5 check sums of the compressed
# chunk files to be displayed in the dmaserver log
#是否使用MD5校验
MD5SUMS=N
#Y表示只产生DUMP文件而不发生import
CREATEDUMPFILE=N