posted by I유령I 2010. 3. 15. 12:32
실제서버위치 : /home/oracle/oradata/testdb/
복구서버위치 : /data/temp/

1. Tablespace 생성 : ts_c <- 없으면 적당히 생성하세요
2. auser 생성 : default Tablespace를 ts_c로 지정한다.
3. auser 로 로그인해서 Table 생성(tbl_test)하고 Data 입력 후 commit;
4. drop user cascade로 auser 삭제

미션 : 복구서버에서 auser의 tbl_test를 복구해서 Export 받은 후 실제서버의 scott 계정으로 Import 시키세요



posted by I유령I 2010. 3. 15. 12:30
<장애 상황>
현재 운영중인 DB서버(이하 A서버)에서 며칠전에 scott의 테이블(tbl_wow)가 지워졌으니 복구해달라는 요청을 받았다.
해당 테이블이 있던 테이블스페이스도 삭제된 상황이다.
테이블 삭제 시간은 대략 알고 있으나 (drop table 후 시간 확인하세요) 현재 운영중인 A서버에서 작업을 할 수 없으므로 A 서버를 잠시 중지 시키고 모든 파일을 백업받아서 B서버에서 복구작업을 하기로 하였다.

<대략적인 작업 방법>
1. A 서버의 전체 파일들을 백업받아서 B서버로 옮긴다( /data/temp/ ).
2. B 서버에서 데이터 작업을 완료하고 알려준 시간으로 시간기반 불완전 복구를 한다.
3. B 서버에서 삭제된 테이블을 찾아 exp 받아서 현재 운영중인 A서버에 imp 시킨다.
4. A 서버에서 scott계정으로 확인하면 지워지기 전의 데이터 1,2,3 이 나와야 한다.

<작업 관련 사항>
1. 지워진 테이블 이름 : scott.tbl_wow (1,2,3 의 값이 입력되어 있었음)
2. 위 테이블이 들어있었던 테이블 스페이스 이름 : tbs_wow_01 <- 적당히 생성시키세요
3. A서버 원래디렉토리 : /home/oracle/oradata/testdb/
4. A서버 원본백업디렉토리 : /data/backup/close/
5. B서버 작업디렉토리 : /data/temp/




posted by I유령I 2010. 3. 15. 12:27
Export

$ exp userid = 유저명과 패스워드를 쓴다.   예제) userid = scott/tiger
file         = Export 받는 Dump File을 지정한다.   예제) file = /data/backup/0315.dmp
log          = Export 받을 때 Log File을 지정할 수 있다. log = /data/backup/0315.exp
*rows        = 데이타를 받을 것인지 아닌지를 지정한다. Default 값은 y 이다.   예제) rows = y
*constraints = Table에 셋팅된 제약 조건을 받을 것인지 지정한다. Default 값은 y 이다.   예제) constraints = y
*indexes     = Index를 받을 것인지를 지정한다. Default 값은 y 이다.   예제) indexes = y
tables       = 유저의 특정 Table을 받고자 할 때 사용된다.   예제) tables = 사원,부서 
               Default는 userid가 작성한 모든 Table을 받는다.          
compress     = Table을 위해 extebt된 값이 Storage 값의 INITIAL 값에 셋팅된다.
               Default 값은 compress = y 이지만, compress = n 이 안전하다.
*full        = userid가 system/manager나 dba 권한이 있는 유저일 경우 Database 전체를 exp 받을 수 있다.
          
exp 예제)
$ exp userid=system/manager file=/data/backup/0315.dmp log=/data/backup/0315.exp  full=y


< 연습 예제 >
1. scott 사용자의 모든 데이터를 전부 백업 받는 경우
$ exp userid=scott/tiger file=/data/backup/0315.dmp log=/data/backup/0315.exp

2. scott 유저의 constraint 와index 를 빼고 Synonym,View,Table 의 데이타만 받는 경우
$ exp userid=scott/tiger file=/data/backup/0315.dmp log=/data/backup/0315.exp rows=y constraints=n indexes=n

3. Data만 빼고 Index와 제약 조건만 받고자 한다면
$ exp userid=scott/tiger file=/data/backup/0315.dmp log=/data/backup/0315.exp rows=n constraints=y indexes=y

