DMA使用说明

DMA使用说明shell

DMA(Oracle Data Migration Agent)ORACLE编写的UNIX下一个比较方便的数据迁移工具,能够在export的同时进行import,适合比较大数据量的exp/imp,能比较好的缩短数据迁移的时间。它是使用UNIX的管道,split和压缩来实现。把整个export dump文件用管道分割并压缩为多个Chunk文件,而后FTPTarget DBimport,这样只要产生一个Chunk文件,import就能够马上开始,这样就缩短了时间。其实咱们也能够本身使用shell写出相似的脚本,Oracle的脚本写的比较漂亮,很是适合研究。总共有四个文件(DMAServer.shdmaserver.cfgDMAClient.shdmaclient.cfg),分为脚本和配置文件。DMAServer.shdmaserver.cfg放在Target DB,用于import, DMAClient.shdmaclient.cfg放在Source DB用于export.数据库

 

须要注意的是,默认方式都是full=yexport,import方式,若是想要使用ownertables方式,能够手工修改DMAServer.shDMAClient.sh关于exp/imp的语句。oracle

 

若是时间还想缩短J,能够分多个这样的脚本和配置文件,把tablesowner平均分配在这几个中,就还能提升速度,不过前提是你的机器能撑的住。工具

 

Client端启动方式./DMAClient.sh –c dmaclient.cfg大数据

Server端启动方式./DMAServer.sh –c dmaserver.cfgui

也能够放在后台执行this

nohup ./DMAClient.sh –c dmaclient.cfg &spa

nohup ./DMAServer.sh –c dmaserver.cfg &rest

Client端和Server端的启动顺序没要求。日志

在启动以前要先用TESTMODE执行一下,检查一些前提条件,好比FTP状态,是否数据库是否为restrict模式,固然你也能够改脚本让其能够在正常open的状况下export,你想怎么样尽管去修改你想要的,呵呵。运行时会产生脚本的Logexportimportlog,在配置文件中都有定义。

 

如下是关于配置文件的说明,原来的注释已经很清楚了,不过我又加了些中文的解释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