'DB/oralce'에 해당되는 글 64건

  1. 2014.11.26 rac 백업
  2. 2014.11.24 Oracle RAC 용어 정리
  3. 2014.11.15 fff
  4. 2014.11.13 rman(recovery manager)
  5. 2014.11.12 flash back
  6. 2014.11.11 drop tablespace 장애 복구 - clone db 사용 정리할것..;;;
  7. 2014.11.07 temporary tablespace
  8. 2014.11.06 export/import 1 미완
  9. 2014.11.06 리두로그 장애3
  10. 2014.11.06 리두로그 장애2
2014. 11. 26. 10:55

[oracle@rac2 ~]$ crs_stat -t

Name           Type           Target    State     Host

------------------------------------------------------------

ora.rac.db     application    ONLINE    ONLINE    rac2

ora....vice.cs application    OFFLINE   OFFLINE

ora....ac1.srv application    OFFLINE   OFFLINE

ora....c1.inst application    ONLINE    ONLINE    rac1

ora....c2.inst application    ONLINE    ONLINE    rac2

ora....C1.lsnr application    ONLINE    ONLINE    rac1

ora.rac1.gsd   application    ONLINE    ONLINE    rac1

ora.rac1.ons   application    ONLINE    ONLINE    rac1

ora.rac1.vip   application    ONLINE    ONLINE    rac1

ora.rac2.gsd   application    ONLINE    ONLINE    rac2

ora.rac2.ons   application    ONLINE    ONLINE    rac2

ora.rac2.vip   application    ONLINE    ONLINE    rac2



위 두 개의 오프라인을 온라인으로 바꾸려면


[oracle@rac1 ~]$ crs_start -all

Attempting to start `ora.rac.olpt_service.cs` on member `rac1`

Attempting to start `ora.rac.olpt_service.rac1.srv` on member `rac1`

Start of `ora.rac.olpt_service.cs` on member `rac1` succeeded.

Start of `ora.rac.olpt_service.rac1.srv` on member `rac1` succeeded.

[oracle@rac1 ~]$ crs_stat -t

Name           Type           Target    State     Host

------------------------------------------------------------

ora.rac.db     application    ONLINE    ONLINE    rac2

ora....vice.cs application    ONLINE    ONLINE    rac1

ora....ac1.srv application    ONLINE    ONLINE    rac1

ora....c1.inst application    ONLINE    ONLINE    rac1

ora....c2.inst application    ONLINE    ONLINE    rac2

ora....C1.lsnr application    ONLINE    ONLINE    rac1

ora.rac1.gsd   application    ONLINE    ONLINE    rac1

ora.rac1.ons   application    ONLINE    ONLINE    rac1

ora.rac1.vip   application    ONLINE    ONLINE    rac1

ora.rac2.gsd   application    ONLINE    ONLINE    rac2

ora.rac2.ons   application    ONLINE    ONLINE    rac2

ora.rac2.vip   application    ONLINE    ONLINE    rac2


현재 orc 디스크를 확인하는 명령
[root@rac1 ~]# ocrcheck 
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     306968
         Used space (kbytes)      :       3584
         Available space (kbytes) :     303384
         ID                       :  228682162
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded

                                    Device/File not configured

         Cluster registry integrity check succeeded

자동 백업 내역 확인 명령
4시간 마다 / 매일 마다 / 매주 마다 자동적으로 실행됨
[root@rac1 ~]# ocrconfig -showbackup

rac1     2014/11/25 19:05:09     /home/oracle/product/10.2/crs/cdata/crs





rac1     2014/11/25 19:05:09     /home/oracle/product/10.2/crs/cdata/crs

rac1     2014/11/25 19:05:09     /home/oracle/product/10.2/crs/cdata/crs

실제 경로에 가면 백업된 파일을 확인 할 수 있음
가장 최신파일인 backup00.ocr 백업파일으로 복구에 사용함

[root@rac1 ~]# cd /home/oracle/product/10.2/crs/cdata/crs

[root@rac1 crs]# ls

backup00.ocr  day.ocr  week.ocr


dd명령어로 ocr disk 초기화 - 장애 발생시킴
[root@rac1 ~]# dd if=/dev/zero of=/dev/raw/raw1 bs=8k
dd: writing `/dev/raw/raw1': No space left on device
38401+0 records in
38400+0 records out
[root@rac1 ~]# dd if=/dev/zero of=/dev/raw/raw2 bs=8k
dd: writing `/dev/raw/raw2': No space left on device
38401+0 records in
38400+0 records out
[root@rac1 ~]# ocrcheck
Segmentation fault
[root@rac1 ~]# crsctl stop crs
Segmentation fault


백업된 OCR 파일을 이용 복원, 해결 확인
[root@rac1 ~]# ocrconfig -restore /home/oracle/product/10.2/crs/cdata/crs/backup00.ocr

