ORACLE2014. 8. 12. 17:38

# LogMiner로 데이터베이스에서 발생한 변경 내역을 트랜잭션별, 사용자별, 발생 시간대별로 추적할 수 있음.(8i이후 부터 사용가능 하며 9i 이상부터 DDL을 지원함.)


# 실습 예제(Flat File에 저장하는 방법)

1. Redo log file 상태 확인

set line 200

col group# for 99

col mb for 999

col member for a45

col seq# for 999

col status for a8

col arc for a5


select a.group#,a.member,b.bytes/1024/1024 MB, b.sequence# "SEQ#",b.status, b.archived "ARC"

from v$logfile a, v$log b

where a.group# = b.group#

order by 1,2

/



2. supplemental_log_data_min 설정 확인(YES)

select supplemental_log_data_min from v$database ;



3. utl_file_dir 파라미터 값 확인 및 변경

--경로 확인

show parameter utl_file_dir ;


--원하는 경로로 변경

alter system set utl_file_dir='/data/logmnr' scope=spfile ;



4. DB재시작



5. 딕셔너리 생성

--원하는 파일명과 경로 적용

exec dbms_logmnr_d.build(dictionary_filename=>'dict03.dat',-

dictionary_location=>'/data/logmnr') ;



6. 분석할 로그파일 추가

-- 1 : 신규등록, 2 : 파일삭제, 3 : 추가 등록


-- 신규등록 예제(redo log 파일 중 current 상태인 로그 등록)

exec dbms_logmnr.add_logfile('/dbms/oracle/product/oradata/SOLEXTDEV/redo03.log',1) ;


-- 추가등록 예제

exec dbms_logmnr.add_logfile('/dbms/oracle/product/oradata/SOLEXTDEV/redo01.log',3) ;

exec dbms_logmnr.add_logfile('/dbms/oracle/product/oradata/SOLEXTDEV/redo02.log',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/2_1_855409270.arc',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/1_1_855409270.arc',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/6_1_855409270.arc',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/7_1_855409270.arc',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/8_1_855409270.arc',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/9_1_855409270.arc',3) ;

exec dbms_logmnr.add_logfile('/data/arch2/10_1_855409270.arc',3) ;


-- 삭제 예제

exec dbms_logmnr.add_logfile('/dbms/oracle/product/oradata/SOLEXTDEV/redo03.log',2) ;

exec dbms_logmnr.add_logfile('/dbms/oracle/product/oradata/SOLEXTDEV/redo01.log',2) ;

exec dbms_logmnr.add_logfile('/dbms/oracle/product/oradata/SOLEXTDEV/redo02.log',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/2_1_855409270.arc',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/1_1_855409270.arc',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/6_1_855409270.arc',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/7_1_855409270.arc',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/8_1_855409270.arc',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/9_1_855409270.arc',2) ;

exec dbms_logmnr.add_logfile('/data/arch2/10_1_855409270.arc',2) ;



7. 등록 상태 확인

set linesize 200

col db_name for a15

col filename for a50

select db_name, filename from v$logmnr_logs ;



8. LogMiner를 이용한 분석 시작(TEMP 테이블스페이스 공간이 넉넉해야함.)

exec dbms_logmnr.start_logmnr(dictfilename=>'/data/logmnr/dict03.dat',-

options=>dbms_logmnr.ddl_dict_tracking+dbms_logmnr.committed_data_only) ;



9. 결과 조회

col username for a10

col opration for a10

col sql_redo for a50

select timestamp,username, operation, sql_redo

from v$logmnr_contents

where seg_name='TEST1' ;



Posted by Tiwaz
ORACLE2014. 8. 12. 14:17

Supplemental logging이란 데이터에 DML이 발생할 경우 redo log에 추가적인 내용을 기록하여 복구에 도움이 되고자 할 때 설정해야 하는 기능.


# 약식 설정 및 확인

# 확인

select supplemental_log_data_min from v$database ;


# Database Level Supplemental log ENABLE

alter database add supplemental log data ;


# Database Level Supplemental log DISABLE