Export하면, Dunp File은 Export하는 User에 필요한 모든 사항들이 SQL 문장으로 작성된다.
즉,  CREATE TABLESPACE, CREATE TABEL ....,   CREATE  VIEW .., CREATE  INDEX .. INSERT INTO .... 문장으로 구성된다.
주의할 사항은 CREATE TABLE (..  ..) tablespace tbs_name;  과 같이 Table이나 Index의 Tablespace나 Storage값이 정의되므로 Table이 저장될 Tablespace의 위치를 바꾸고자 할 때는 단순  EXPort/IMPort 방법만으로는 안된다. 
그렇다고 이 화일을 직접 편집하면 Dump File이 손상되므로 직접 편집하면 안된다.



Import

$ imp userid=Import할 유저명. Export한 유저명과 동일해야 한다. 
file      = Export한 Dumf file명
log       = Import Log file
indexfile = Data를 Import하지 않고 CREATE INDEX 문장의 SQL로 File이 만들어진다.
rows      = Data를 Import할지의 여부를 선택한다. (y : n )
indexes   = Index를 Import할지의 여부를 선택한다. ( y : n )
fromuser  = 다른 User에게 Export File을 Import하고자 할 때 Export한 User를 지정한다.
touser    = Import할 User를 지정한다.
※ fromuser , touser 옵션은 system/manager User에서만 사용할 수 있다.
igore     = Import 도중 에러가 발생해도 무시하고 계속 진행한다.


< 연습 예제 >
1. 전체 Data 입력
$ imp userid=SYSTEM/password file=dba.dmp full=y

2. scott schema의 emp,dept만 입력
$ imp userid=SYSTEM/password file=dba.dmp fromuser=scott tables=(dept,emp) 

3. jinsu schema의 Table을 scott schema로 변경해서 입력
$ imp userid=SYSTEM/password fromuser=jinsu touser=scott FILE=jinsu.dmp tables=(emp,dept)

'Oracle 10g > 10g - Admin I' 카테고리의 다른 글

Restore & Recovery  (0) 2010.03.08
Backup  (0) 2010.03.08
sysdba 권한 로그인시 패스워드 지정  (0) 2010.03.05
프로파일 & 유저 관리 & 권한 관리  (0) 2010.03.05
Constraints (제약 조건)  (0) 2010.03.05
posted by I유령I 2010. 3. 15. 11:55
장애상황
Data file들만 남아있고 다른 모든 File(Redo log file, Control file)이 삭제된 상황.
Control file은 오래전에 Backup 받은 파일만 있다.
예전에 Backup 해놓은 Control file을 이용해서 Control file 재 생성 Script를 만들고 이 장애를 복구한다.

SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> select name from v$datafile; 

NAME
--------------------------------------------------
/home/oracle/oradata/testdb/system01.dbf
/home/oracle/oradata/testdb/undotbs01.dbf
/home/oracle/oradata/testdb/sysaux01.dbf
/home/oracle/oradata/testdb/users01.dbf
/home/oracle/oradata/testdb/example01.dbf
/home/oracle/oradata/testdb/ts_a01.dbf
/home/oracle/oradata/testdb/ts_b01.dbf
/home/oracle/oradata/testdb/ts_c01.dbf

8 rows selected.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------
/home/oracle/disk4/redo01_a.log
/home/oracle/disk5/redo01_b.log
/home/oracle/disk4/redo02_a.log
/home/oracle/disk5/redo02_b.log
/home/oracle/disk4/redo03_a.log
/home/oracle/disk5/redo03_b.log

6 rows selected.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/home/oracle/oradata/testdb/control01.ctl
/home/oracle/oradata/testdb/control02.ctl
/home/oracle/oradata/testdb/control03.ctl

