ORACLE/Migration2015. 9. 14. 21:31
반응형
출처 : http://blog.naver.com/itisksc/30046860726
1. raw device에는 LVCB(Logical Volume Control Block)가 있지만
   file system에는 없음.

 

   - bs    : 파일 입출력의 block(버퍼) 크기

   - skip  : 입력 파일에서 처리하지 않고 통과할 블록의 개수
             (Raw Device to Filesystem 복사 시 지정해야 함)
   - seek  : 출력 파일에서 처리하지 않고 통과할 블록의 개수
             (Filesystem to Raw Device 복사 시 지정해야 함)

   - count : 복사할 회수 or 블록의 개수 (생략 시 모든 데이터 복사 )

             (Raw Device to Filesystem 복사 시 반드시 명시해야 함,
              그 이외의 경우는 생략 가능)

플랫폼
LVCB
플랫폼
LVCB
Solaris
0
True64
64KB
HP-UX
0
Linux
0
AIX
4KB
Windows
0

 

2. dbfsize로 확인

   $ORACLE_HOME/bin/dbfsize <Oracle Datafile 명>

   [file system 결과]
   /data05/TESTDB] dbfsize UNDO01_01.dbf
   Database file: UNDO01_01.dbf
   Database file type: file system             : File Type
   Database file size: 128000 8192 byte blocks :8192 byte Block이 128000 개

 

   [raw device 결과]

   Database file type: raw device             : File Type

   Database file size: 1408 8192 byte blocks  : 8192 byte Block이 1408 개

   ※ dbsize로 조회한 결과(Dictionary View에서 select로 조회한
      block 수도 마찬가지)에는 Datafile Header Block 및 LVCB가 포함되지 않음
 
      다음과 같은 경우에는 파일이 손상된 경우이므로 다시 복사
      Header block file size is bad;            trying raw file format...
      Header block magic number is bad
 
3. 참고사항
1) Raw Device 에서 Filesystem으로 변환
   dd if=/dev/rv_data001 of=/data01/TESTDB/data001.dbf bs=4096
      skip=1 count=2818
2) Filesystem 에서 Raw Device로 변환
   dd if=/data01/TESTDB/data001.dbf of=/dev/rv_data001 bs=4096 seek=1
3) Raw Device 에서 Raw Device로 복사
   dd if=/dev/re_data001 of=/dev/rv_data001_bk bs=4096 skip=1 seek=1
4) Filesystem 에서 file system으로 복사
   cp /data01/TESTDB/data001.dbf /data01/TESTDB/data001.bak


반응형
Posted by [PineTree]
ORACLE/Migration2015. 9. 6. 18:15
반응형


Problem Description: 
====================== 
How to backup the database on the raw device to the filesystem using 'dd'.




 
 
Solution Description: 
===================== 
 
The following commands will allow you to copy a raw device to the filesystem 
and restore from the filesystem to the raw device. 
 
You must use the dd command to copy from the raw device.  
 
Please Note: 
============  
	1. Caution is required because some AIX backup programs ignore large 
	files; you must	verify that any oversized AIX files are indeed  
        backed up.	  
  
	2. When doing copy/backup operations, please consider the 4KB 
	offset (taken by Oracle) for the Logical Volume Control Block(LVCB) at 
	the beginning of all IBM Virtual Shared Disks when performing 
	backup/restore operations. 
        
        3. When using zero offset raw devices (devices created using:
        # mklv -T O -y new_raw_device VolumeGroup NumberOfPartitions), ensure
        the 'skip' parameter is adjusted accordingly.  The offset can be 4096 
        bytes or 128 KB on AIX logical volumes or zero on AIX logical volumes 
        created with the mklv -T O option.
 
Copying to Filesystem  
--------------------------  
  
Use the command:  
  
% dd if=<raw device name> of=<filesystem name> bs=<BlockSize> 
skip=<SkipInputBlocks> 
  
Example:  
% dd if=/dev/rVh09.za.716c1 of=/a/spdevs04/ibmfs/osupport/dismith/test.ctl 
bs=4096 skip=1 
 
In the above example we specify the blocksize as 4096 bytes and skip 1 block 
for the offset for the Logical Volume Control Block(LVCB) 
 
bs=BlockSize - Specifies both the input and output block size, 
superceding the ibs and obs flags. The block size values specified with 
the bs flag must always be a multiple of the physical block size for the 
media being used. 
 
skip=SkipInputBlocks - Skips the specified SkipInputBlocks value of 
input blocks before starting to copy. 
 
Restoring from Filesystem  
--------------------------  
 
Use the command:  
  
% dd if=/a/spdevs04/ibmfs/osupport/dismith/test.ctl of=/dev/rVh09.za.716c1 
bs=4096 seek=1  
 
In the above example we specify the blocksize as 4096bytes and seek 1 block 
past the beginning of output file before copying, so we will not 
overwrite the Logical Volume Control Block(LVCB) 
 
seek=RecordNumber - Seeks the record specified by the RecordNumber  
variable from the beginning of output file before copying.


반응형
Posted by [PineTree]