Chinaunix首页 | 论坛 | 博客
  • 博客访问: 655076
  • 博文数量: 70
  • 博客积分: 145
  • 博客等级: 入伍新兵
  • 技术积分: 1150
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-11 08:15
个人简介

没有简介就是最好的简介

文章分类

全部博文(70)

文章存档

2020年(1)

2018年(2)

2017年(3)

2016年(11)

2015年(12)

2014年(16)

2013年(19)

2012年(6)

我的朋友

分类: Oracle

2014-05-13 10:25:30

一、控制文件的定义

     控制文件是一个非常小的文件,最多能增长到64M左右,它包含其它数据库文件需要的目录。参数文件向实例提供控制文件的位置,控制文件向实例提供数据库文件和联机重做日志文件的具体信息。
      控制文件也包含数据库的一些其它信息,例如检查点发生的位置,数据库的名称,数据库创建的时间,归档日志的历史记录,RMAN的信息等。
      控制文件应该采用多路复用技术进行保护,应该copy多份,拷贝的文件应该分散在多个磁盘上避免磁盘故障造成全部丢失,丢失控制文件不是致命的,但是恢复起来相当麻烦。
Control Files
Control files are fairly small files (they can grow up to 64MB or so in extreme cases) that contain a directory of the other files Oracle needs. The parameter file tells the instance where the control files are, and the control files tell the instance where the database and online redo log files are.
The control files also tell Oracle other things, such as information about checkpoints that have taken place, the name of the database (which should match the db_nameparameter in the parameter file), the timestamp of the database as it was created, an archive redo log history (this can make a control file large in some cases), RMANinformation, and so on.
Control files should be multiplexed either by hardware(RAID) or by Oracle when RAID or mirroring is not available. More than one copy should exist, and the copies should be stored on separate disks to
avoid losing them in case you have a disk failure. It isnot fatal to lose your control files—it just makes recovery that much harder.
Control files are something a developer will probably never have to actually deal with. To a DBA, they are an important part of the database, but toa software developer they are not really relevant

二、控制文件的备份方法

1,使用rman备份的时候自动备份
configure controlfile autobackup on;在使用RMAN备份的时候自动备份控制文件
configure controlfile autobackup clear;清空配置的参数

2,使用命令手动备份
backup current controlfile;