alter database drop supplemental log data ;


# Table Level Supplemental log ENABLE

alter table scott.emp add supplemental log data (all) columns ;


# Table Level Supplemental log DISABLE

alter table scott.emp drop supplemental log data (all) columns ;



# 상세 설정 옵션 및 확인

# 확인

select supplemental_log_data_min, supplemental_log_data_pk, supplemental_log_data_ui, supplemental_log_data_fk, supplemental_log_data_all from v$database ;


# 설정 옵션

-all columns 

-primary key columns

-unique columns

-foreign key columns


# ENABLE

alter database add supplemental log data (all|primary key|unique|foreign key) columns ;


# DISABLE

alter database drop supplemental log data (all|primary key|unique|foreign key) columns ;



Posted by Tiwaz
ORACLE2014. 8. 11. 10:58

오라클 RAC 설치 중 GRID 설치 시 ASM 디스크를 선택해야 하는 옵션에서

High, Normal, External Redundancy를 선택해야할 때 왜 선택을 해야하는지에 대해 정리가 잘 되있어서 퍼옴...


원문 링크 : https://blogs.oracle.com/ODA/entry/asm_normal_redundancy_versus_high


ASM Normal Redundancy versus High Redundancy on Oracle Database Appliance

The availability of normal redundancy configuration option for Automatic Storage Management (ASM) on Oracle Database Appliance starting with OAK version 2.4 allows for additional usable space on Oracle Database Appliance (about 6 TB with Normal Redundancy versus about 4 TB with High Redundancy). This is great news for many customers. Some environments, such as test and development systems, may benefit significantly as a result of this new option. However, the availability of Normal Redundancy option obviously should not be taken to mean that choosing Normal Redundancy may the best approach for all database environments. High redundancy would still provide a better and more resilient option (and may be a preferred choice) for mission critical production systems. It is therefore an option and not the default configuration choice. Many customers may choose to use Normal Redundancy for test, development, and other non-critical environments and High Redundancy for production and other important systems.

In general, ASM supports three types of redundancy (mirroring*) options.

High Redundancy - In this configuration, for each primary extent, there are two mirrored extents. For Oracle Database Appliance this means, during normal operations there would be three extents (one primary and two secondary) containing the same data, thus providing “high” level of protection. Since ASM distributes the partnering extents in a way that prevents all extents to be unable due to a component failure in the IO path, this configuration can sustain at least two simultaneous disk failures on Oracle Database Appliance (which should be rare but is possible).

Normal Redundancy - In this configuration, for each primary extent, there is one mirrored (secondary) extent. This configuration protects against at least one disk failure. Note that in the event a disk fails in this configuration, although there is typically no outage or data loss, the system operates in a vulnerable state, should a second disk fail while the old failed disk replacement has not completed. Many Oracle Database Appliance customers thus prefer the High Redundancy configuration to mitigate the lack of additional protection during this time.

External Redundancy - In this configuration there are only primary extents and no mirrored extents. This option is typically used in traditional non-appliance environments when the storage sub-system may have existing redundancy such as hardware mirroring or other types of third-party mirroring in place. Oracle Database Appliance does not support External Redundancy.

*ASM redundancy is different from traditional disk mirroring in that ASM mirroring is a logical-physical approach than a pure physical approach. ASM does not mirror entire disks. It mirrors logical storage entities called ‘extents’ that are allocated on physical disks. Thus, all “mirrored” extents of a set of primary extents on a given disk do not need to be on a single mirrored disk but they could be distributed across multiple disks. This approach to mirroring provides significant benefits and flexibility. ASM uses intelligent, Oracle Database Appliance architecture aware, extent placement algorithms to maximize system availability in the event of disk failure(s).