[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly



[oracle@rac1 ~]$ cluvfy comp ocr -n all


OCR 무결성 확인 중


OCR 무결성을 검사하는 중...


클러스터화되지 않은 구성이 없는지 검사하는 중...

모든 노드에 클러스터화되지 않은 로컬 전용 구성이 없습니다.


OCR 장치에 대한 고유성 검사를 성공했습니다.


OCR 버전을 검사하는 중...

올바른 OCR 버전 "2"이(가) 존재합니다.


OCR에 대한 데이터 무결성을 검사하는 중...

OCR에 대한 데이터 무결성 검사를 성공했습니다.


OCR 무결성 검사를 성공했습니다.


OCR 무결성 확인 작업을 성공했습니다.



[oracle@rac1 ~]$ crsctl start crs

Insufficient user privileges.

[oracle@rac1 ~]$ su -

Password:

[root@rac1 ~]# crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly


'DB > oralce' 카테고리의 다른 글

oracle 저장 구조  (0) 2014.12.11
scan ip  (1) 2014.12.09
Oracle RAC 용어 정리  (0) 2014.11.24
fff  (0) 2014.11.15
rman(recovery manager)  (0) 2014.11.13
Posted by 성장하는yw
2014. 11. 24. 17:35

DBMS(Database Management Software)

다양한 데이터를 저장하고 사용자가 원할 경우, 조회, 수정 삭제 등의 작업을 해주는 프로그램


Single Server 구성

하나의 Database에 하나의 Instance 가 할당되는 구성

문제점 : Server에 장애가 발생하면 Storage에 저장된 데이터를 사용할 수 없음 



HA 구성

HA(High abailablity) = 고 가용성

서버 사용 가능 시간을 최대한으로 늘이는 것

24*7*365 = 24시간, 7일, 365일, 항상

무정지상태, 365일 중 DB가 꺼지는 시간이 짧을 수록 고 가용성이 좋다. 



문제점  

구성하는데 비용이 많이 듬 (두 개 모두 같은 사양)

스토리지를 2개 사용하기 때문에 데이터 동기화가 되지 않을 수 있음

장애시 해당 서버에 접속해 있던 연결들을 모두 종료 후 standby  서버가 가동됨, 그때 다시 접속이 되고,

Active 상태였던 서버에서 하던 모든 작업들은 전부 취소됨 


오라클에서의 Dataguard의 방식 : 

1대는 Active(운영 중 DB) / 1대는 Standby(문제가 생겼을 때 사용되는 대기DB)

Active에 서버 장애가 생길 경우, standby 서버가 제공되 서비스의 중단이 일어나지 않고 제공됨

 



Oracle Parallel Server(OPS) - 8i

하나의 데이터베이스에 여러 개의 인스턴스로 구성하는 방식




OPS의 경우에는 CTF나 TAF 라는 설정이 되어 있을 경우 기존 서버에 장애가 발생했을 경우 

해당 작업은 그대로 다른 서버로 이전 시킬 수 있음(단, 수행 중이던 작업 종류에 따라 다름)



문제점

RAC Ping 

두 개의 서버가 하나의 스토리지를 사용해서, 

instance1 서버에서 update 후 commit를 하면 

반드시 storage에 우선 저장 한 후 instance2로 가져와야 함. 

디스크, 즉 스토리지를 사용한 후 다른 서버가 읽어야 하기 때문에 시간이 오래 걸림





Real Application Cluster(RAC) - 9i

Cache Fusion(캐쉬 퓨전)

RAC ping 해결

서로 다른 instance에서 변경된 데이터를 디스크를 거치지 않고 바로 instance로 가져 올 수 있는 기능





'DB > oralce' 카테고리의 다른 글

scan ip  (1) 2014.12.09
rac 백업  (0) 2014.11.26
fff  (0) 2014.11.15
rman(recovery manager)  (0) 2014.11.13
flash back  (0) 2014.11.12
Posted by 성장하는yw
2014. 11. 15. 18:58


'DB > oralce' 카테고리의 다른 글

rac 백업  (0) 2014.11.26
Oracle RAC 용어 정리  (0) 2014.11.24
rman(recovery manager)  (0) 2014.11.13
flash back  (0) 2014.11.12
drop tablespace 장애 복구 - clone db 사용 정리할것..;;;  (0) 2014.11.11
Posted by 성장하는yw
2014. 11. 13. 18:14

RMAN(recovery manager)

오라클사에서 만든 백업, 복구 전용 유틸리티


- 여러가지 검증되지 않은 문제점

- RMAN 전용 새로운 명령어를 공부해야 함

- 9i까지는 많이 사용 X

- 10g ASM(Automatic Storage Management)기반의 백업 및 복구는 RMAN에서만 가능

   EXADATA(엑사데이타)도 RMAN를 알아야 사용 가능함


=> RMAN을 잘 공부해 두어야 함


특 징

- 자주 실행하는 작업을 스크립트로 저장가능


- 사용하지 않은 블록 건너뛰고 백업 수행

   현재 사용하고 있는 블록만 찾아 백업 수행


- 백업 수행 중 훼손된 블록 감지

   일반 백업  : 훼손된 블록이 있으면 장애 발생, 중단됨 

   RMAN      : 훼손된 블록 감지, 마킹 후 계속 백업 수행 


- 증분 블록 레벨 백업 기능을 지원

   과거에 백업 받은 내역을 조사, 그 기준 백업 이후에 변경된 블록만 찾아서 백업 수행함  

   시간, 메모리 절약가능

 예) 일반 백업 : 10G중에 1M의 내용만 있어도 전체 10G를 백업 다음날도 전체 10G 풀 백업 받음

       RMAN     : 1M만 백업 받고 다음 날 생긴 양만큼 백업 


