- bs : 파일 입출력의 block(버퍼) 크기
- skip : 입력 파일에서 처리하지 않고 통과할 블록의 개수
(Raw Device to Filesystem 복사 시 지정해야 함)
- seek : 출력 파일에서 처리하지 않고 통과할 블록의 개수
(Filesystem to Raw Device 복사 시 지정해야 함)
- count : 복사할 회수 or 블록의 개수 (생략 시 모든 데이터 복사 )
플랫폼 |
LVCB |
플랫폼 |
LVCB |
Solaris |
0 |
True64 |
64KB |
HP-UX |
0 |
Linux |
0 |
AIX |
4KB |
Windows |
0 |
2. dbfsize로 확인
$ORACLE_HOME/bin/dbfsize <Oracle Datafile 명>
Database file type: file system : File Type
Database file size: 128000 8192 byte blocks :8192 byte Block이 128000 개
Database file type: raw device : File Type
※ dbsize로 조회한 결과(Dictionary View에서 select로 조회한
dd if=/dev/rv_data001 of=/data01/TESTDB/data001.dbf bs=4096
dd if=/data01/TESTDB/data001.dbf of=/dev/rv_data001 bs=4096 seek=1
dd if=/dev/re_data001 of=/dev/rv_data001_bk bs=4096 skip=1 seek=1
[출처] 이관 - raw device to file system(dd copy)|작성자 smileDBA
[출처] http://power.iotn.co.kr/zboard.php?id=9_1_bbs&no=1197
[ Oracle 9.2.0.8 ]
[ filesystem to raw device ]
$ dbfsize /oracle/system/tools01.dbf
Database file: /data/system/tools01.dbf
Database file type: file system
Database file size: 83840 8192 byte blocks
SQL> alter database datafile '/data/system/tools01.dbf' offline;
SQL> !dd if=/data/system/tools01.dbf of=/dev/rdsk/c0t0d0s1 bs=8192 count=83840
83840+0 레코드 입력
83840+0 레코드 출력
SQL> alter database rename file '/data/system/tools01.dbf' to '/dev/rdsk/c0t0d0s1';
SQL> recover datafile '/dev/rdsk/c0t0d0s1';
SQL> alter database datafile '/dev/rdsk/c0t0d0s1' online;
[ raw device to filesystem ]
$ dbfsize /dev/rdsk/c0t0d0s1
Database file: /dev/rdsk/c0t0d0s1
Database file type: raw device
Database file size: 83840 8192 byte blocks
SQL> alter database datafile '/dev/rdsk/c0t0d0s1' offline;
SQL> !dd if=/dev/rdsk/c0t0d0s1 of=/data/system/tools01.dbf bs=8192 count=83840
83840+0 레코드 입력
83840+0 레코드 출력
SQL> alter database rename file '/dev/rdsk/c0t0d0s1' to '/data/system/tools01.dbf';
SQL> recover datafile '/data/system/tools01.dbf';
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 2: '/data/system/tools01.dbf'
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/data/system/tools01.dbf'
ORA-01200: actual file size of 83839 is smaller than correct size of 83840 blocks
SQL> !dd if=/dev/rdsk/c0t0d0s1 of=/data/system/tools01.dbf bs=8192 count=83841
83841+0 레코드 입력
83841+0 레코드 출력
14:31:23 SQL> recover datafile '/data/system/tools01.dbf';
Media recovery complete.
14:31:38 SQL> alter database datafile '/data/system/tools01.dbf' online;
Database altered.
$ rawutl -s /dev/vx/rdsk/oracle/system.dbf [ 운영중인 lv size 2G, datafile size 2G ]
2148532224 [ 2G ]
$ rawutl -s /dev/vx/rdsk/oracle/r_system.dbf [ 임시 복구 lv size 3G, datafile size 2G ]
3221225472 [ 3G ]
$ dbfsize /dev/vx/rdsk/oracle/system.dbf
Database file: /dev/vx/rdsk/oracle/system.dbf
Database file type: raw device
Database file size: 262144 8192 byte blocks
$ dbfsize /dev/vx/rdsk/oracle/r_system.dbf
Database file: /dev/vx/rdsk/oracle/r_system.dbf
Database file type: raw device
Database file size: 262144 8192 byte blocks
SQL> select file#,name,bytes from v$datafile where file#=1;
FILE# NAME BYTES
---------- ---------------------------------------- ----------
1 /dev/vx/rdsk/oracle/system.dbf 2147483648 / 8192 = 262144 +1 = 262145
$ dd if=/dev/vx/rdsk/oracle/r_system.dbf of=system.dbf bs=8192 count=262145
$ ls -al
-rw-r--r-- 1 oracle dba 2147491840 9월 7일 13:28 system.dbf
$ dbfsize system.dbf
Database file: system.dbf
Database file type: file system
Database file size: 262144 8192 byte blocks
$ dd if=/dev/vx/rdsk/oracle/r_system.dbf of=system.dbf count=262144
$ ls -al
-rw-r--r-- 1 oracle dba 134217728 9월 7일 13:31 system.dbf [ 134217728 / 262144 = 512 block ]
for AIX
select 'dd if='||f.name||' of='||lower(t.name)||
row_number() over (partition by t.name order by f.file# )||
'.dbf bs=4k count='||to_char(((BLOCKS*BLOCK_SIZE)/4096)+4906)||
' #'||t.name||' '||f.file#
from v$datafile f,v$tablespace t where t.ts#=f.ts#;
or
select 'dd if='||fname||' of='||lower(tname)||
decode(sign(rn -9),1,'','0')||rn||
'.dbf bs=4k count='||to_char(((BLOCKS*BLOCK_SIZE)/4096)+4906)||
' #'||tname||' '||file#
from (select f.name fname,t.name tname,f.file#,blocks,block_size,
row_number() over (partition by t.name order by f.file# ) rn
from v$datafile f,v$tablespace t where t.ts#=f.ts#);
select 'dd if='||member||' of=redo'||group#||'.log bs=4k count='||to_char(((lesiz*lebsz)/4096)+4096)
from v$logfile f, x$kccle l where f.group#=l.lenum;
select 'dd if='||name||' of=control.ctl bs=4k count='||to_char(((file_size_blks*block_size)/4096)+4096)
from v$controlfile where rownum=1;
wait: there are no child processes.
같은 서버에서 test 나기도하고 안나기도함.
파일크기 같고 rename 성공
-- DSVM prime
vxprint -g data -m gj_v4_001_5g|grep devsubtype
devsubtype=dsvmprime
dd if=/dev/vx/rdsk/data/gj_v4_001_5g of=/data/oradata/TSADMI_04.dbf bs=8192k
-- DSVM
vxprint -g data -m gj_v3_013_10g|grep devsubtype
devsubtype=dsvm
dd if=/dev/vx/rdsk/data/gj_v3_013_10g of=/data/oradata/TSADMI_05.dbf bs=4096 skip=1 count=2560002
'ORACLE > Migration' 카테고리의 다른 글
이관 - 오라클 exp/imp를 이용한 단순 이관 방법 및 순서 (0) | 2015.09.14 |
---|---|
AIX: COPYING RAW DEVICE TO FILE SYSTEM USING DD COMMAND (문서 ID 1027958.6) (0) | 2015.09.06 |
하나의 dmp파일로 여러 유저에 넣을 때 tbs 분배 (0) | 2010.02.04 |
Table생성 스크립트 파일 뽑아내기 (0) | 2009.08.28 |
Dangtong 의 오라클 <Data Pump Export / Import 3편> (0) | 2008.11.07 |