http://iotn.co.kr 연락처: gilho.kr@gmail.com [ The Japanese government should apologize to Japanese Military Sexual Slavery victim. / 日本政府は日本軍の性的奴隷?牲者に謝罪すべき. ]

사용자

ID:
PW:

INDEX
01.게시판
게시판 [71]
02.File Book
File 자료실 [95]
Site Link [17]
개인폴더 [201]
03.Field Book
Altibase [19]
Tibero [30]
MS-SQL [18]
MySQL [43]
DB2 [79]
ORACLE [2973]
PSQL [133]
기타정보 [155]
운영체제 [600]
04.Q/A Book
Q/A [53]
05.방명록
방명록 [54]
레벨업 [37]
구인/구직 [2]

기념일
Search
LINK
+ 가족 Hompy
+ DNSEver
IOTN :: Field Book :: ORACLE

 회원가입

dd copy datafile raw device , filesystem
최길호 [LIST]   2009-09-07 13:02:35, 조회 : 81,802

추가
ls *dbf *log *ctl | awk '{printf("dd if=%s of=%s.dd count=10 bs=4k\n",$1,$1)}'
ls *dbf *log *ctl | awk '{printf("dd if=%s.dd of=%s count=2 bs=4k conv=notrunc\n",$1,$1)}'


alter system dump logfile '/oracle/redo_raw.dbf';

$ORACLE_HOME/bin/dbfsize <Oracle Datafile 명>

% dd if=<raw device name> of=<filesystem name> bs=<BlockSize> skip=1
% dd if=<filesystem name> of=<raw device name> bs=<BlockSize> seek=1

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

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 , Filesystem 복사 시 반드시 명시해야 함,
              그 이외의 경우는 생략 가능)

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/ORA01/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

http://blog.naver.com/itisksc/30046860726
44.192.254.173


최길호
[ SunOS 5.8 sun4u sparc ]
[ 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.
2009-09-08
20:50:44



최길호
$ 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 ]
2009-09-08
20:56:16



최길호
for AIX

select 'dd if='||f.name||' of='||lower(t.name)||
row_number() over (partition by t.name order by f.file# )||
'.dbf bs=8192k #'||t.name||' '||f.file#
from v$datafile f,v$tablespace t where t.ts#=f.ts#;

select 'dd if='||f.name||' of='||lower(t.name)||
row_number() over (partition by t.name order by f.file# )||
'.dbf bs=8192k 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=8192k 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 성공
2014-10-29
06:03:49



최길호
-- 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
2015-03-19
16:47:06



  LIST

제목 작성자 작성일 조회
Troubleshoot  ORA-03137: TTC    최길호 2018/04/24 1006937
WebLogic  weblogic cache    최길호 2018/02/28 236795
WebLogic  weblogic cluster session share [ 세션 공유 login.jsp login chk, weblogic.management.ManagementException: [Deployer:149188] ]    최길호 2018/03/03 124548
Troubleshoot  IMP-00003 ORA-32603: invalid FREEPOOLS LOB storage option value [ move lob table, lob index ]    최길호 2013/05/26 120206
Troubleshoot  proc, windows, vc 2003 , pcmake , Files\Microsoft은(는) 예상되지 않았습니다    최길호 2006/10/02 100225
Troubleshoot  dblink ORA-02068 ORA-03113 ORA-02080 [ ALTER SESSION CLOSE DATABASE LINK RDBNM; ]  [4]  최길호 2010/07/10 99007
Troubleshoot  ORA-00600: internal error code, arguments: [kcbzib_kcrsds_1]    최길호 2021/09/23 98707
WebLogic   WEB-INF/lib 우선 적용, index-directory-enabled 인덱스 디렉토리    최길호 2018/02/27 97265
WebLogic  java -jar fmw_12.2.1.3.0_wls.jar The OpenJDK JVM is not supported on this platform.    최길호 2018/02/06 86565
Troubleshoot  TRIGGER,Function ORA-02069 ORA-06512 ORA-04088 ORA-02070    최길호 2008/12/19 86444
Script  session monitor [ dbms_xplan sql binds ]  [2]  최길호 2010/06/30 85328
Troubleshoot  ORA-03297 Resizing Empty Datafile    최길호 2009/08/11 84423
Admin  dd copy datafile raw device , filesystem  [4]  최길호 2009/09/07 81802
SQL,PL*SQL  dbms_random 사용예  [1]  최길호 2010/04/12 81261
Troubleshoot  ODBC {Microsoft ODBC for Oracle}, ORA-12154, ODBC NA000 IM006 01000  [1]  최길호 2008/01/04 77652
Troubleshoot  ORA-12537 , <unknown connect data> * 12537  [2]  최길호 2009/11/21 67989
Troubleshoot  ALTER SESSION CLOSE DATABASE LINK    최길호 2010/07/11 66168
Troubleshoot  ld: 0711-224 WARNING: Duplicate symbol: p_xargc    최길호 2010/06/08 65294
Admin  ORACLE과 MSSQL간의 DBLINK 방법    최길호 2008/09/19 65283
Tool  RAC jdbc connection test [ thin java test.java sample ]  [3]  최길호 2010/06/14 61870

    목록보기   다음페이지 1 [2][3][4][5][6][7][8][9][10]..[149]   [다음 10개]
       

Copyright 1999-2023 Zeroboard / skin by 최길호(gilho.kr@gmail.com)
최근 댓글
2021/06/30
윈도우 서버에서 sqlplus .... ORA-...
by 최길호
2021/06/30
ORA-28500: connection from O...
by 최길호
2019/05/02
pkg 확인 SELECT * FROM AL...
by 최길호
최근 게시물
09/27
[ORACLE]
auto compile [ dba_objects LAS....
by 최길호
09/25
[ORACLE]
verify_queryable_inventory ret....
by 최길호
09/11
[운영체제]
ntfy.sh / 푸시 알림 보내기.
by 최길호