- 백업 수행시 동시에 압축 가능



         


'DB > oralce' 카테고리의 다른 글

Oracle RAC 용어 정리  (0) 2014.11.24
fff  (0) 2014.11.15
flash back  (0) 2014.11.12
drop tablespace 장애 복구 - clone db 사용 정리할것..;;;  (0) 2014.11.11
temporary tablespace  (0) 2014.11.07
Posted by 성장하는yw
2014. 11. 12. 10:53


supplemental logging를 사용함으로 설정

alter database add supplemental log data;

  

SYS>select supplemental_log_data_min from v$database;


SUPPLEME

--------

YES




'DB > oralce' 카테고리의 다른 글

fff  (0) 2014.11.15
rman(recovery manager)  (0) 2014.11.13
drop tablespace 장애 복구 - clone db 사용 정리할것..;;;  (0) 2014.11.11
temporary tablespace  (0) 2014.11.07
export/import 1 미완  (0) 2014.11.06
Posted by 성장하는yw
2014. 11. 11. 18:21

1. DB (data, control, redo)를 닫힌 백업 수행


2. 테이블스페이스 생성


3. 테이블 생성


4. 테이블에 데이터 넣기


5. commit;


6. log switch 아카이브 파일에 내려쓰기 위해서 


7. 테이블 삭제


8. 테이블스페이스 삭제


나는 테이블 삭제를 하지 않고 전체로 그냥 테이블 스페이스를 삭제했다.


9. 복제할 파라미터 파일을 복사

-컨트롤파일 경로 변경

-DB 이름 변경

-메모리 타켓 주석처리(11g)


10. 원db에서 컨트롤 파일과 리두 파일을 만듬

 

11. 클론 DB에서 리커버

 

12. 리셋로그즈로 db 오픈

 

13. 테이블스페이스 / 테이블 복구 후 데이터 확인

 

14. 클론 DB에서 exp로 .dmp 파일을 만듬

 

15. 원디비에서 imp로 .dmp 파일로 데이터를 넣음



테이블 스페이스를 만들지 않으면 그 default tablespace에 그 테이블스페이스와 테이블의 내용이 저장된다. 


SYS>select file_name, tablespace_name from dba_data_files;


FILE_NAME                                          TABLESPACE

-------------------------------------------------- ----------

/data/temp7/example01.dbf                          EXAMPLE

/data/temp7/users01.dbf                            USERS

/data/temp7/undotbs01.dbf                          UNDOTBS1

/data/temp7/sysaux01.dbf                           SYSAUX

/data/temp7/system01.dbf                           SYSTEM

/data/temp7/test03.dbf                             TEST3

/data/temp7/test04.dbf                             TEST4


7 rows selected.


창을 testdb / clonedb 두개 띄워 놓고 작업하는 것이 헷갈리지 않고 좋다. 

만약 컨트롤 파일 생성이 되지 않는다면 ㅠ 

스크립트를 재생성해서 수정후 다시 돌려준다. 

수정하는 것을 아마 clonedb export 상태에서 했더나 하는 방법이 꼬인다면

문제가 생긴다. 

'DB > oralce' 카테고리의 다른 글

rman(recovery manager)  (0) 2014.11.13
flash back  (0) 2014.11.12
temporary tablespace  (0) 2014.11.07
export/import 1 미완  (0) 2014.11.06
리두로그 장애3  (0) 2014.11.06
Posted by 성장하는yw
2014. 11. 7. 12:05


DEFAULT TEMPORARY TABLESPACE(디폴트 임시 테이블스페이스) 란?

Oracle8i에서 기본적으로 사용자를 생성 할 때 정렬 작업등에 사용될 테이블스페이스를 지정하기 위하여 

CREATE USER명령에 TEMPORARY TABLESPACE 구문을 삽입할 수 있었습니다


만약 사용자를 생성할때 TEMPORARY TABLESPACE를 지정하지 않으면 

SYSTEM 테이블스페이스를TEMPORARY TABLESPACE로 사용을 하죠. 

이렇게 되면 시스템 테이블스페이스에 단편화가 발생할 수 있고, 

성능상의 문제가 발생할 수 있으므로 좋지가 않습니다.


 Oracle9i는 TEMPORARY TABLESPACE를 지정받지 않은 사용자는 

SYSTEM 테이블스페이스를 사용하는대신

DEFAULT TEMPORARY TABLESPACE을 사용합니다.


DEFAULT TEMPORARY TABLESPACE는 데이터베이스를 생성할 때 지정 할 수 있고, 

따로 임시 테이블스페이스 생성 한 후 데이터베이스에 지정 할 수도 있습니다.


이렇게 DEFAULT TEMPORARY TABLESPACE를 지정해 놓으면 

오라클 사용자가 SYSTEM 테이블스페이스를

TEMPORARY TABLESPACE로 사용하는것을 미연에 방지 할 수 있습니다.


DEFAULT TEMPORARY TABLESPACE 생성

 

-- OMF를 이용한 Locally Managed Temporary 테이블스페이스 생성

SQL> CREATE TEMPORARY TABLESPACE omf_temp

     TEMPFILE SIZE 50M 

     EXTENT MANAGEMENT LOCAL;

 


