● clone DB를 이용한 incomplete recovery 실습2
◎ RMAN
실습순서
1. 실습을 위한 환경설정
① whole backup
② 테이블 생성 -> 데이터 입력 -> 테이블 삭제 (recovery 확인용)
2. clone DB를 이용한 복구
① password file 준비
② oracle net 설정(tnsnames.ora)
③ parameter file 생성
④ Start the Auxiliary Instance
⑤ Mount or Open the Target Database
⑥ Allocate Auxiliary Channels if Automatic Channels Are Not Configured
⑦ clone DB에서 export -> devdb로 import
1. 실습을 위한 환경설정
① whole backup
② 테이블 생성 -> 데이터 입력 -> 테이블 삭제 (recovery 확인용)
2. clone DB를 이용한 복구
① password file 준비
② oracle net 설정(tnsnames.ora)
③ parameter file 생성
④ Start the Auxiliary Instance
⑤ Mount or Open the Target Database
⑥ Allocate Auxiliary Channels if Automatic Channels Are Not Configured
⑦ clone DB에서 export -> devdb로 import
1. 실습을 위한 환경 설정 : ① whole backup
[oracle@ora10gr2 ~]$ mkdir /u01/app/oracle/oradata/devdb_rman_backup
[oracle@ora10gr2 ~]$ export ORACLE_SID=devdb
[oracle@ora10gr2 ~]$ export ORACLE_SID=devdb
[oracle@ora10gr2 ~]$ rman target /
connected to target database: DEVDB (DBID=610700147)
RMAN> backup database format='/u01/app/oracle/oradata/devdb_rman_backup/devdb_%d_%s_%p.bus';
RMAN> exit
1. 실습을 위한 환경 설정 : ② 테이블 생성 -> 데이터 입력 -> 테이블 삭제 (recovery 확인용)
[oracle@ora10gr2 ~]$ sqlplus / as sysdba
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> create table phil.t2 (col1 varchar2(20));
SQL> insert into phil.t2 values ('Recovery done!');
SQL> commit;
SQL> insert into phil.t2 values ('Recovery done!');
SQL> commit;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> -- 복구 시점 확인
SQL> !date
SQL> !date
2009. 12. 21. (월) 23:43:47 KST
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> -- 장애 발생
SQL> drop table phil.t2 purge;
SQL> exit
SQL> drop table phil.t2 purge;
SQL> exit
2. clone DB를 이용한 복구 : ① password file 준비
[oracle@ora10gr2 ~]$ cd
[oracle@ora10gr2 ~]$ cd $ORACLE_HOME/dbs
[oracle@ora10gr2 dbs]$ orapwd file=orapwdevdbaux password=oracle entries=5
[oracle@ora10gr2 ~]$ cd $ORACLE_HOME/dbs
[oracle@ora10gr2 dbs]$ orapwd file=orapwdevdbaux password=oracle entries=5
2. clone DB를 이용한 복구 : ② oracle net 설정(tnsnames.ora)
[oracle@ora10gr2 dbs]$ cd $ORACLE_HOME/network/admin
[oracle@ora10gr2 admin]$ vi tnsnames.ora
[oracle@ora10gr2 admin]$ vi tnsnames.ora
devdbaux =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = devdbaux)
)
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = devdbaux)
)
)
2. clone DB를 이용한 복구 : ③ parameter file 생성
[oracle@ora10gr2 admin]$ export ORACLE_SID=devdb
[oracle@ora10gr2 admin]$ sqlplus / as sysdba
[oracle@ora10gr2 admin]$ sqlplus / as sysdba
SQL> create pfile='$ORACLE_HOME/dbs/initdevdbaux.ora' from spfile;
SQL> !mkdir /u01/app/oracle/oradata/devdbaux
SQL> !vi $ORACLE_HOME/dbs/initdevdbaux.ora
DB_NAME=devdbaux
CONTROL_FILES='/u01/app/oracle/oradata/devdbaux/control01.ctl'
DB_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/devdb', '/u01/app/oracle/oradata/devdbaux')
LOG_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/devdb', '/u01/app/oracle/oradata/devdbaux')
db_block_size=4096
sga_target=200m
pga_aggregate_target=60m
CONTROL_FILES='/u01/app/oracle/oradata/devdbaux/control01.ctl'
DB_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/devdb', '/u01/app/oracle/oradata/devdbaux')
LOG_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/devdb', '/u01/app/oracle/oradata/devdbaux')
db_block_size=4096
sga_target=200m
pga_aggregate_target=60m
SQL> exit
2. clone DB를 이용한 복구 : ④ Start the Auxiliary Instance
[oracle@ora10gr2 ~]$ export ORACLE_SID=devdbaux
[oracle@ora10gr2 ~]$ sqlplus / as sysdba
SQL> startup force nomount
SQL> exit
[oracle@ora10gr2 ~]$ sqlplus / as sysdba
SQL> startup force nomount
SQL> exit
2. clone DB를 이용한 복구 : ⑤ Mount or Open the Target Database
[oracle@ora10gr2 ~]$ export ORACLE_SID=devdb
[oracle@ora10gr2 ~]$ sqlplus / as sysdba
SQL> startup force
SQL> exit
[oracle@ora10gr2 ~]$ sqlplus / as sysdba
SQL> startup force
SQL> exit
2. clone DB를 이용한 복구 : ⑥ Allocate Auxiliary Channels if Automatic Channels
Are Not Configured
[oracle@ora10gr2 ~]$ export ORACLE_SID=devdbaux
[oracle@ora10gr2 ~]$ export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
[oracle@ora10gr2 ~]$ export NLS_LANG=american
[oracle@ora10gr2 ~]$ rman TARGET sys/oracle@devdb AUXILIARY /
[oracle@ora10gr2 ~]$ export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
[oracle@ora10gr2 ~]$ export NLS_LANG=american
[oracle@ora10gr2 ~]$ rman TARGET sys/oracle@devdb AUXILIARY /
RMAN> run {
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
DUPLICATE TARGET DATABASE TO devdbaux UNTIL TIME '2009/12/21 23:43:47';
}
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
DUPLICATE TARGET DATABASE TO devdbaux UNTIL TIME '2009/12/21 23:43:47';
}
2. clone DB를 이용한 복구 : ⑦ clone DB에서 export -> devdb로 import
[oracle@ora10gr2 ~]$ export ORACLE_SID=devdbaux
[oracle@ora10gr2 dbs]$ sqlplus / as sysdba
[oracle@ora10gr2 dbs]$ sqlplus / as sysdba
SQL> select * from phil.t2;
COL1
--------------------
Recovery done!
--------------------
Recovery done!
SQL> !exp phil/phil file=t2.dmp tables=t2
SQL> exit
[oracle@ora10gr2 dbs]$ export ORACLE_SID=devdb
[oracle@ora10gr2 dbs]$ sqlplus phil/phil
[oracle@ora10gr2 dbs]$ sqlplus phil/phil
SQL> select * from t2;
select * from t2
*
ERROR at line 1:
ORA-00942: table or view does not exist
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> !imp phil/phil file=t2.dmp tables=t2
SQL> select * from t2;
SQL> select * from t2;
'Oracle > Backup & Recovery' 카테고리의 다른 글
Block Corruption (0) | 2009.12.23 |
---|---|
restore points (0) | 2009.12.23 |
clone DB를 이용한 incomplete recovery 실습1 : user managed (0) | 2009.12.22 |
MTTR (Mean Time To Recover) (0) | 2009.12.21 |
MTBF(Mean Time Between Failures) (0) | 2009.12.21 |