이전 database에서 control file의 trace 본을 백업받은 후 해당 파일을 정리하면 새로운 control file을 생성하는 스크립트를 생성할 수 있다.

— Cron modify

— lsnrctl stop

script ReCre_Controlfile.log

shutdown immediate

startup

alter database backup controlfile to trace ;

alter database backup controlfile to ‘/ol0_orah01/oracle/adm/P01OL1/udump/CTRL20020916_Before’ ;

shutdown

startup nomount

mv /ol0_orah01/ORACLE/P01OL1/ctl/cntrlP01OL1805_1.dbf /ol0_orah01/ORACLE/P01OL1/ctl/cntrlP01OL1805_1.dbf_20020

916

mv /ol0_oras02/ORACLE/P01OL1/ctl/cntrlP01OL1805_2.dbf /ol0_oras02/ORACLE/P01OL1/ctl/cntrlP01OL1805_2.dbf_20020

916

@New_controlfile.sql – control file을 재생성하는 부분.

  • trace 로 받은 백업 control file에서 comment 부분을 모두 제거하고, 수정해야 하는 부분들을 고친다.

alter database open;

alter system switch logfile;

archive log list

alter database backup controlfile to trace ;

alter database backup controlfile to ‘/ol0_orah01/oracle/adm/P01OL1/udump/CTRL20020916_After’ ;

위와 같은 순서로 작업을 하게 되는데.. 이때 control file 을 create 하는 방법

Creating New Control Files

This section provides step-by-step instructions for creating new control files.

To Create New Control Files
  • Make a list of all datafiles and online redo log files of the database.

    If you followed the recommendations for database backups, you should already have a list of datafiles and online redo log files that reflect the current structure of the database.

    If you have no such lists and your control file has been damaged so that the database cannot be opened, try to locate all of the datafiles and online redo log files that constitute the database. Any files not specified in Step 5 are not recoverable once a new control file has been created. Moreover, if you omit any of the files that make up the SYSTEM tablespace, you might not be able to recover the database.

  • Shut down the database.

    If the database is open, shut down the database with normal priority, if possible. Use the IMMEDIATE or ABORT options only as a last resort.

  • Back up all datafiles and online redo log files of the database.
  • Start up an new instance, but do not mount or open the database. – nomount 상태로 startup 한다.(control file을 변경해야 하므로)
  • Create a new control file for the database using the CREATE CONTROLFILE statement.

    When creating the new control file, select the RESETLOGS option if you have lost any online redo log groups in addition to the control files. In this case, you will need to recover from the loss of the redo logs (Step 8). You must also specify the RESETLOGS option if you have renamed the database. Otherwise, select the NORESETLOGS option.

  • Store a backup of the new control file on an offline storage device.
  • Edit the initialization parameter file of the database.

    Edit the initialization parameter file of the database to indicate all of the control files created in Step 5 and Step 6 (not including the backup control file) in the CONTROL_FILES parameter. If you are renaming the database, edit the DB_NAME parameter to specify the new name.

  • Recover the database if necessary. If you are not recovering the database, skip to Step 9.

    If you are creating the control file as part of recovery, recover the database. If the new control file was created using the NORESETLOGS option (Step 5), you can recover the database with complete, closed database recovery.

    If the new control file was created using the RESETLOGS option, you must specify USING BACKUP CONTROL FILE. If you have lost online or archived redo logs or datafiles, use the procedures for recovering those files.

  • Open the database.

    Open the database using one of the following methods:

    • If you did not perform recovery, open the database normally.
    • If you performed complete, closed database recovery in Step 8, start up the database.
    • If you specified RESETLOGS when creating the control file, use the ALTER DATABASE statement, indicating RESETLOGS.

By haisins

오라클 DBA 박용석 입니다. haisins@gmail.com 으로 문의 주세요.

답글 남기기

이메일 주소를 발행하지 않을 것입니다. 필수 항목은 *(으)로 표시합니다