OMF 관련 해서는 'Oracle Managed Files (OMF)'강좌를 참고하세요. ^^

 

 

-- 일반적인 임시 테이블스페이스 생성

SQL> CREATE TEMPORARY TABLESPACE dflt_temp_tbs

     TEMPFILE 'C:\oracle\oradata\tbs\dflt_temp_tbs.dbf' 

     SIZE 50M;

    

    

-- 데이터베이스 지정 (omf_temp나 dflt_temp_tbs중 하나를 지정하시면 됩니다.)

SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE omf_temp;

데이타베이스가 변경되었습니다.

 

 

-- SCOTT사용자의 TEMPORARY_TABLESPACE가 변경된 것을 확인 할 수 있습니다.

SQL> SELECT username, temporary_tablespace

     FROM DBA_USERS 

     WHERE username = 'SCOTT';

 

USERNAME                   TEMPORARY_TABLESPACE

----------------------- ------------------------------

SCOTT                          OMF_TEMP

    



출처 : http://www.gurubee.net/lecture/1878


모든 유저의 템프테이블스페에스 확인하는 명령

SYS>select username, temporary_tablespace

  2  from dba_users;


USERNAME                       TEMPORARY_TABLESPACE

------------------------------ ------------------------------

SCOTT                                  TEMP100

ORACLE_OCM                        TEMP100

XS$NULL                               TEMP100

BI                                         TEMP100

PM                                       TEMP100

MDDATA                               TEMP100

IX                                         TEMP100

SH                                       TEMP100

DIP                                      TEMP100

OE                                       TEMP100

APEX_PUBLIC_USER                      TEMP100

HR                                               TEMP100

SPATIAL_CSW_ADMIN_USR             TEMP100

SPATIAL_WFS_ADMIN_USR             TEMP100

FLOWS_FILES                                TEMP100

MDSYS                                          TEMP100

ORDSYS                                        TEMP100

EXFSYS                                         TEMP100

DBSNMP                                       TEMP100

WMSYS                                         TEMP100

APPQOSSYS                                  TEMP100

APEX_030200                                TEMP100

OWBSYS_AUDIT                             TEMP100

ORDDATA                                     TEMP100

CTXSYS                                        TEMP100

ANONYMOUS                                TEMP100

SYSMAN                                       TEMP100

XDB                                             TEMP100

ORDPLUGINS                                TEMP100

OWBSYS                                      TEMP100

SI_INFORMTN_SCHEMA                 TEMP100

OLAPSYS                                     TEMP100

SYS                                             TEMP100

SYSTEM                                      TEMP100

OUTLN                                        TEMP100

MGMT_VIEW                                TEMP100


36 rows selected.





기본으로 설정되어 있는 템프페이블스페이스 조회하는 쿼리문

SYS>select *

  2  from database_properties

  3  where property_name like 'DEFAULT_T%';


PROPERTY_NAME

------------------------------

PROPERTY_VALUE

----------------------------------------------------------------------------------------------------

DESCRIPTION

----------------------------------------------------------------------------------------------------

DEFAULT_TEMP_TABLESPACE

TEMP001

Name of default temporary tablespace


DEFAULT_TBS_TYPE

SMALLFILE

Default tablespace type


현재 사용하고 있는 템프테이블스페이스 모두 조회
select tablespace_name,file_name from dba_temp_files;


'DB > oralce' 카테고리의 다른 글

flash back  (0) 2014.11.12
drop tablespace 장애 복구 - clone db 사용 정리할것..;;;  (0) 2014.11.11
export/import 1 미완  (0) 2014.11.06
리두로그 장애3  (0) 2014.11.06
리두로그 장애2  (0) 2014.11.06
Posted by 성장하는yw
2014. 11. 6. 18:20

1. conventional path로 full export 받기(기본모드)


SYS>!

[oracle@localhost ~]$ mkdir /data/exp/

[oracle@localhost ~]$ time exp system/oracle full=y file=/data/exp/full01.dmp log=/data/exp/full_log01.log

나는 하는 도중에 temp 테이블스페이스 없어서 에러가 났음
그래서 기본으로 temp 테이블 스페이스를 만들어주니까 정상적으로 작동함

....생략


. exporting posttables actions

. exporting triggers

. exporting materialized views

. exporting snapshot logs

. exporting job queues

. exporting refresh groups and children

. exporting dimensions

. exporting post-schema procedural objects and actions

. exporting user history table

. exporting default and system auditing options

. exporting statistics

Export terminated successfully with warnings.


real    4m13.880s

user    0m22.326s

sys     0m6.277s


약 4분 13초 걸림

2. direct path로 full export  받기

마지막에 옵션 하나만 더 추가함

[oracle@localhost ~]$ time exp system/oracle full=y file=/data/exp/full02.dmp log=/data/exp/full_log02.log direct=y


. exporting synonyms

. exporting views

. exporting referential integrity constraints

. exporting stored procedures

. exporting operators

. exporting indextypes

. exporting bitmap, functional and extensible indexes

. exporting posttables actions

. exporting triggers

. exporting materialized views

. exporting snapshot logs

. exporting job queues

. exporting refresh groups and children

. exporting dimensions

