-oracle数据库恢复-Raid5数据恢复-RAID0数据恢复oracle 开发区 → JDUL源代码


  共有1887人关注过本帖树形打印

主题:JDUL源代码

oracle数据恢复-RAID5数据恢复-raid数据恢复
sosdb
  1楼 个性首页 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


数据恢复 恢复数据
等级:超级版主 帖子:809 积分:10386 威望:0 精华:1 注册:2007-1-28 11:50:49
JDUL源代码  发帖心情 Post By:2007-4-25 11:03:15

public abstract class OracleBlock
{
public static final int FORMAT_V7  = 0x01;
public static final int FORMAT_V8  = 0x02;
public static final int FORMAT_V9  = 0x02;

public static final int ROW_CLUSTER_KEY   = 0x80;
public static final int ROW_CTABLE_NUMBER = 0x40;
public static final int ROW_HEAD_PIECE   = 0x20;
public static final int ROW_DELETED_ROW   = 0x10;
public static final int ROW_FIRST_PIECE   = 0x08;
public static final int ROW_LAST_PIECE    = 0x04;
public static final int ROW_FROM_PREVIOUS = 0x02;
public static final int ROW_CONTINUE_NEXT = 0x01;
public static final int ROW_SINGLE        =
  ROW_HEAD_PIECE + ROW_FIRST_PIECE + ROW_LAST_PIECE;
public static final int ROW_CLUSTER       =
  ROW_CLUSTER_KEY + ROW_HEAD_PIECE + ROW_FIRST_PIECE + ROW_LAST_PIECE;
public static final int ROW_HASH_CLUSTER  =
  ROW_CLUSTER + ROW_FROM_PREVIOUS + ROW_CONTINUE_NEXT;

public static final int BLOCK_BLANK        = 0x00;
public static final int BLOCK_KUNDO_HEADER = 0x01;
public static final int BLOCK_KUNDO_BLOCK  = 0x02;
public static final int BLOCK_SUNDO_HEADER = 0x03;
public static final int BLOCK_SUNDO_BLOCK  = 0x04;
public static final int BLOCK_SEG_HEADER   = 0x05;
public static final int BLOCK_DATA         = 0x06;
public static final int BLOCK_TEMP      = 0x07;
public static final int BLOCK_SORT_KEY    = 0x09;
public static final int BLOCK_SORT_RUN     = 0x0a;
public static final int BLOCK_FILE_HEADER  = 0x0b;
public static final int BLOCK_FLGSEG_HEADER= 0x0c;
public static final int BLOCK_COMPATIBILITY= 0x0d;
public static final int BLOCK_UUNDO_HEADER = 0x0e;
public static final int BLOCK_USUNDO_HEADER= 0x0f;
public static final int BLOCK_USEG_HEADER  = 0x10;
public static final int BLOCK_UFLGSEG_HEADER=0x11;
public static final int BLOCK_EXTENT_MAP   = 0x12;
public static final int BLOCK_CONTROL_FILE = 0x15;
public static final int BLOCK_BMPSEG_HEADER= 0x17;
public static final int BLOCK_BMPFREE_LIST = 0x18;
public static final int BLOCK_BITMAP_INDEX = 0x19;
public static final int BLOCK_BITMAP_DATA  = 0x1a;
public static final int BLOCK_LOB_DATA     = 0x1b;

public static final int DATA_TYPE_DATA = 0x01;
public static final int DATA_TYPE_INDEX= 0x02;

public static final int TRANSACTION_COMMITED = 0x08;
public static final int TRANSACTION_UPBOUND  = 0x02;
public static final int TRANSACTION_ACTIVE   = 0x01;

public static final int ORACLE_VARCHAR2 = 1;
public static final int ORACLE_NUMBER   = 2;
public static final int ORACLE_LONG     = 8;
public static final int ORACLE_VARCHAR  = 9;
public static final int ORACLE_DATE     = 12;
public static final int ORACLE_RAW      = 23;
public static final int ORACLE_LONG_RAW = 24;
public static final int ORACLE_CHAR     = 96;
public static final int ORACLE_BINARY_FLOAT = 100;
public static final int ORACLE_BINARY_DOUBLE= 101;
public static final int ORACLE_CLOB     = 112;
public static final int ORACLE_BLOB     = 113;
public static final int ORACLE_BFILE    = 114;
public static final int ORACLE_CFILE    = 115;
public static final int ORACLE_TIME     = 178;
public static final int ORACLE_TIME_TZ  = 179;
public static final int ORACLE_TIMESTAMP= 180;
public static final int ORACLE_TIMESTAMP_TZ = 181;
public static final int ORACLE_TIMESTAMP_LTZ = 231;
public static final int ORACLE_INTERVAL_YEAR = 182;
public static final int ORACLE_INTERVAL_DAY  = 183;

protected static char _HEX_ARRAY[] = {'0','1','2','3','4','5','6'
   ,'7','8','9','a','b','c','d','e','f'};

protected String _field_sep   = ",";
protected int   _block_size   = 8192;
protected byte  _block_buf[]  = new byte[8192];
protected int   _column_type[]  = null;
protected OracleDumpConfig _dump_config = null;
private   StringBuffer temp = new StringBuffer();
protected java.io.PrintWriter   _output_file = new java.io.PrintWriter(System.out);
protected   int _fid = -1;
protected   int _bno = -1;

public final void setDumpConfig(OracleDumpConfig odcfg)
{
  _dump_config = odcfg;
}

public final void setOutputFile(java.io.PrintWriter _out)
{
  if (_out != null)
   _output_file = _out;
}

public final int getDataFileID(int rdba)
{
  return (0x3FF & (rdba >> 22));
}

public final int getDataBlockID(int rdba)
{
  return (rdba & 0x3FFFFF) ;
}

public final void setFieldSeperator(String sep)
{
  if (sep != null)
   _field_sep = sep;
}

public final String getFieldSeperator()
{
  return _field_sep;
}

public final java.io.PrintWriter getOutputFile()
{
  return _output_file;
}

public final int getBlockSize()
{
  return _block_size;
}
public final void setBlockSize(int bs)
{
  if (bs == 2048 || bs == 4096 || bs == 8192 ||
      bs == 16384 || bs == 32768)
  {
   if (bs != _block_size)
   {
    _block_size = bs;
    _block_buf  = new byte[_block_size];
   }
  }
}
public final void setColumnType(int coltypes[])
{
  _column_type = coltypes;
}

public final static int getColumnType(String type)
{
  if (type == null)
   return ORACLE_RAW;
  if (type.equalsIgnoreCase("VARCHAR2"))
   return ORACLE_VARCHAR2;
  else if (type.equalsIgnoreCase("NUMBER"))
   return ORACLE_NUMBER;
  else if (type.equalsIgnoreCase("VARCHAR"))
   return ORACLE_VARCHAR;
  else if (type.equalsIgnoreCase("DATE"))
   return ORACLE_DATE;
  else if (type.equalsIgnoreCase("RAW"))
   return ORACLE_RAW;
  else if (type.equalsIgnoreCase("LONG"))
   return ORACLE_LONG;
  else if (type.equalsIgnoreCase("LONGRAW"))
   return ORACLE_LONG_RAW;
  else if (type.equalsIgnoreCase("CHAR"))
   return ORACLE_CHAR;
  else if (type.equalsIgnoreCase("TIMESTAMP"))
   return ORACLE_TIMESTAMP;
  else if (type.equalsIgnoreCase("BINARY_FLOAT"))
   return ORACLE_BINARY_FLOAT;
  else if (type.equalsIgnoreCase("BINARY_DOUBLE"))
   return ORACLE_BINARY_DOUBLE;
  else
   return ORACLE_RAW;
}

public final boolean readBlock(int rdba)
  throws java.io.IOException
{
  int file_id = getDataFileID(rdba);
  int block_id = getDataBlockID(rdba);
  if (_dump_config == null) return false;
  java.io.RandomAccessFile raf = _dump_config.getRandomAccessFile(file_id);
  if (raf != null)
  {
   readBlock(raf,block_id);
   return true;
  }
  return false;
}
public final boolean readBlock(int file_id, int block_id)
  throws java.io.IOException
{
  if (_dump_config == null) return false;
  java.io.RandomAccessFile raf = _dump_config.getRandomAccessFile(file_id);
  if (raf != null)
  {
   readBlock(raf,block_id);
   return true;
  }
  return false;
}
public final boolean readBlock(OracleDumpConfig odcfg, int file_id, int block_id)
  throws java.io.IOException
{
  java.io.RandomAccessFile raf = odcfg.getRandomAccessFile(file_id);
  if (raf != null)
  {
   if (file_id == _fid && block_id == _bno + 1)
   {
    _fid = -1;
    _bno = -1;
    raf.readFully(_block_buf,0,_block_size);  
    _fid = file_id;
    _bno = block_id;
   }
   else
   {
    _fid = -1;
    _bno = -1;
    readBlock(raf,block_id);
    _fid = file_id;
    _bno = block_id;
   }
   return true;
  }
  return false;
}
public final void readBlock(java.io.RandomAccessFile raf,int offset)
  throws java.io.IOException
{
  raf.seek((long)(offset) * (long)(_block_size));
  raf.readFully(_block_buf,0,_block_size);  
}

public final String getStringAddress(int addr)
{
  char _buf[] = new char[8];
  _buf[0] = _HEX_ARRAY[(addr >> 28) & 0x0f];
  _buf[1] = _HEX_ARRAY[(addr >> 24) & 0x0f];
  _buf[2] = _HEX_ARRAY[(addr >> 20) & 0x0f];
  _buf[3] = _HEX_ARRAY[(addr >> 16) & 0x0f];
  _buf[4] = _HEX_ARRAY[(addr >> 12) & 0x0f];
  _buf[5] = _HEX_ARRAY[(addr >> 8) & 0x0f];
  _buf[6] = _HEX_ARRAY[(addr >> 4) & 0x0f];
  _buf[7] = _HEX_ARRAY[(addr) & 0x0f];
  return String.valueOf(_buf);
}

public abstract OracleBlock createBlock();
public abstract int getBlockType();
public abstract int getFormat();
public abstract int getDataFileID();
public abstract int getDataBlockID();
public abstract String getDataBlockAddress();
public abstract String getDataBlockTail();
public abstract int getDataObjectID();
public abstract String getSCNBase();
public abstract String getSCNWrap();
public abstract int    getBlockSequence();
public abstract int    getBlockFlag();
public abstract String getCheckValue();
public abstract String getCleanSCN();
public abstract int getITLNumber();
public abstract int getITLRecordSize();
public abstract int getDataType();

public abstract String getITLXID(int itlno);
public abstract String getITLUBA(int itlno);
public abstract String getITLFlag(int itlno);
public abstract int getITLStatus(int itlno);
public abstract int getITLLock(int itlno);
public abstract String getITLSCN(int itlno);
public abstract String getITLFSC(int itlno);

public abstract int getDataFlag();
public abstract int getITLEndOffset();
public abstract int getTableCount();
public abstract int getRecordCount();
public abstract int getFirstFreeRowEntry();
public abstract int getFreeSpaceBeginOffset();
public abstract int getFreeSpaceEndOffset();
public abstract int getAvailSpace();
public abstract int getTotalSpace();
public abstract int getTableRowCount(int tno);
public abstract int getTableRowOffset(int tno,int row);

// Index Block
/*
  -- Non IOT Leaf Block
  kdxcolev  = 1 byte
  kdxcolok  = 1 byte
  kdxcoopc  = 1 byte (opcode=0: iot flags=--- is converted=Y)
  kdxconco  = 1 byte
  kdxcosdc  = 4 bytes
  kdxconro  = 2 bytes
  kdxcofbo  = 2 bytes
  kdxcofeo  = 2 bytes
  kdxcoavs  = 2 bytes
*/

public abstract int getIndexHeaderAddress();
public abstract int getIndexColev();
public abstract int getIndexColok();
public abstract int getIndexCoopc();
public abstract int getIndexOpcode();
public abstract int getIndexColumnCount();
public abstract int getIndexCosdc();
public abstract int getIndexRowCount();
public abstract int getIndexFreeSpaceBegin();
public abstract int getIndexFreeSpaceEnd();
public abstract int getIndexFreeSpace();
public abstract int getIndexOffset(int row);

/*
  // Branch block
  kdxbrlmc  = 4 bytes
  kdxbrsno  = 4 bytes
  kdxbrbksz = 4 bytes
*/
public abstract int getIndexBrlmc();
public abstract int getIndexBrsno();
public abstract int getIndexBrbksz();
/*
  // Leaf block
  kdxlespl  = 2 bytes
  kdxlende  = 2 bytes
  kdxlenxt  = 4 bytes (16777252=0x1000024)
  kdxleprv  = 4 bytes
  kdxledsz  = 4 bytes
  kdxlebksz = 4 bytes
*/
public abstract int getIndexLespl();
public abstract int getIndexLende();
public abstract int getIndexLenxt();
public abstract int getIndexLeprv();
public abstract int getIndexLedsz();
public abstract int getIndexLebksz();

// Data File Header
public abstract String getSoftwareVersion(); //0x14 - 0x17
public abstract String getCompatibleVersion(); //0x18 - 0x1b
public abstract long    getDBIDInt(); // 0x1c - 0x1f
public abstract String getDBIDHex(); // 0x1c - 0x1f
public abstract String getDatabaseName(); //0x20 - 0x27
public abstract int getControlSeq(); //0x28 - 0x2b
public abstract int getBlockCount(); //0x2c - 0x2f
public abstract int getDBBlockSize(); //0x30 - 0x21
public abstract int getFileNumber();  //0x34 - 0x35
public abstract int getFileType();    //0x36 - 0x37
public abstract int getTablespaceID();  //0xf4 - 0xf7
public abstract String getTablespaceName(); // 0xf8 -0xf9 -- len 0xfa - length;

// Segment Header Function
public abstract int getSegExtentCount();  // 0x24 - 0x27
public abstract int getSegBlockCount();   // 0x28 - 0x2B
// 0x6c + extid * 8 + 0x00 - 0x03
public abstract int getSegExtentRDBA(int extid);
// 0x6c + extid * 8 + 0x04 - 0x07
public abstract int getSegExtentBlocks(int extid);
    public abstract int getSegNextMapRDBA();  // 0x60 - 0x63
public abstract int getSegMapFlag();      // 0x68 - 0x6B
public abstract int getSegFLGBlocks();    // 0x48 - 0x4b
public abstract int getSegFLGBellow();    // 0x4c - 0x4f
public abstract int getSegHWMAddress();    //0x3c - 0x3f
public abstract int getSegHWMExtent();    // 0x31 - 0x33
public abstract int getSegHWMBlocks();    // 0x34 - 0x37
public abstract int getSegHWMExtSize();   // 0x38 - 0x3b
public abstract int getSegNextMAP();      // 0x40 - 0x44
public abstract int getBlockExtentCount(); // 0x5c - 0x5f


[此贴子已经被作者于2007-6-12 9:52:32编辑过]



www.sosdb.com 专业数据库恢复

oracle数据恢复raid数据恢复

qq:9417901

msn:glkgdj@hotmail.com

支持(0中立(0反对(0单帖管理 | 引用 | 回复 回到顶部
oracle数据恢复-RAID5数据恢复-raid数据恢复
sosdb
  2楼 个性首页 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


数据恢复 恢复数据
等级:超级版主 帖子:809 积分:10386 威望:0 精华:1 注册:2007-1-28 11:50:49
  发帖心情 Post By:2007-4-25 11:04:00

public String convertNUMBER(byte buf[],int start,int len)
{
int num_sign = ((int)0x80 & buf[start]) >> 7;
int digit_count = ((int)0xff & buf[start]);
if (num_sign == 0x01 && digit_count == 0x80)
return "0";
temp.delete(0,temp.length());
if (num_sign == 0x01)
digit_count = digit_count - 0xc0;
else
digit_count = 0x40 - digit_count - 1;
if (num_sign == 0)
{
//temp.append("-");
if (digit_count <= 0)
temp.append("0.");
for(int i = 0; i > digit_count;i--)
temp.append("00");
for(int i=start+1;i<start+len-(len < 21?1:0) & i < _block_size-4;i++)
{
if ( 101 - ((int)0xff & buf[i]) < 10 && temp.length() > 0)
temp.append("0");
temp.append(101 - ((int)0xff & buf[i]));
if (i - start == digit_count && i - start != len-1-(len<21?1:0))
temp.append(".");
}
for(int i = 0; i < digit_count - len + (len == 21?1:0);i++)
temp.append("00");
}
else
{
if (digit_count <= 0)
temp.append("0.");
for(int i = 0; i > digit_count;i--)
temp.append("00");
for(int i=start+1;i<start+len & i < _block_size - 4;i++)
{
if (((int)0xff & buf[i]) - 1 < 10 && temp.length() > 0)
temp.append("0");
temp.append(((int)0xff & buf[i]) - 1);
if (i - start == digit_count && i - start != len - 1)
temp.append(".");
}
for(int i = 0; i < digit_count - len + 1;i++)
temp.append("00");
}
return (num_sign==0 ? "-":"" )+ temp.toString();
}
// ORACLE TYPE_ID=96
public String convertCHAR(byte buf[],int start,int len)
{
int pos = start + len;
while(pos > start && buf[pos - 1] == 0x20) pos --;
if (pos == start)
return "";
else
return new String(buf,start,pos - start);
}


// ORACLE TYPE_ID = 1;
public String convertVARCHAR(byte buf[],int start,int len)
{
return new String(buf,start,len);
}
public String convertRAW(byte buf[],int start,int len)
{
temp.delete(0,temp.length());
for(int i = start; i < start+len;i++)
{
temp.append(_HEX_ARRAY[(int)(_block_buf[i] >> 4 & 0x0f)]);
temp.append(_HEX_ARRAY[(int)(_block_buf[i] & 0x0f)]);
}
return temp.toString();
}
public String convertVARRAW(byte buf[],int start,int len)
{
temp.delete(0,temp.length());
for(int i = start; i < start+len;i++)
{
temp.append(_HEX_ARRAY[(int)(_block_buf[i] >> 4 & 0x0f)]);
temp.append(_HEX_ARRAY[(int)(_block_buf[i] & 0x0f)]);
}
return temp.toString();
}


// ORACLE TYPE_ID=12
// Centry - 100
// Year - 100
// Month
// Day
// Hour - 1
// Minute - 1
// Second - 1
public String convertDATE(byte buf[],int start,int len)
{
temp.delete(0,temp.length());
int centry = (((int)0xff & buf[start]) - 100) * 100;
int year = ((int)0xff & buf[start+1]) - 100;
int month = ((int)0xff & buf[start+2]);
int day = ((int)0xff & buf[start+3]);
int hour = ((int)0xff & buf[start+4]);
if (hour > 0 ) hour = hour - 1;
int minutes = ((int)0xff & buf[start+5]);
if (minutes > 0 ) minutes = minutes - 1;
int seconds = ((int)0xff & buf[start+6]);
if (seconds > 0 ) seconds = seconds - 1;
temp.append(String.valueOf(centry+year));
temp.append("-");
if (month < 10) temp.append("0");
temp.append(String.valueOf(month));
temp.append("-");
if (day < 10) temp.append("0");
temp.append(String.valueOf(day));
temp.append(" ");
if (hour < 10) temp.append("0");
temp.append(String.valueOf(hour));
temp.append(":");
if (minutes < 10) temp.append("0");
temp.append(String.valueOf(minutes));
temp.append(":");
if (seconds < 10) temp.append("0");
temp.append(String.valueOf(seconds));
return temp.toString();
}


public String convertTIMESTAMP(byte buf[],int start,int len)
{
temp.delete(0,temp.length());
int centry = (((int)0xff & buf[start]) - 100) * 100;
int year = ((int)0xff & buf[start+1]) - 100;
int month = ((int)0xff & buf[start+2]);
int day = ((int)0xff & buf[start+3]);
int hour = ((int)0xff & buf[start+4]);
if (hour > 0 ) hour = hour - 1;
int minutes = ((int)0xff & buf[start+5]);
if (minutes > 0 ) minutes = minutes - 1;
int seconds = ((int)0xff & buf[start+6]);
if (seconds > 0 ) seconds = seconds - 1;
temp.append(String.valueOf(centry+year));
temp.append("-");
if (month < 10) temp.append("0");
temp.append(String.valueOf(month));
temp.append("-");
if (day < 10) temp.append("0");
temp.append(String.valueOf(day));
temp.append(" ");
if (hour < 10) temp.append("0");
temp.append(String.valueOf(hour));
temp.append(":");
if (minutes < 10) temp.append("0");
temp.append(String.valueOf(minutes));
temp.append(":");
if (seconds < 10) temp.append("0");
temp.append(String.valueOf(seconds));
temp.append(".");
long object_id = (((long)(0xff & _block_buf[start+7])) << 24 )
+ (((long)(0xff & _block_buf[start+8])) << 16 )
+ (((long)(0xff & _block_buf[start+9])) << 8 )
+ ((long) (0xff & _block_buf[start+10]));
temp.append(String.valueOf(object_id));
if (len == 13)
{
int tz_hour = (0xff & _block_buf[start+11]) - 0x14;
int tz_min = (0xff & _block_buf[start+12]);
if (tz_hour >= 0)
tz_min = tz_min - 60;
else
tz_min = 60 - tz_min;
temp.append(" ");
temp.append(tz_hour);
temp.append(":");
temp.append(tz_min);
}
return temp.toString();
}


public final String convertBINARYFLOAT(byte buf[],int start,int len)
{
int zero=0xff;
temp.delete(0,temp.length());
if (len == 4)
{
int intval = ((zero & buf[start + 0]) << 24)
+ ((zero & buf[start + 1]) << 16)
+ ((zero & buf[start + 2]) << 8 )
+ ((zero & buf[start + 3]));
temp.append(Float.intBitsToFloat(intval ^ 0x80000000));
}
return temp.toString();
}


public final String convertBINARYDOUBLE(byte buf[],int start,int len)
{
temp.delete(0,temp.length());
long zero=0xff;
if (len == 8)
{
long intval = ((zero & buf[start + 0]) << 56)
+ ((zero & buf[start + 1]) << 48)
+ ((zero & buf[start + 2]) << 40)
+ ((zero & buf[start + 3]) << 32)
+ ((zero & buf[start + 4]) << 24)
+ ((zero & buf[start + 5]) << 16)
+ ((zero & buf[start + 6]) << 8)
+ ((zero & buf[start + 7]));
temp.append(Double.longBitsToDouble(intval ^ 0x8000000000000000l));
}
return temp.toString();
}



www.sosdb.com 专业数据库恢复

oracle数据恢复raid数据恢复

qq:9417901

msn:glkgdj@hotmail.com

支持(0中立(0反对(0单帖管理 | 引用 | 回复 回到顶部
oracle数据恢复-RAID5数据恢复-raid数据恢复
sosdb
  3楼 个性首页 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


数据恢复 恢复数据
等级:超级版主 帖子:809 积分:10386 威望:0 精华:1 注册:2007-1-28 11:50:49
  发帖心情 Post By:2007-4-25 11:04:22

public final void dumpFILE()
{
_output_file.println("RDBA=0x"+getDataBlockAddress()+"("+
getDataFileID()+"/"+getDataBlockID()+")");
_output_file.println("BLOCK: type="+getBlockType() +
",flag="+getBlockFlag() +
",seq="+getBlockSequence());
_output_file.println("FHEAD: "+
"DBID=0x"+getDBIDHex()+"="+getDBIDInt()+
",db="+getDatabaseName()+
",ts#="+getTablespaceID()+
",ts="+getTablespaceName()+
",rfn="+getDataFileID());
_output_file.println("FILE : ver="+getSoftwareVersion()+
",compatible="+getCompatibleVersion()+
",blks="+getBlockCount()+
",file#="+getFileNumber()+
",type="+getFileType());
_output_file.println();
}


public final void dumpHEADER()
{
_output_file.println("RDBA=0x"+getDataBlockAddress()+"("+
getDataFileID()+"/"+getDataBlockID()+")");
_output_file.println("BUFFER: type="+getBlockType() +
",flag="+getBlockFlag() +
",seq="+getBlockSequence());
_output_file.println("HEADER: seg/obj="+getDataObjectID()+
",exts="+getSegExtentCount() +
",blks="+getSegBlockCount());
_output_file.println("HWM : file="+ getDataFileID(getSegHWMAddress())+
",block_id="+getDataBlockID(getSegHWMAddress())+
",ext#="+getSegHWMExtent()+
",blocks="+getSegHWMBlocks()+
",ext size="+getSegHWMExtSize()+
",flg blocks="+getSegFLGBlocks()+
",flg bellow="+getSegFLGBellow());
_output_file.println("Map : "+getDataFileID(getSegNextMAP())
+"/"+getDataBlockID(getSegNextMAP()));
_output_file.println("Extent: ");
for(int ext_no = 0; ext_no < getBlockExtentCount(); ext_no++)
{
_output_file.println( " "+getDataFileID(getSegExtentRDBA(ext_no)) +
"\t"+getDataBlockID(getSegExtentRDBA(ext_no)) +
"\t"+getSegExtentBlocks(ext_no));
}
try {
while(getSegNextMAP() != 0x00)
{
if (!readBlock(getSegNextMAP())) break;
for(int ext_no = 0; ext_no < getBlockExtentCount(); ext_no++)
{
_output_file.println(" "+getDataFileID(getSegExtentRDBA(ext_no)) +
"\t"+getDataBlockID(getSegExtentRDBA(ext_no)) +
"\t"+getSegExtentBlocks(ext_no));
}
}
}
catch (java.io.IOException ioe)
{
System.err.println(ioe.getMessage());
}
_output_file.println();
}


public final void dumpORACLE()
{
_output_file.println("RDBA=0x"+getDataBlockAddress()+"("+
getDataFileID()+"/"+getDataBlockID()+")");
_output_file.println("BUFFER: type="+getBlockType() +
",flag="+getBlockFlag() +
",seq="+getBlockSequence());
switch (getBlockType())
{
case OracleBlock.BLOCK_DATA:
_output_file.println("HEADER: seg/obj="+getDataObjectID()+
",itc="+getITLNumber() +
",ffre="+getFirstFreeRowEntry()+
",offset="+getITLEndOffset()+
",data="+getDataType());
switch (getDataType())
{
case DATA_TYPE_DATA:
_output_file.println("TYPE : DATA(ntab="+getTableCount()+")");
for (int tno = 0; tno < getTableCount(); tno ++)
_output_file.println("TABLE : tno="+tno+",rows="+getTableRowCount(tno));
break;
case DATA_TYPE_INDEX:
_output_file.println("TYPE : INDEX,LEV="+getIndexColev()
+",IOT="+(((getIndexCoopc() & 0x10) == 0x10)?'Y':'N'));
break;
}
_output_file.println(
"xid uba scn fsc flag lock");
_output_file.println(
"----------------- ---------------- ---- -------- ---- ----");
for (int itlno = 0;itlno < getITLNumber();itlno++)
{
_output_file.println(getITLXID(itlno)+" "+
getITLUBA(itlno)+" "+
getITLSCN(itlno)+" "+
getITLFSC(itlno)+" "+
getITLFlag(itlno)+" "+
getITLLock(itlno));
}
break;
case OracleBlock.BLOCK_USEG_HEADER:
case OracleBlock.BLOCK_UFLGSEG_HEADER:
//case OracleBlock.BLOCK_EXTENT_MAP:
_output_file.println("HEADER: seg/obj="+getDataObjectID()+
",exts="+getSegExtentCount() +
",blks="+getSegBlockCount());
_output_file.println("HWM : file="+
getDataFileID(getSegHWMAddress())+
",block_id="+getDataBlockID(getSegHWMAddress())+
",ext#="+getSegHWMExtent()+
",blocks="+getSegHWMBlocks()+
",ext size="+getSegHWMExtSize()+
",flg blocks="+getSegFLGBlocks()+
",flg bellow="+getSegFLGBellow());
_output_file.println("Map : "
+getDataFileID(getSegNextMAP())
+"/"+getDataBlockID(getSegNextMAP()));
_output_file.println("Extent: ");
for(int ext_no = 0; ext_no < getBlockExtentCount(); ext_no++)
{
_output_file.println(" "+getDataFileID(getSegExtentRDBA(ext_no)) +
"\t"+getDataBlockID(getSegExtentRDBA(ext_no)) +
"\t"+getSegExtentBlocks(ext_no));
}
try {
while(getSegNextMAP() != 0x00)
{
if (!readBlock(getSegNextMAP())) break;
for(int ext_no = 0; ext_no < getBlockExtentCount(); ext_no++)
{
_output_file.println(" "+getDataFileID(getSegExtentRDBA(ext_no)) +
"\t"+getDataBlockID(getSegExtentRDBA(ext_no)) +
"\t"+getSegExtentBlocks(ext_no));
}
}
}
catch (java.io.IOException ioe)
{
System.err.println(ioe.getMessage());
}
break;
}
_output_file.println();
}


public final void dumpOS()
{
StringBuffer line_buf = new StringBuffer();
StringBuffer text_buf = new StringBuffer();
_output_file.println("RDBA="+getDataBlockAddress()+"("+
getDataFileID()+"/"+getDataBlockID()+")");
_output_file.println(" -0 -1 -2 -3 -4 -5 -6 -7 "+
"-8 -9 -A -B -C -D -E -F 0123456789ABCDEF");
_output_file.println("-----/----- ----------------------- "+
"----------------------- ----------------");
for(int i=0;i<_block_size;i++)
{
if (i > 0 && i % 16 == 0)
{
_output_file.print(line_buf.toString()+" ");
_output_file.println(text_buf.toString());
line_buf.delete(0,line_buf.length());
text_buf.delete(0,text_buf.length());
if (i % 256 == 0)
{
_output_file.println();
_output_file.println(" -0 -1 -2 -3 -4 -5 -6 -7 "+
"-8 -9 -A -B -C -D -E -F 0123456789ABCDEF");
_output_file.println("-----/----- ----------------------- "+
"----------------------- ----------------");
}
}
else
{
if (i > 0 && i % 8 == 0)
{
line_buf.append(" ");
}
}
if (i % 16 == 0)
{
String lineno = String.valueOf(i);
line_buf.append("00000".substring(0,5-lineno.length()));
line_buf.append(lineno+"/");
line_buf.append(_HEX_ARRAY[(int)((i >> 12) & 0x0f)]);
line_buf.append(_HEX_ARRAY[(int)((i >> 8) & 0x0f)]);
line_buf.append(_HEX_ARRAY[(int)((i >> 4) & 0x0f)]);
line_buf.append("0: ");
}
line_buf.append(_HEX_ARRAY[(int)(_block_buf[i] >> 4 & 0x0f)]);
line_buf.append(_HEX_ARRAY[(int)(_block_buf[i]) & 0x0f]);
if (_block_buf[i] != 0x0d && _block_buf[i] != 0x0a &&
_block_buf[i] != 0x07 && _block_buf[i] != 0x09 &&
_block_buf[i] != 0x00 && _block_buf[i] < 128
&& _block_buf[i] > 0 && !Character.isISOControl((char)_block_buf[i]))
text_buf.append((char)_block_buf[i]);
else
text_buf.append('.');
line_buf.append(" ");
}
_output_file.print(line_buf.toString()+" ");
_output_file.println(text_buf.toString());
_output_file.println();
}


// Dump IOT row
public final void dumpIndexRow(boolean deleted,boolean commited)
{
int zero = 0xff;
int row_offset = 0x00;
int itl_slot = 0x00;
int row_flag = 0x00;
int blk_lev = getIndexColev();
int iot_tag = (getIndexCoopc() & 0x10) >> 4 ;


if (blk_lev > 0) return;
if (iot_tag == 0) return;


for (int rowno = 0; rowno < getIndexRowCount();rowno ++)
{
row_offset = getITLEndOffset()+getIndexOffset(rowno);
itl_slot = (int)(zero & _block_buf[row_offset+1]);
row_flag = (int)(zero & _block_buf[row_offset+0]);
if (commited)
{
if (itl_slot > 0)
{
if ((TRANSACTION_UPBOUND & getITLStatus(itl_slot - 1))
!= TRANSACTION_UPBOUND &&
(TRANSACTION_COMMITED & getITLStatus(itl_slot - 1))
!= TRANSACTION_COMMITED)
continue;
}
}
if (!deleted && (0x01 & row_flag)==0x01)
continue;
printIOTRow(row_offset);
}
}


// Dump Table or cluster row
public final void dumpDataRow(int tno,boolean deleted,boolean commited)
{
int zero = 0xff;
int row_offset = 0x00;
int itl_slot = 0x00;
switch (_block_buf[0])
{
case BLOCK_DATA :
for (int i= 0; i<getTableRowCount(tno);i++)
{
row_offset = getTableRowOffset(tno,i);
if (row_offset == 0xffff || row_offset < getRecordCount())
continue;
row_offset = row_offset + getITLEndOffset();


itl_slot = (int)(zero & _block_buf[row_offset+1]);
// Skipping uncommited row!
if (commited)
{
if (itl_slot > 0)
{
if ((TRANSACTION_UPBOUND & getITLStatus(itl_slot - 1))
!= TRANSACTION_UPBOUND &&
(TRANSACTION_COMMITED & getITLStatus(itl_slot - 1))
!= TRANSACTION_COMMITED)
continue;
}
}


int row_flag = getBlockRowFlag(row_offset);


// Skipping deleted row!
if (!deleted &&
(ROW_DELETED_ROW & row_flag)==ROW_DELETED_ROW)
continue;


//if (itl_slot > 0 &&
// ((ROW_DELETED_ROW & row_flag)==ROW_DELETED_ROW) &&
// (getITLStatus(itl_slot - 1) == TRANSACTION_UPBOUND))
// continue;


// Skipping chained row
if ((ROW_HEAD_PIECE & row_flag) != ROW_HEAD_PIECE ||
(ROW_FIRST_PIECE & row_flag) != ROW_FIRST_PIECE)
continue;


printDataRow(row_offset,deleted);


if ((ROW_LAST_PIECE & row_flag) != ROW_LAST_PIECE)
{
int fld_ind = getFieldCount(row_offset) - 1;
int next_dba = getNextBlockDBA(row_offset);
int next_row = getNextBlockRow(row_offset);
OracleBlock oblock = createBlock();
oblock.setOutputFile(_output_file);
oblock.setDumpConfig(_dump_config);
oblock.setFieldSeperator(_field_sep);
if (_dump_config != null && _dump_config.getColumnCount() > 0)
{
int column_types[] = new int[_dump_config.getColumnCount()];
for(int ci=0;ci<_dump_config.getColumnCount();ci++)
{
column_types[ci] = _dump_config.getColumnType(ci);
}
oblock.setColumnType(column_types);
}
oblock.setBlockSize(_block_size);
try {
while(true)
{
if (!oblock.readBlock(next_dba))
{
System.err.println("Error read continue block : "+next_dba);
break;
}
_fid = -1;
_bno = -1;
int chained_offset = oblock.getITLEndOffset()+
oblock.getTableRowOffset(tno,next_row);
row_flag=oblock.getBlockRowFlag(chained_offset);
if ((ROW_FROM_PREVIOUS & row_flag) != ROW_FROM_PREVIOUS)
{
_output_file.print(_field_sep);
fld_ind = fld_ind + 1;
}
oblock.printChainRow(chained_offset,fld_ind);
if ((ROW_LAST_PIECE & row_flag) == ROW_LAST_PIECE) break;
fld_ind = fld_ind+oblock.getFieldCount(chained_offset)-1;
next_dba=oblock.getNextBlockDBA(chained_offset);
next_row=oblock.getNextBlockRow(chained_offset);
}
}
catch (java.io.IOException ioe)
{
System.err.println(ioe.getMessage());
}
}
}
break;
}
}
}



www.sosdb.com 专业数据库恢复

oracle数据恢复raid数据恢复

qq:9417901

msn:glkgdj@hotmail.com

支持(0中立(0反对(0单帖管理 | 引用 | 回复 回到顶部

返回版面帖子列表

JDUL源代码








签名