在很多时候,我们需要对数据文件的头部进行分析,但是因为人不在本地,数据文件本身很大,网络又不好.这个时候我们可能要求对方传过来文件文件的头部几M即可.在unix/linux中可以使用dd实现该需求;在win中可以使用ocopy实现该需求.dd实现请参考:dd操作数据文件;这里讲win下面实现方法:
ocopy语法
D:\>ocopy
OCOPY v2.0 - Copyright 1989-1993 Oracle Corp. All rights reserved.
Usage:
ocopy from_file [to_file [a | size_1 [size_n]]]
ocopy -b from_file to_drive
ocopy -r from_drive to_dir
ocopy拷贝数据文件header
D:\>ocopy E:\oracle\oradata\xifenfei\SYSAUX01.DBF d:\sysaux.dbf 20480 1
D:\SYSAUX.DBF
OCOPY - Write error.
--忽略(未找到原因)
D:\>dir sysaux*
驱动器 D 中的卷没有标签。
卷的序列号是 000B-FBCB
D:\ 的目录
2012/05/07 22:28 1,024 SYSAUX.DB2
2012/05/07 22:28 1,024 SYSAUX.DB3
2012/05/07 22:28 1,024 SYSAUX.DB4
2012/05/07 22:28 1,024 SYSAUX.DB5
2012/05/07 22:28 1,024 SYSAUX.DB6
2012/05/07 22:28 1,024 SYSAUX.DB7
2012/05/07 22:28 1,024 SYSAUX.DB8
2012/05/07 22:28 1,024 SYSAUX.DB9
2012/05/07 22:28 20,971,520 SYSAUX.DBF
9 个文件 20,979,712 字节
0 个目录 28,771,282,944 可用字节
--SYSAUX.DBF是我们需要的文件
上传到linux中bbed验证
[oracle@xifenfei ~]$ bbed
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Fri May 25 08:31:12 2012
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set filename '/home/oracle/sysaux.dbf'
FILENAME /home/oracle/sysaux.dbf
BBED> set blocksize 8192
BLOCKSIZE 8192
--从win中拷贝的数据库,第一个block非bbed有效块
BBED> set block 2
BLOCK# 2
BBED> map
File: /home/oracle/sysaux.dbf (0)
Block: 2 Dba:0x00000000
------------------------------------------------------------
Data File Header
struct kcvfh, 360 bytes @0
ub4 tailchk @8188
BBED> map /v
File: /home/oracle/sysaux.dbf (0)
Block: 2 Dba:0x00000000
------------------------------------------------------------
Data File Header
struct kcvfh, 360 bytes @0
struct kcvfhbfh, 20 bytes @0
struct kcvfhhdr, 76 bytes @20
ub4 kcvfhrdb @96
struct kcvfhcrs, 8 bytes @100
ub4 kcvfhcrt @108
ub4 kcvfhrlc @112
struct kcvfhrls, 8 bytes @116
ub4 kcvfhbti @124
struct kcvfhbsc, 8 bytes @128
ub2 kcvfhbth @136
ub2 kcvfhsta @138
struct kcvfhckp, 36 bytes @140
ub4 kcvfhcpc @176
ub4 kcvfhrts @180
ub4 kcvfhccc @184
struct kcvfhbcp, 36 bytes @188
ub4 kcvfhbhz @224
struct kcvfhxcd, 16 bytes @228
word kcvfhtsn @244
ub2 kcvfhtln @248
text kcvfhtnm[30] @250
ub4 kcvfhrfn @280
struct kcvfhrfs, 8 bytes @284
ub4 kcvfhrft @292
struct kcvfhafs, 8 bytes @296
ub4 kcvfhbbc @304
ub4 kcvfhncb @308
ub4 kcvfhmcb @312
ub4 kcvfhlcb @316
ub4 kcvfhbcs @320
ub2 kcvfhofb @324
ub2 kcvfhnfb @326
ub4 kcvfhprc @328
struct kcvfhprs, 8 bytes @332
struct kcvfhprfs, 8 bytes @340
ub4 kcvfhtrt @356
ub4 tailchk @8188
--数据块拷贝出来正常