. exporting post-schema procedural objects and actions

. exporting user history table

. exporting default and system auditing options

. exporting statistics

Export terminated successfully with warnings.


real    3m11.137s

user    0m20.209s

sys     0m5.754s


약 3분 11초 걸림


3. export를 저장하는 파일을 분할해서 받기

큰 파일 하나를 여러 개의 작은 파일로 분할해서 백업받음


[oracle@localhost ~]$ time exp system/oracle full=y file=/data/exp/full03_1.dmp,\

/data/exp/full03_2.dmp,\

/data/exp/full03_3.dmp\

filesize=100M;


실행할 때 파일명을 고치지 않고 그대로 실행을 다시 하면 원본 파일을 그대로 물어보지 않고, 덮어써 버린다.

주의하자. 



. exporting posttables actions

. exporting triggers

. exporting materialized views

. exporting snapshot logs

. exporting job queues

. exporting refresh groups and children

. exporting dimensions

. exporting post-schema procedural objects and actions

. exporting user history table

. exporting default and system auditing options

. exporting statistics

Export terminated successfully with warnings.


real    2m45.807s

user    0m21.065s

sys     0m5.704s


그냥 확인해 봄 
[oracle@localhost ~]$ cd /data/exp
[oracle@localhost exp]$ ls
full01.dmp  full03_1.dmp  full_log01.log
full02.dmp  full03_2.dmp  full_log02.log

용량을 잘못 계산해서 파일 개수를 부족하게 지정할 경우는 추가적으로 파일 이름을 입력하도록 프롬프트가 나와서
사용자에게 다음 파일이름을 입력하라고 중간에서 대기하고 있음
그 때 파일 이름을 지정해주면 그 파일에 exp 됨

time exp system/oracle full=y file=/data/exp/full04_1.dmp, /data/exp/full04_2.dmp, /data/exp/fulll04_3.dmp filesize=10m;
...생략
. . exporting table         WWV_FLOW_RANDOM_IMAGES         42 rows exported
. . exporting table WWV_FLOW_REGION_CHART_SER_ATTR          0 rows exported
. . exporting table  WWV_FLOW_REGION_REPORT_COLUMN
Export file: expdat.dmp > /data/exp/full04_4.dmp 
...생략


위와 같이 파일 이름 입력해줌

한 세번 정도 떠서 각각 /data/exp/full04_5.dmp, /data/exp/full04_6.dmp ...이런식으로 계속 멈추면 원하는 파일명을 입력하면 됨


. exporting post-schema procedural objects and actions

. exporting user history table

. exporting default and system auditing options

. exporting statistics

Export terminated successfully with warnings.


real    7m11.178s

user    0m20.848s

sys     0m5.364s



4. 특정 tablespace 만 export 하기

[oracle@localhost ~]$ time exp system/oracle file=/data/exp/ex_user.dmp tablespaces=example, users


...생략

. . exporting table                TEST_NOVALIDATE          3 rows exported

. . exporting table                  TEST_VALIDATE          3 rows exported

. . exporting table                          TT111          1 rows exported

. . exporting table                 CATEGORIES_TAB         22 rows exported

. . exporting table     PRODUCT_REF_LIST_NESTEDTAB        288 rows exported

. . exporting table SUBCATEGORY_REF_LIST_NESTEDTAB         21 rows exported

EXP-00079: Data in table "PURCHASEORDER" is protected. Conventional path may only be exporting partial table.

. . exporting table                  PURCHASEORDER        132 rows exported

. exporting referential integrity constraints

. exporting triggers

Export terminated successfully with warnings.


real    0m18.972s

user    0m2.302s

sys     0m0.469s


5. 특정 table만 exp하기

[oracle@localhost ~]$ exp scott/tiger tables=emp,dept file=emp_dept.dmp;


Export: Release 11.2.0.2.0 - Production on Fri Nov 7 01:56:55 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.



Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production

With the Partitioning option

Export done in KO16MSWIN949 character set and AL16UTF16 NCHAR character set


About to export specified tables via Conventional Path ...

. . exporting table                            EMP         14 rows exported

. . exporting table                           DEPT          4 rows exported

Export terminated successfully without warnings.


현재 경로에 만들어진 것 확인

[oracle@localhost ~]$ ls

!           ar.sh      Desktop       hot_back.sql  redo.sql

afiedt.buf  cold_back  emp_dept.dmp  ll.sql        shut

a.out       database   expdat.dmp    login.sql     test_data.sql

arch.sql    dd.sql     hot_back      log.sql


6. 여러 사용자를 동시에 exp 하기


[oracle@localhost ~]$ time exp system/oracle file=/data/exp/scott_hr.emp owner=scott,hr;

... 생략

. exporting dimensions

. exporting post-schema procedural objects and actions

. exporting statistics

Export terminated successfully without warnings.


real    0m4.183s

user    0m0.120s

sys     0m0.023s


7. evaluation Buffer값이 export에 주는 영향 테스트 하기

실습을 위해 테스트용 테이블 생성

SQL> create table scott.test01

  2  (no number,

  3  name varchar2(50),

  4  address varchar2(50))

  5  tablespace users;


Table created.


대량의 데이터를 users tablespace에 입력하기 때문에 용량이 부족할 수 있으므로