Posted by Tiwaz
WAS2014. 2. 24. 19:54
cmd 를 이용한 비밀번호 변경 방법으로 윈도우에서 제공하는 고정키 기능을 제공하는 실행 파일을 cmd로 변경하여 비밀번호를 초기화 한다.

  1. 윈도우 부팅 Media를 이용하여 설치화면 으로 부팅
  2. 첫 화면에서 shift + F10으로 명령 프롬프트 실행
  3. Windows가 설치된 HDD 찾기
  4. 설치된 HDD를 찾았다면
    C:> cd Windows
    C:> cd System32
    C:> copy sethc.exe sethc.exe.bak
    C:> copy cmd.exe sethc.exe
  5. 컴퓨터를 재부팅하여 Windows 로그인 창이 보이도록 실행
  6. 왼쪽 하단의 접근성 버튼을 클릭
  7. `바로가기키를 누른 상태로 고정( 고정 키)`을 체크하고 적용
  8. shift키를 연속으로 누름.
  9. cmd 창이 실행되면 명령어 입력
    C:> net user [계정명] [비밀번호]

** Windows가 정상적으로 시작된 상태에서는 sethc를 백업받았던 원래 파일로 변경이 불가능하므로 1~4번의 과정을 다시 실행하여 원복을 함.


Posted by Tiwaz
ORACLE2013. 7. 31. 21:28

1. Transportable Tablespace ?

v 다른 DATABASE의 테이블스페이스들을 복사하여 사용하는 기능으로 Oracle 8i부터 제공
v datafileOS level에서 복사하여 이관하는 방식으로  동일한 데이터에 대해 import/export 또는 unload/load 보다

   빠른 성능을 보장함.

v 서로 다른 플랫폼 간의 데이터 이동을 지원하므로 데이터 배포 작업을 한층 쉽고 빠르게 수행할 수 있음.
v Oracle 9i 이전 버전의 경우 동일한 block 크기이거나 DB내 기본 block 크기와 동일해야만 가능했으나

    Oracle 9i 이후 부터는 block 크기가 다르더라도 가능함.(, 테스트가 필요함)

v Oracle 10g부터 서로 다른 플랫폼간에 Tablespace 전송이 가능.(Solraris -> HP-UX)




2. Transportable Tablespace을 사용하는 경우

v 데이터웨어하우징 테이블 내의 파티션 테이블을 export/import 할 때
v Cross-Domains(CDs) 상의 구조화된 데이터를 Publising 할 때
v 여러 Database에 있는 여러 개의 Read-Only Tablespace를 복사하고자 할 때
v 오래된 데이터를 Archiving 하고자 할 때
v Tablespace Point-in-time-recovery를 수행 할 때

    TSPITR : RMAN을 이용하여 하나 또는 다수의 Tablespace를 빠르게 복구하는 방법.

v 다양한 RDBMS 버전과 OS플랫폼 사이에서 데이터베이스를 이전하고자 할 때.



3. Transportable Tablespaces를 사용할 때 사전 유의 사항.

 v SYSTEM, SYSAUX, TEMP Tablespace의 경우 이전 불가.

v 제약 및 제한사항 확인.

   Source DatabaseTarget Database가 호환이 되는지.(Platform, CharacterSet, XML Type의 테이블 스페이스 등.)

v 손상 버그(corruption bug)와 일반적인 이슈 확인.

   Source DatabaseTarget Database 버전에 따라 몇 가지 버그 발생.

v Source Database에서 유효하지 않은 객체 해결.

   ExportINVALIDObject가 없어야하며, SYS소유의 INVALID Object로 인해 Export를 실패할 수 있음.

v Export 하고자 하는 TTS Tablespace들이 자신을 포함하는지 확인.

   Export하고자 하는 TablespaceObject들이 다른 Tablespace를 참조하면 안됨. DBMS_TTS.TRANSPORT_SET_CHECK 패키지 이용

v Row 없이 전체 구조 Export 하기.(META정보)
v Import 전에 Target Databaseusername이 있는지 확인.

   사용자가 없을 경우 신규로 생성 또는 기존 user가 기본 Tablespace를 사용할 경우 임시 Tablespace로 변경.

v Tablespace 플러그인 후 전체 구조(META정보)Import하기.
v 운영 데이터이므로 연습 후 수행, Source Database 일정 기간 유지 클린(Clean up) 유의.



Posted by Tiwaz