[oracle@node0 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue May 13 09:19:43 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: HNJY (DBID=1400365636)

RMAN> backup current controlfile;

Starting backup at 13-MAY-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 13-MAY-14
channel ORA_DISK_1: finished piece 1 at 13-MAY-14
piece handle=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/02p85upu_1_1 tag=TAG20140513T091958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-MAY-14

Starting Control File and SPFILE Autobackup at 13-MAY-14
piece handle=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/c-1400365636-20140513-00 comment=NONE   备份文件的位置
Finished Control File and SPFILE Autobackup at 13-MAY-14

3,备份数据文件的时候同时备份控制文件
backup datafile 4 inculude current controlfile;
RMAN> backup datafile 5 include current controlfile;

Starting backup at 13-MAY-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/backuptest/example01.dbf
channel ORA_DISK_1: starting piece 1 at 13-MAY-14
channel ORA_DISK_1: finished piece 1 at 13-MAY-14
piece handle=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/04p85vcm_1_1 tag=TAG20140513T092958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 13-MAY-14
channel ORA_DISK_1: finished piece 1 at 13-MAY-14
piece handle=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/05p85vct_1_1 tag=TAG20140513T092958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-MAY-14

Starting Control File and SPFILE Autobackup at 13-MAY-14
piece handle=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/c-1400365636-20140513-01 comment=NONE
Finished Control File and SPFILE Autobackup at 13-MAY-14

4,在sql层面进行备份
SQL> alter database backup controlfile to trace as '/u01/app/oracle/oradata/hnjy/hotback/controlfile.trc';

Database altered.
SQL> !
[oracle@node0 ~]$ ls -l /u01/app/oracle/oradata/hnjy/hotback/controlfile.trc
-rw-r--r-- 1 oracle oinstall 6232 May 13 09:26 /u01/app/oracle/oradata/hnjy/hotback/controlfile.trc

三、控制文件的恢复

1,控制文件没有全部丢失
从其它的控制文件拷贝
[oracle@node0 backuptest]$ rm -f control01.ctl     模拟一个控制文件损坏
[oracle@node0 backuptest]$ exit
exit

SQL> shutdown immediate;
Database closed.
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/backuptest/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory    关闭的时候报错
Additional information: 3


SQL> shutdown abort;        强制关闭
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             553651792 bytes
Database Buffers          289406976 bytes
Redo Buffers                5132288 bytes
ORA-00205: error in identifying control file, check alert log for more info   启动的时候报错


SQL> shutdown abort;
ORACLE instance shut down.
SQL> !  
[oracle@node0 ~]$ cp /u01/app/backuptest/control02.ctl /u01/app/backuptest/control01.ctl   从其它地方拷贝
[oracle@node0 ~]$ exit
exit

SQL> startup
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             553651792 bytes
Database Buffers          289406976 bytes
Redo Buffers                5132288 bytes
Database mounted.
Database opened.
SQL>

2,所有控制文件全部丢失
从以前备份的control.trc中恢复,
# cat control.trc
-- 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=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="hnjy"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/archive'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER 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 "HNJY" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/u01/app/backuptest/redo01.log',
    '/u01/app/backuptest/redo1_1.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/u01/app/backuptest/redo02.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/u01/app/backuptest/redo03.log'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE

DATAFILE
  '/u01/app/backuptest/system01.dbf',
  '/u01/app/backuptest/sysaux01.dbf',
  '/u01/app/backuptest/undotbs01.dbf',
  '/u01/app/backuptest/users01.dbf',
  '/u01/app/backuptest/example01.dbf',
  '/u01/app/backuptest/vincent.dbf',
  '/u01/app/backuptest/untotbs2.dbf',
  '/u01/app/backuptest/system02.dbf',
  '/u01/app/backuptest/rman_10g_cat.dbf',
  '/u01/app/backuptest/app1_01.dbf'
CHARACTER SET WE8MSWIN1252
;

-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- 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 '/u01/app/archive/1_1_846774897.dbf';
-- 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 '/u01/app/backuptest/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 "HNJY" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/u01/app/backuptest/redo01.log',
    '/u01/app/backuptest/redo1_1.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/u01/app/backuptest/redo02.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/u01/app/backuptest/redo03.log'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE

DATAFILE
  '/u01/app/backuptest/system01.dbf',
  '/u01/app/backuptest/sysaux01.dbf',
  '/u01/app/backuptest/undotbs01.dbf',
  '/u01/app/backuptest/users01.dbf',
  '/u01/app/backuptest/example01.dbf',
  '/u01/app/backuptest/vincent.dbf',
  '/u01/app/backuptest/untotbs2.dbf',
  '/u01/app/backuptest/system02.dbf',
  '/u01/app/backuptest/rman_10g_cat.dbf',
  '/u01/app/backuptest/app1_01.dbf'
CHARACTER SET WE8MSWIN1252
;

-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- 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 '/u01/app/archive/1_1_846774897.dbf';
-- 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 '/u01/app/backuptest/temp01.dbf'
     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.
--

开始恢复
[oracle@node0 backuptest]$ rm -rf control0*    模拟破坏所有控制文件
[oracle@node0 backuptest]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 13 10:17:14 2014

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

Connected to an idle instance.

SQL> show parameter instance_name;
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0


SQL> startup;
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             553651792 bytes
Database Buffers          289406976 bytes
Redo Buffers                5132288 bytes
ORA-00205: error in identifying control file, check alert log for more info


SQL> shutdown abort;
ORACLE instance shut down.
SQL> STARTUP NOMOUNT    数据库启动于nomount状态
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             553651792 bytes
Database Buffers          289406976 bytes
Redo Buffers                5132288 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "HNJY" NORESETLOGS  ARCHIVELOG   开始执行命令
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '/u01/app/backuptest/redo01.log',
 10      '/u01/app/backuptest/redo1_1.log'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 '/u01/app/backuptest/redo02.log'  SIZE 50M BLOCKSIZE 512,
 13    GROUP 3 '/u01/app/backuptest/redo03.log'  SIZE 50M BLOCKSIZE 512
 14  DATAFILE
 15    '/u01/app/backuptest/system01.dbf',
 16    '/u01/app/backuptest/sysaux01.dbf',
 17    '/u01/app/backuptest/undotbs01.dbf',
 18    '/u01/app/backuptest/users01.dbf',
 19    '/u01/app/backuptest/example01.dbf',
 20    '/u01/app/backuptest/vincent.dbf',
 21    '/u01/app/backuptest/untotbs2.dbf',
 22    '/u01/app/backuptest/system02.dbf',
 23    '/u01/app/backuptest/rman_10g_cat.dbf',
 24    '/u01/app/backuptest/app1_01.dbf'
 25  CHARACTER SET WE8MSWIN1252
 26  ;

Control file created.

SQL> VARIABLE RECNO NUMBER;
SQL> EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');

PL/SQL procedure successfully completed.

SQL> RECOVER DATABASE
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required


SQL> ALTER SYSTEM ARCHIVE LOG ALL;

System altered.

SQL> ALTER DATABASE OPEN;    数据库正常启动,控制文件恢复正常。

Database altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/backuptest/temp01.dbf'
  2       SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

Tablespace altered.

SQL>

3,控制文件备份后数据库结构发生变化后的恢复

首先备份控制文件
$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue May 13 16:45:00 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database backup controlfile to '/u01/app/backuptest/control.trc';

Database altered.
SQL> create tablespace app3 datafile '/u01/app/oracle/oradata/hnjy/app3_01.dbf' size 10m;   创建新的表空间,数据库结构则发生变化。

Tablespace created.

SQL> conn usr1/oracle           
Connected.
SQL> create table test1(id int,name varchar(20)) tablespace app3;    在新的表空间中建表并插入数据

Table created.

SQL> insert into test1 values(0,'jobs');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from test1;

        ID NAME
---------- --------------------
         0 jobs
SQL> conn /as sysdba
Connected.
SQL> alter system switch logfile;  切换下日志

System altered.
[oracle@node0 hnjy]$ rm -rf control0*  删除所有的控制文件
QL> shutdown immediate;      关闭数据库的时候报错
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/hnjy/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL> shutdown abort;    强制关闭
ORACLE instance shut down.
SQL> !
[oracle@node0 backuptest]$ cp /u01/app/backuptest/control.
control.bin  control.trc  
[oracle@node0 backuptest]$ cp /u01/app/backuptest/control.trc /u01/app/oracle/oradata/hnjy/control01.ctl    将备份的数据文件拷贝回来
[oracle@node0 backuptest]$ cp /u01/app/backuptest/control.trc /u01/app/oracle/oradata/hnjy/control02.ctl
[oracle@node0 backuptest]$ cp /u01/app/backuptest/control.trc /u01/app/oracle/oradata/hnjy/control03.ctl
[oracle@node0 backuptest]$ exit
exit
开始恢复 
SQL> startup mount;    将数据库启动到mount状态
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             553651792 bytes
Database Buffers          289406976 bytes
Redo Buffers                5132288 bytes
Database mounted.
SQL> select file#,checkpoint_change# from v$datafile;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1172229
         2            1172229
         3            1172229
         4            1172229
         5            1172229
         6            1172229
         7            1172229
         8            1172229
         9            1172229
        10            1172229
        11            1172229

11 rows selected.

SQL> select file#,checkpoint_change# from v$datafile_header;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1172229
         2            1172229
         3            1172229
         4            1172229
         5            1172229
         6            1172229
         7            1172229
         8            1172229
         9            1172229
        10            1172229
        11            1172229

11 rows selected.

SQL> recover database using backup controlfile;     恢复的时候报错
ORA-00279: change 1172229 generated at 05/13/2014 16:41:24 needed for thread 1
ORA-00289: suggestion : /u01/app/archive/1_24_846774897.dbf
ORA-00280: change 1172229 for thread 1 is in sequence #24


Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to control file by media recovery 
ORA-01110: data file 12: '/u01/app/oracle/oradata/hnjy/app3_01.dbf'   


ORA-01112: media recovery not started


SQL> select file#,name from v$datafile;

     FILE# NAME
---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
         1 /u01/app/oracle/oradata/hnjy/system01.dbf
         2 /u01/app/oracle/oradata/hnjy/sysaux01.dbf
         3 /u01/app/oracle/oradata/hnjy/untotbs01.dbf
         4 /u01/app/oracle/oradata/hnjy/users01.dbf
         5 /u01/app/oracle/oradata/hnjy/example01.dbf
         6 /u01/app/oracle/oradata/hnjy/vincent.dbf
         7 /u01/app/oracle/oradata/hnjy/untotbs2.dbf
         8 /u01/app/oracle/oradata/hnjy/system02.dbf
         9 /u01/app/oracle/oradata/hnjy/rman_10g_cat.dbf
        10 /u01/app/oracle/oradata/hnjy/app1_01.dbf
        11 /u01/app/oracle/oradata/hnjy/app2_01.dbf

     FILE# NAME
---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        12 /u01/app/oracle/product/11.2.0/dbhome_2/dbs/UNNAMED00012      数据文件12在控制文件中找不到相关的信息

12 rows selected.

SQL> alter database rename file '/u01/app/oracle/product/11.2.0/dbhome_2/dbs/UNNAMED00012' to '/u01/app/oracle/oradata/hnjy/app3_01.dbf';  更改备份后增加的数据文件的名称

Database altered.

SQL> recover database using backup controlfile;   再次进行恢复
ORA-00279: change 1172508 generated at 05/13/2014 16:48:28 needed for thread 1
ORA-00289: suggestion : /u01/app/archive/1_24_846774897.dbf
ORA-00280: change 1172508 for thread 1 is in sequence #24


Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 1172843 generated at 05/13/2014 16:50:41 needed for thread 1
ORA-00289: suggestion : /u01/app/archive/1_25_846774897.dbf
ORA-00280: change 1172843 for thread 1 is in sequence #25
ORA-00278: log file '/u01/app/archive/1_24_846774897.dbf' no longer needed for this recovery   提示找不到这个归档日志文件


ORA-00308: cannot open archived log '/u01/app/archive/1_25_846774897.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3


SQL> recover database using backup controlfile;
ORA-00279: change 1172843 generated at 05/13/2014 16:50:41 needed for thread 1
ORA-00289: suggestion : /u01/app/archive/1_25_846774897.dbf
ORA-00280: change 1172843 for thread 1 is in sequence #25


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/backuptest/redo01.log    从联机重做日志文件中查找
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;  开启数据库

Database altered.

SQL> show parameter instance_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      hnjy
SQL> select * from test1;
select * from test1
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> select * from usr1.test1;   数据访问正常

        ID NAME
---------- --------------------
         0 jobs

小提示:control_files包含多个控制文件,数据库在使用的时候同时向多个控制文件写,但是读的时候只读第一个,任何一个控制文件损坏,数据库则不能使用。


阅读(10001) | 评论(0) | 转发(2) |
2

上一篇:rman增量备份

下一篇:开启autotrace报错

给主人留下些什么吧!~~