용량을 충분히 늘려줌



SQL> @/home/oracle/dd.sql


TABLESPACE    MB FILE_NAME

---------- ----- --------------------------------------------------

EXAMPLE      346 /data/temp7/example01.dbf

USERS          8 /data/temp7/users01.dbf

UNDOTBS1      90 /data/temp7/undotbs01.dbf

SYSAUX       560 /data/temp7/sysaux01.dbf

SYSTEM       710 /data/temp7/system01.dbf


SQL> alter database datafile '/data/temp7/users01.dbf' autoextend on;


Database altered.


SQL> alter database datafile '/data/temp7/undotbs01.dbf' autoextend on;


Database altered.

SQL>begin

for i in 1..5000000 loop

insert into scott.test01

values(i, dbms_random.string('A',49),

             dbms_random.string('Q',49));

end loop;

commit;

end;

/


하지만 시간이 한 20~30분 잡아야 함 ㅠ 


생성 후 해당테이블 크기 확인

SYS> select sum(bytes)/1024/1024 MB

from dba_segments

where owner='SCOTT'

and segment_name='TEST01';


테스트 

1 .evaluation buffer 값을 설정하지 않고 export 수행

time exp scott/tiger file=/data/exp/test_01_1.dmp tables=test01;


2. evaluation buffer 값을 1M 설정하고 export 수행

time exp scott/tiger file=/data/exp/test_01_2.dmp tables=test01 buffer=1024000


3. evaluation buffer 값을 10M 설정하고 export 수행

time exp scott/tiger file=/data/exp/test_01_3.dmp tables=test01 buffer=10240000


4. evaluation buffer 값을 20M 설정하고 export 수행

time exp scott/tiger file=/data/exp/test_01_4.dmp tables=test01 buffer=20480000


5. direct path로 export 수행

time exp scott/tiger file=/data/exp/tect_01_5.dmp tables=test01 direct=y


결과 :

evaluation buffer 의 크기를 조절하면서 export를 수행하는 것이 속도에 영향을 미침

무조건 크기가 크다고 속도가 빨라지는 것이 아님

또 temporary tablespace의 크기도 exp/imp에 영향을 많이 줌

작업 전에 미리 큰 용량을 확보한 수 작업을 하자 


8. parameter file을 이용한 export 수행

[oracle@localhost ~]$ vi full.dat

file=/data/exp/full02.dmp

full=y

direct=y

:wq!


[oracle@localhost ~]$ exp system/oracle parfile=full.dat