#연습문제와 같이 장애를 발생시키기 위해 Redo log files와 Control file을 삭제하고 삭제 여부를 확인한다.
SQL> !rm -rf /home/oracle/disk4/*.log                                                  

SQL> !ls /home/oracle/disk4/*.log
ls: /home/oracle/disk4/*.log: 그런 파일이나 디렉토리가 없음

SQL> !rm -rf /home/oracle/disk5/*.log

SQL> !ls /home/oracle/disk5/*.log
ls: /home/oracle/disk5/*.log: 그런 파일이나 디렉토리가 없음

SQL> !rm -rf /home/oracle/oradata/testdb/*.ctl

SQL> !ls /home/oracle/oradata/testdb/*.ctl
ls: /home/oracle/oradata/testdb/*.ctl: 그런 파일이나 디렉토리가 없음

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
#Control file과 Redo log file이 삭제된 상태에서 DB를 시작할 경우 아래와 같은 에러가 발생한다.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info


SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
#예전에 Backup 받아놓은 Control file을 Server Parameter에 설정된 경로로 복사한다.
SQL> !cp /data/backup/redo_close/control01.ctl /home/oracle/oradata/testdb/control01.ctl

SQL> !cp /data/backup/redo_close/control01.ctl /home/oracle/oradata/testdb/control02.ctl

SQL> !cp /data/backup/redo_close/control01.ctl /home/oracle/oradata/testdb/control03.ctl

#현재 Control file은 예전에 Backup 받았던  Control file이기 때문에 아래와 같이 old control file 에러가 발생한다.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/home/oracle/oradata/testdb/system01.dbf'
ORA-01207: file is more recent than control file - old control file


#에러가 발생하면 Control file을 재 생성하는 Script를 생성한다.
SQL> alter database backup controlfile to trace as '/home/oracle/oradata/testdb/controlfile.sql';

Database altered.

#Control file 재 생성을 위해 Script 내용을 아래와 같이 수정한다.
SQL> !vi /home/oracle/oradata/testdb/controlfile.sql

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/home/oracle/disk4/redo01_a.log',
    '/home/oracle/disk5/redo01_b.log'
  ) SIZE 5M,
  GROUP 2 (
    '/home/oracle/disk4/redo02_a.log',
    '/home/oracle/disk5/redo02_b.log'
  ) SIZE 5M,
  GROUP 3 (
    '/home/oracle/disk4/redo03_a.log',
    '/home/oracle/disk5/redo03_b.log'
  ) SIZE 5M
DATAFILE
  '/home/oracle/oradata/testdb/system01.dbf',
  '/home/oracle/oradata/testdb/undotbs01.dbf',
  '/home/oracle/oradata/testdb/sysaux01.dbf',
  '/home/oracle/oradata/testdb/users01.dbf',
  '/home/oracle/oradata/testdb/example01.dbf',
  '/home/oracle/oradata/testdb/ts_a01.dbf',
  '/home/oracle/oradata/testdb/ts_b01.dbf',
  '/home/oracle/oradata/testdb/ts_c01.dbf'
CHARACTER SET KO16KSC5601
;
"~/oradata/testdb/controlfile.sql" 31L, 894C written

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
#Control file 재 생성을 위해 DB를 mount 단계로 시작하기 위해 사용했던 이전 Control file은 삭제한다.
SQL> !ls /home/oracle/oradata/testdb/*.ctl    
/home/oracle/oradata/testdb/control01.ctl  /home/oracle/oradata/testdb/control03.ctl
/home/oracle/oradata/testdb/control02.ctl

SQL> !rm -rf /home/oracle/oradata/testdb/*.ctl   

SQL> !ls /home/oracle/oradata/testdb/*.ctl
ls: /home/oracle/oradata/testdb/*.ctl: 그런 파일이나 디렉토리가 없음

#Control file 재 생성을 위해 수정해놓은 /home/oracle/oradata/testdb/controlfile.sql Script 파일을 실행한다.
SQL> @/home/oracle/oradata/testdb/controlfile.sql
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes

Control file created.

SQL> !ls /home/oracle/oradata/testdb/*.ctl
/home/oracle/oradata/testdb/control01.ctl  /home/oracle/oradata/testdb/control03.ctl
/home/oracle/oradata/testdb/control02.ctl

#DB를 open 상태로 전환하고 Data file, Redo log file, Control file을 확인한다.
SQL> alter database open resetlogs;

Database altered.

SQL> select name from v$datafile;

NAME
--------------------------------------------------
/home/oracle/oradata/testdb/system01.dbf
/home/oracle/oradata/testdb/undotbs01.dbf
/home/oracle/oradata/testdb/sysaux01.dbf
/home/oracle/oradata/testdb/users01.dbf
/home/oracle/oradata/testdb/example01.dbf
/home/oracle/oradata/testdb/ts_a01.dbf
/home/oracle/oradata/testdb/ts_b01.dbf
/home/oracle/oradata/testdb/ts_c01.dbf

8 rows selected.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------
/home/oracle/disk4/redo03_a.log
/home/oracle/disk5/redo03_b.log
/home/oracle/disk4/redo02_a.log
/home/oracle/disk5/redo02_b.log
/home/oracle/disk4/redo01_a.log
/home/oracle/disk5/redo01_b.log

6 rows selected.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/home/oracle/oradata/testdb/control01.ctl
/home/oracle/oradata/testdb/control02.ctl
/home/oracle/oradata/testdb/control03.ctl

SQL> 
posted by I유령I 2010. 3. 15. 11:26
Control File Multiplexing 작업순서
1. DB 종료
2. Parameter 수정
3. 파일 복사
4. DB 시작

SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/home/oracle/oradata/testdb/control01.ctl
/home/oracle/oradata/testdb/control02.ctl
/home/oracle/oradata/testdb/control03.ctl

위 내용을 아래와 같이 변경한다.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/data/disk1/control01.ctl
/data/disk2/control02.ctl
/data/disk3/control03.ctl


##Control File Multiplexing 과정
[oracle@ghost sql]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 15 10:32:20 2010

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/home/oracle/oradata/testdb/control01.ctl
/home/oracle/oradata/testdb/control02.ctl
/home/oracle/oradata/testdb/control03.ctl

#Control file의 다중화 및 경로 설정
#pfile 사용시
SQL> vi $ORACLE_HOME/dbs/inittestdb.ora
*.control_files='/data/disk1/control01.ctl','/data/disk2/control02.ctl','/data/disk3/control03.ctl'

#spfile 사용시
SQL> alter system set control_files='/data/disk1/control01.ctl',
  2  '/data/disk2/control02.ctl','/data/disk3/control03.ctl'
  3  scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> !mkdir /data/disk1 /data/disk2 /data/disk3

SQL> !cp /home/oracle/oradata/testdb/control01.ctl /data/disk1/control01.ctl 


##Control File Error #1
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info


SQL> !cp /data/disk1/control01.ctl /data/disk2/control02.ctl

SQL> !cp /data/disk1/control01.ctl /data/disk3/control03.ctl

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/data/disk1/control01.ctl
/data/disk2/control02.ctl
/data/disk3/control03.ctl

SQL> 


#Control File Error #2
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
#Control file의 버전이 다른 에러를 발생시키기 위해 이전에 Backup 받아놓은 Control file을 복사한다.
SQL> !cp /data/backup/redo_close/control03.ctl /data/disk3/control03.ctl

SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes
ORA-00214: control file '/data/disk1/control01.ctl' version 572 inconsistent with file '/data/disk3/control03.ctl' version 545


SQL> !cp /data/disk1/control01.ctl /data/disk3/control03.ctl

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL> 


##Control File 재 생성
SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/data/disk1/control01.ctl
/data/disk2/control02.ctl
/data/disk3/control03.ctl

SQL> select status from v$instance;

STATUS
------------
OPEN

#실습을 위해 각 디스크에 저장되어 있는 Control file을 모두 삭제한다.
SQL> !rm -rf /data/disk1/*.ctl

SQL> !ls /data/disk1/*.ctl
ls: /data/disk1/*.ctl: 그런 파일이나 디렉토리가 없음

SQL> !rm -rf /data/disk2/*.ctl

SQL> !ls /data/disk2/*.ctl
ls: /data/disk2/*.ctl: 그런 파일이나 디렉토리가 없음

SQL> !rm -rf /data/disk3/*.ctl

SQL> !ls /data/disk3/*.ctl  
ls: /data/disk3/*.ctl: 그런 파일이나 디렉토리가 없음

#Parameter에 지정된 user_dump_dest 경로에 *.trc 포맷으로 저장된다.
SQL> alter database backup controlfile to trace;              

Database altered.

#alter database backup controlfile to trace; 명령어 실행시 user_dump_dest 경로에 저장된다.
SQL> show parameter user_dump_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------------------------
user_dump_dest                       string      /home/oracle/admin/testdb/udump
SQL> alter database backup controlfile to trace as '/data/disk1/control01.sql';

Database altered.

#'/data/disk1/control01.sql' 파일 내용엔 NORESETLOGS와 RESETLOG 두 가지 형태의 스크립트가 존재한다.
#위 명령어로 생성한 '/data/disk1/control01.sql' 파일 내용을 아래와 같이 수정한다.
#파일 내용중 아래와 같은 공백이 있을 경우 에러가 발생하니 삭제한다.
#  ) SIZE 5M
#-- STANDBY LOGFILE <--- 행 삭제
# <--- 행 삭제
#DATAFILE

SQL> !vi /data/disk1/control01.sql

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/home/oracle/disk4/redo01_a.log',
    '/home/oracle/disk5/redo01_b.log'
  ) SIZE 5M,
  GROUP 2 (
    '/home/oracle/disk4/redo02_a.log',
    '/home/oracle/disk5/redo02_b.log'
  ) SIZE 5M,
  GROUP 3 (
    '/home/oracle/disk4/redo03_a.log',
    '/home/oracle/disk5/redo03_b.log'
  ) SIZE 5M
DATAFILE
  '/home/oracle/oradata/testdb/system01.dbf',
  '/home/oracle/oradata/testdb/undotbs01.dbf',
  '/home/oracle/oradata/testdb/sysaux01.dbf',
  '/home/oracle/oradata/testdb/users01.dbf',
  '/home/oracle/oradata/testdb/example01.dbf',
  '/home/oracle/oradata/testdb/ts_a01.dbf',
  '/home/oracle/oradata/testdb/ts_b01.dbf',
  '/home/oracle/oradata/testdb/ts_c01.dbf'
CHARACTER SET KO16KSC5601
;
"/data/disk1/control01.sql" 31L, 894C written

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> @/data/disk1/control01.sql
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              83887696 bytes
Database Buffers          197132288 bytes
Redo Buffers                2973696 bytes

Control file created.

SQL> !ls /data/disk1/*.ctl
/data/disk1/control01.ctl

SQL> !ls /data/disk2/*.ctl
/data/disk2/control02.ctl

SQL> !ls /data/disk3/*.ctl
/data/disk3/control03.ctl

SQL> alter database open resetlogs;

Database altered.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------
/data/disk1/control01.ctl
/data/disk2/control02.ctl
/data/disk3/control03.ctl

SQL> 



##control01.sql 파일 내용
[oracle@ghost disk1]$ more control01.sql 
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%s_%t_%r.arc
--
-- DB_UNIQUE_NAME="testdb"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_2='LOCATION=/data/arc2'
-- LOG_ARCHIVE_DEST_2='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_2='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_2='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_2='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_2='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_2=ENABLE
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/data/arc1'
-- LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/home/oracle/disk4/redo01_a.log',
    '/home/oracle/disk5/redo01_b.log'
  ) SIZE 5M,
  GROUP 2 (
    '/home/oracle/disk4/redo02_a.log',
    '/home/oracle/disk5/redo02_b.log'
  ) SIZE 5M,
  GROUP 3 (
    '/home/oracle/disk4/redo03_a.log',
    '/home/oracle/disk5/redo03_b.log'
  ) SIZE 5M
-- STANDBY LOGFILE

DATAFILE
  '/home/oracle/oradata/testdb/system01.dbf',
  '/home/oracle/oradata/testdb/undotbs01.dbf',
  '/home/oracle/oradata/testdb/sysaux01.dbf',
  '/home/oracle/oradata/testdb/users01.dbf',
  '/home/oracle/oradata/testdb/example01.dbf',
  '/home/oracle/oradata/testdb/ts_a01.dbf',
  '/home/oracle/oradata/testdb/ts_b01.dbf',
  '/home/oracle/oradata/testdb/ts_c01.dbf'
CHARACTER SET KO16KSC5601
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/data/arc2/1_1_562360180.arc';
-- ALTER DATABASE REGISTER LOGFILE '/data/arc2/1_1_710077424.arc';
-- ALTER DATABASE REGISTER LOGFILE '/data/arc2/1_1_713363612.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/home/oracle/oradata/testdb/temp01.dbf'
     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/home/oracle/disk4/redo01_a.log',
    '/home/oracle/disk5/redo01_b.log'
  ) SIZE 5M,
  GROUP 2 (
    '/home/oracle/disk4/redo02_a.log',
    '/home/oracle/disk5/redo02_b.log'
  ) SIZE 5M,
  GROUP 3 (
    '/home/oracle/disk4/redo03_a.log',
    '/home/oracle/disk5/redo03_b.log'
  ) SIZE 5M
-- STANDBY LOGFILE

DATAFILE
  '/home/oracle/oradata/testdb/system01.dbf',
  '/home/oracle/oradata/testdb/undotbs01.dbf',
  '/home/oracle/oradata/testdb/sysaux01.dbf',
  '/home/oracle/oradata/testdb/users01.dbf',
  '/home/oracle/oradata/testdb/example01.dbf',
  '/home/oracle/oradata/testdb/ts_a01.dbf',
  '/home/oracle/oradata/testdb/ts_b01.dbf',
  '/home/oracle/oradata/testdb/ts_c01.dbf'
CHARACTER SET KO16KSC5601
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/data/arc2/1_1_562360180.arc';
-- ALTER DATABASE REGISTER LOGFILE '/data/arc2/1_1_710077424.arc';
-- ALTER DATABASE REGISTER LOGFILE '/data/arc2/1_1_713363612.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/home/oracle/oradata/testdb/temp01.dbf'
     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--
[oracle@ghost disk1]$