通过 trace文件 备份控制文件controlfile

原文地址:通过 trace文件 备份控制文件controlfile 作者:laigq


备份控制文件及恢复

通过 trace 文件备份 控制文件
SQL> alter database backup controlfile to trace;

在 $ORACLE_BASE/admin/$ORACLE_SID/udump 目录下,生成的新的 trace 文件里有 生成控制文件的脚本
$su - oracle
$cd $ORACLE_BASE/admin/$ORACLE_SID/udump
$ls -l                                                               //查看最新的trc文件,可以发现控制文件的备份新在里面
-----------------------------------
--     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 "STUDY" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/oracle/oradata/study/redo01.log'  SIZE 50M,
  GROUP 2 '/oracle/oradata/study/redo02.log'  SIZE 50M,
  GROUP 3 '/oracle/oradata/study/redo03.log'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  '/oracle/oradata/study/system01.dbf',
  '/oracle/oradata/study/undotbs01.dbf',
  '/oracle/oradata/study/sysaux01.dbf',
  '/oracle/oradata/study/users01.dbf',
  '/oracle/oradata/study/studydata1.bdf',
  '/oracle/oradata/study/studydata2.bdf'
CHARACTER SET AL32UTF8
;
-- 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 '/oracle/flash_recovery_area/STUDY/archivelog/2009_12_16/o1_mf_1_1_%u_.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 '/oracle/oradata/study/temp01.dbf'
     SIZE 28311552  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.

注意: 里面已经包含 重建控制文件的脚本文件及相关步骤。在丢失控制文件时,可以通过该脚本进行恢复
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值