9. 특정조건만 export 받기 - query 옵션 사용하기
test1. emp 테이블에서 이름 첫 글자가 F인 사람만 export 받기
(OS에서 사용하는 ' / " /  < 등의 문자를 쓸 경우 \ escape문자를 꼭!!! 써야함)
[oracle@localhost ~]$ exp scott/tiger query=\"where ename like \'F%\'\"tables=empfile=/data/exp/test06.dmp

test2. emp테이블에서 job이 clerk이고 급여가 1000이상인 사람만 export 받기



'DB > oralce' 카테고리의 다른 글

drop tablespace 장애 복구 - clone db 사용 정리할것..;;;  (0) 2014.11.11
temporary tablespace  (0) 2014.11.07
리두로그 장애3  (0) 2014.11.06
리두로그 장애2  (0) 2014.11.06
리두로그 장애1  (0) 2014.11.05
Posted by 성장하는yw
2014. 11. 6. 14:21

Current 아닌 그룹 중 archive 안 된 그룹이 삭제되고 DB open 상태일 경우


삭제된 그룹이 archive되지 않은 경우

서버 운영중에 특정 그룹이 지워진 후 계속 log switch가 발생하면 이와 같은 상황이 됨

DB에 archive hang 현상이 발생하여 중단 후 강제 비정상 종료됨

- 평소에 꾸준히 alert log 모니터링을 잘 해서 이런 상황을 막아야 함


현재상태 확인

SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   63 INACTIVE YES

     1 /data/temp7/redo01_b.log                         5   63 INACTIVE YES

     2 /data/temp7/redo02_a.log                        50   64 CURRENT  NO

     2 /data/temp7/redo02_b.log                        50   64 CURRENT  NO

     3 /data/temp7/redo03_a.log                        50    0 UNUSED   YES

     3 /data/temp7/redo03_b.log                        50    0 UNUSED   YES


6 rows selected.


SYS>alter system switch logfile;


System altered.


SYS>alter system switch logfile;


System altered.


SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   66 CURRENT  NO

     1 /data/temp7/redo01_b.log                         5   66 CURRENT  NO

     2 /data/temp7/redo02_a.log                        50   64 ACTIVE   YES

     2 /data/temp7/redo02_b.log                        50   64 ACTIVE   YES

     3 /data/temp7/redo03_a.log                        50   65 ACTIVE   YES

     3 /data/temp7/redo03_b.log                        50   65 ACTIVE   YES


6 rows selected.

 

SYS>alter system switch logfile;


System altered.


SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   66 INACTIVE YES

     1 /data/temp7/redo01_b.log                         5   66 INACTIVE YES

     2 /data/temp7/redo02_a.log                        50   67 CURRENT  NO

     2 /data/temp7/redo02_b.log                        50   67 CURRENT  NO

     3 /data/temp7/redo03_a.log                        50   65 INACTIVE YES

     3 /data/temp7/redo03_b.log                        50   65 INACTIVE YES


6 rows selected.


그룹삭제 (현재 archive 완료된 3번 그룹 삭제)

SYS>!rm -rf /data/temp7/redo03*


SYS>!ls /data/temp7/redo03*

ls: /data/temp7/redo03*: #׷# #####̳# ###丮## ###


SYS>!ls /data/temp7

control01.ctl  example01.dbf  redo02_a.log  system01.dbf  undotbs01.dbf

control02.ctl  redo01_a.log   redo02_b.log  temp01.dbf    users01.dbf

control03.ctl  redo01_b.log   sysaux01.dbf  temp02.dbf


log switch를 수차례 발생시켜 hang 상태 유발
hang이 되면 ctrl + c로 취소함

SYS>alter system switch logfile;

System altered.

SYS>alter system switch logfile;

System altered.

SYS>alter system switch logfile;

System altered.

SYS>/

alter system switch logfile

*

ERROR at line 1:

ORA-01013: user requested cancel of current operation


SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   69 INACTIVE  NO

     1 /data/temp7/redo01_b.log                         5   69 INACTIVE  NO

     2 /data/temp7/redo02_a.log                        50   70 CURRENT NO

     2 /data/temp7/redo02_b.log                        50   70 CURRENT NO

     3 /data/temp7/redo03_a.log                        50   68 INACTIVE  NO

     3 /data/temp7/redo03_b.log                        50   68 INACTIVE  NO


6 rows selected.


archive 부분은 전부 no
오라클은 archiving를 순서대로 하기 때문에 3번 다음에 1번 그룹으로 넘어가야 하는데
3번 파일이 없으므로 아카이빙이 안되고 그 뒤에 나머지도 아카이브가 되지 않음을 볼 수 있음
가장 작은 시퀀스에서부터 멈춘 것을 알 수 있음

alert log확인 후 원인 파악하기

[oracle@localhost ~]$ vi $ORACLE_BASE/diag/rdbms/testdb/testdb/trace/alert_testdb.log

Errors in file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_arc0_5152.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/data/temp7/redo03_b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/data/temp7/redo03_a.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Thu Nov 06 23:07:40 2014
Errors in file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_m000_5939.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/data/temp7/redo03_b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/data/temp7/redo03_a.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

장애해결

[oracle@localhost ~]$ exit

exit


SYS>alter database clear unarchived logfile group 3;


Database altered.


SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   69 INACTIVE YES

     1 /data/temp7/redo01_b.log                         5   69 INACTIVE YES

     2 /data/temp7/redo02_a.log                        50   70 CURRENT  NO

     2 /data/temp7/redo02_b.log                        50   70 CURRENT  NO

     3 /data/temp7/redo03_a.log                        50    0 UNUSED   YES

     3 /data/temp7/redo03_b.log                        50    0 UNUSED   YES


6 rows selected.


복구 끝!

SYS>alter system switch logfile;

System altered.

SYS>alter system switch logfile;

System altered.

SYS>/

System altered.

SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5   72 INACTIVE YES
     1 /data/temp7/redo01_b.log                         5   72 INACTIVE YES
     2 /data/temp7/redo02_a.log                        50   73 CURRENT  NO
     2 /data/temp7/redo02_b.log                        50   73 CURRENT  NO
     3 /data/temp7/redo03_a.log                        50   71 INACTIVE YES
     3 /data/temp7/redo03_b.log                        50   71 INACTIVE YES

6 rows selected.

위 상황은 

11g 이상 해결법


아래 상황은

10g 이하 해결법 (추가 할 것)

'DB > oralce' 카테고리의 다른 글

temporary tablespace  (0) 2014.11.07
export/import 1 미완  (0) 2014.11.06
리두로그 장애2  (0) 2014.11.06
리두로그 장애1  (0) 2014.11.05
리두로그마이너 - 정리 덜됨...엉망임;;  (0) 2014.11.05
Posted by 성장하는yw
2014. 11. 6. 13:41

archive 완료된 그룹이 지워진 후 DB Close 상태


current 아닌 active / inactive 하나의 그룹이 삭제된 후 DB가 종료된 경우


이 상황에서는 DB가 오픈되지 않음


살펴봐야 할 것

archive 완료 여부 :  삭제된 그룹이 삭제 전에 다른 곳으로 저장(archive) 해두었다면 별다른 문제 생기지 않음


장애이유

오라클이 시작할 때 control file을 읽음->지정된 redo log file을 읽으려고 시도 : 현재 os에는 리두로그 파일이 없지만 control file 내용 내에는 redo log file의 경로가 있기때문에 오류가 남


해결책

실제 파일이 없으므로 control file에수 해당그룹의 명단은 삭제


 SYS>startup

ORACLE instance started.


Total System Global Area  422670336 bytes

Fixed Size                  1344616 bytes

Variable Size             293604248 bytes

Database Buffers          121634816 bytes

Redo Buffers                6086656 bytes

Database mounted.

Database opened.


현재상태 확인

SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   63 CURRENT  NO

     1 /data/temp7/redo01_b.log                         5   63 CURRENT  NO

     2 /data/temp7/redo02_a.log                         5   62 INACTIVE YES

     2 /data/temp7/redo02_b.log                         5   62 INACTIVE YES


redo log file 삭제 후 장애 확인
SYS>!rm /data/temp7/redo02*

SYS>!ls /data/temp7/*.log
/data/temp7/redo01_a.log  /data/temp7/redo01_b.log

SYS>shutdown immediate
Database closed.
Database dismounted.
ORA-01013: user requested cancel of current operation

강제 종료되었다는 메시지
SYS>startup
ORA-03113: end-of-file on communication channel
SYS>startup
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist

그룹이 삭제되면 오라클이 시작되지 않고 강제 종료 됨

[oracle@localhost ~]$ vi /app/oracle/diag/rdbms/testdb/testdb/trace/alert_testdb.log
vi로 열고  대문자 G를 입력하면 파일의 맨 끝 화면으로 이동함
Thu Nov 06 20:10:06 2014
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x20006098] [PC:0x9A321FF, dbkdEventChk()+1503] [flags: 0x0, count: 1]
Errors in file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_4295.trc  (incident=69601):
ORA-07445: exception encountered: core dump [dbkdEventChk()+1503] [SIGSEGV] [ADDR:0x20006098] [PC:0x9A321FF] [Address not mapped to object] []
Incident details in: /app/oracle/diag/rdbms/testdb/testdb/incident/incdir_69601/testdb_ora_4295_i69601.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.

어라... 그런데 startup이 안 됨
위 작업시에 shutdown immdiate를 하면서 
중간에  putty에서 복사를 한다고 마우스 오른쪽을 클릭하는 바람에
정상적으로 db가 종료가 된 것이 아니라 abort로 종료가 되었음
그래서 startup 안 됨

어쩔 수 없이 계속 db open 이 안되는 상황이라서
startup force : shutdown abort를 하고 startup를 하는 기능을 해준다.

SYS> startup force
마운트까지 됨
그런데도 db가 죽어서 sqlplus 접속 종료를 하고 sqlplus로 재접속했음
다시 sqlplus로 접속 후 startup mount해 줌

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Nov 6 20:48:03 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to an idle instance.

SYS>startup mount
ORACLE instance started.

Total System Global Area  422670336 bytes
Fixed Size                  1344616 bytes
Variable Size             293604248 bytes
Database Buffers          121634816 bytes
Redo Buffers                6086656 bytes
Database mounted.

[oracle@localhost temp7]$ ls
control01.ctl  example01.dbf  sysaux01.dbf  temp02.dbf
control02.ctl  redo01_a.log   system01.dbf  undotbs01.dbf
control03.ctl  redo01_b.log   temp01.dbf    users01.dbf
[oracle@localhost temp7]$ exit
exit

SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5   63 CURRENT  NO
     1 /data/temp7/redo01_b.log                         5   63 CURRENT  NO
     2 /data/temp7/redo02_a.log                         5   62 INACTIVE YES
     2 /data/temp7/redo02_b.log                         5   62 INACTIVE YES

오라클에서 권장하는 최소는 그룹 2개에 멤버 1개씩인데 
여기서 내가 그룹2의 리두로그를 모두 지워버리면 이러한 원칙이 깨지게 된다. 
그래서 새로운 리두로그 그룹3을 추가하고 2를 삭제해야 한다.

SYS>alter database drop logfile group 2;
alter database drop logfile group 2
*
ERROR at line 1:
ORA-01567: dropping log 2 would leave less than 2 log files for instance testdb (thread 1)
ORA-00312: online log 2 thread 1: '/data/temp7/redo02_a.log'
ORA-00312: online log 2 thread 1: '/data/temp7/redo02_b.log'


SYS>ed
Wrote file afiedt.buf

  1  alter database add logfile group 3(
  2  '/data/temp7/redo03_a.log',
  3 '/data/temp7/redo03_b.log') size 50m
  4  /

SYS>alter database drop logfile group 2;

Database altered.

SYS>alter database open;

Database altered.

SYS>select member from v$logfile;

MEMBER
---------------------------------------------
/data/temp7/redo01_a.log
/data/temp7/redo01_b.log
/data/temp7/redo03_a.log
/data/temp7/redo03_b.log

오픈이 된다. 복구 완료!

SYS>ed
Wrote file afiedt.buf

  1  alter database add logfile group 2
  2  ('/data/temp7/redo02_a.log',
  3* '/data/temp7/redo02_b.log') size 50m
SYS>/

Database altered.

다시 2를 추가해준다.

SYS>select member from v$logfile;

MEMBER
---------------------------------------------
/data/temp7/redo02_a.log
/data/temp7/redo02_b.log
/data/temp7/redo01_a.log
/data/temp7/redo01_b.log
/data/temp7/redo03_a.log
/data/temp7/redo03_b.log

6 rows selected.


'DB > oralce' 카테고리의 다른 글

export/import 1 미완  (0) 2014.11.06
리두로그 장애3  (0) 2014.11.06
리두로그 장애1  (0) 2014.11.05
리두로그마이너 - 정리 덜됨...엉망임;;  (0) 2014.11.05
컨트롤 파일복구 3-1  (0) 2014.11.04
Posted by 성장하는yw