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]$
'Oracle 10g > 10g - 실습' 카테고리의 다른 글
Datapump (0) | 2010.03.16 |
---|---|
Export / Import - Clone DB로 삭제된 데이터 복구하는 방법 (0) | 2010.03.16 |
Redo log file Recovery (0) | 2010.03.12 |
Incomplete Recovery - using backup controlfile (0) | 2010.03.11 |
Incomplete Recovery - Time Base (0) | 2010.03.10 |