Oracle控制文件管理

****控制文件作用:****记录了数据库的结构和行为,有多少个数据文件,日志文件及其位置名称,状态,维护数据库的一致性,即记录了数据库的启动SCN号和终止SCN号。

控制文件的位置和个数记录在参数文件中,通常控制文件采用多路复用的方式来存放管理,一个数据库中最多有8个控制文件,超过了不行,至少不行,默认创建数据库有3个控制文件。启动时由参数文件记录顺序决定控制文件使用顺序。

控制文件为二进制文件,一般不超过100m,数据库启动到mount阶段时读取控制文件内容,以后一直在用。控制文件记录了数据库名字,标示符,创建时间戳,表空间名字,日志文件名字,SCN号,归档备份信息、字符集等。

查找控制文件:

方法一:

SQL> show parameter control_file

NAME TYPE VALUE


control_file_record_keep_time integer 7

control_files string /u01/oracle/oradata/orcl/contr

ol01.ctl, /u01/oracle/oradata/

orcl/control02.ctl, /u01/oracl

e/oradata/orcl/control03.ctl

方法二:

SQL>col name for a29;

SQL>col value for a40;

SQL> select name,value from v$parameter where name like '%control_file%';

NAME VALUE


control_files /u01/oracle/oradata/orcl/control01.ctl,

/u01/oracle/oradata/orcl/control02.ctl,

/u01/oracle/oradata/orcl/control03.ctl

control_file_record_keep_time 7

方法三:

SQL> col name for a40;

SQL> select name,status from v$controlfile;

NAME STATUS


/u01/oracle/oradata/orcl/control01.ctl

/u01/oracle/oradata/orcl/control02.ctl

/u01/oracle/oradata/orcl/control03.ctl

查看控制文件记录内容:

方法一:

[oracle@localhost ~]$ strings /u01/oracle/oradata/orcl/control01.ctl

方法二:

SQL> alter database backup controlfile to trace as '/u01/oracle/controlfile.txt';

Database altered.

SQL> ho cat /u01/oracle/controlfile.txt

方法三:

SQL> desc v$controlfile_record_section

Name Null? Type


TYPE VARCHAR2(28)

RECORD_SIZE NUMBER

RECORDS_TOTAL NUMBER

RECORDS_USED NUMBER

FIRST_INDEX NUMBER

LAST_INDEX NUMBER

LAST_RECID NUMBER

SQL> select type,record_size from v$controlfile_record_section;

TYPE RECORD_SIZE


DATABASE 316

CKPT PROGRESS 8180

REDO THREAD 256

REDO LOG 72

DATAFILE 428

..........

方法三:转储控制文件内容

方法a:

SQL> alter system set events 'immediate trace name controlf level 10';

System altered.

SQL> show parameter user_d

NAME TYPE VALUE


user_dump_dest string /u01/oracle/admin/orcl/udump

[oracle@localhost ~]$ ll /u01/oracle/admin/orcl/udump并查看最新的文件信息

[oracle@localhost ~]$ cat /u01/oracle/admin/orcl/udump/orcl_ora_29296.trc

方法b:

SQL> oradebug setmypid

SQL> select spid from vprocess where addr=(select paddr from vsession where sid=(select sid from v$mystat where rownum=1));

SQL> oradebug dump controlf 3

SQL> show parameter user_d

SQL> ho ls /u01/oracle/admin/orcl/udump/

[oracle@localhost ~]$ cat /u01/oracle/admin/orcl/udump/orcl_ora_3223.trc

方法三(11g新增):

[root@localhost ~]# select value from v$diag_info where name='default trace file';

控制文件管理:

控制文件个数和位置的管理(多路复用):

通过spfile修改控制文件个数及位置:

将控制文件减少到1个:

SQL> alter system set control_files='/u01/oracle/oradata/orcl/control01.ctl' scope=spfile;

System altered.

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL> show parameter control_f

NAME TYPE VALUE


control_file_record_keep_time integer 7

control_files string /u01/oracle/oradata/orcl/contr

将控制文件增加到3个:

SQL> alter system set control_files='/u01/oracle/oradata/orcl/control01.ctl'

,'/u01/oracle/oradata/orcl/control02.ctl','/u01/oracle/oradata/orcl/control03.ctl' scope=spfile;

System altered.

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 677

inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 668

可以看到重启数据库报错version不一致,此时应该把高版本的copy给低版本即可:

SQL>exit

[oracle@localhost orcl]$ cp control01.ctl control02.ctl

[oracle@localhost orcl]$ cp control01.ctl control03.ctl

[oracle@localhost orcl]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 19:29:56 2015

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> startup force

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL> show parameter control_f

NAME TYPE VALUE


control_file_record_keep_time integer 7

control_files string /u01/oracle/oradata/orcl/contr

ol01.ctl, /u01/oracle/oradata/

orcl/control02.ctl, /u01/oracl

e/oradata/orcl/control03.ctl

查看控制文件状态:查看控制文件是否存在、磁盘空间是否够用、控制文件大小是否超过100m

SQL> show parameter control_f

NAME TYPE VALUE


control_file_record_keep_time integer 7

control_files string /u01/oracle/oradata/orcl/contr

ol01.ctl, /u01/oracle/oradata/

orcl/control02.ctl, /u01/oracl

e/oradata/orcl/control03.ctl

然后查看控制文件具体路径是否存在:

[oracle@localhost orcl]$ ls /u01/oracle/oradata/orcl/*.ctl

/u01/oracle/oradata/orcl/control01.ctl

/u01/oracle/oradata/orcl/control02.ctl

/u01/oracle/oradata/orcl/control03.ctl

查看磁盘容量是否够用:

[oracle@localhost orcl]$ df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

18G 11G 6.3G 62% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 506M 0 506M 0% /dev/shm

查看控制文件大小:如果超过100m,需要重建控制文件

[oracle@localhost orcl]$ ls -l /u01/oracle/oradata/orcl/*.ctl

-rw-r----- 1 oracle oinstall 7061504 03-15 19:38 /u01/oracle/oradata/orcl/control01.ctl

-rw-r----- 1 oracle oinstall 7061504 03-15 19:38 /u01/oracle/oradata/orcl/control02.ctl

-rw-r----- 1 oracle oinstall 7061504 03-15 19:38 /u01/oracle/oradata/orcl/control03.ctl

对控制文件的管理原则:

1.明确控制文件的名称和存储路径

参数设置错误将无法打开数据库,数据库打开以后,实例将同时写入所有的控制文件但是只会读取第一个控制文件的内容。

2.为数据库创建多路控制文件

a.多路控制文件内容必须完全一样,oracle实例同时将内容写入到control_files变量所设置的控制文件中。

b.初始化参数control_files中列出的第一个文件是数据库运行期间唯一可读取的控制文件。

c.创建,恢复和备份控制文件必须在数据库关闭的状态下运行,这样才能保证操作过程中控制文件不被修改。

d.数据库运行期间如果一个控制文件变为不可用,那么实例将不再运行,应该终止这个实例,并对破坏的控制文件进行修复。

3.将多路控制文件放在不同的硬盘上

4.采用操作系统镜像方式备份控制文件

5.手工方式备份控制文件

应该及时备份特别是发生了如下的操作的时候:

添加删除重命名数据文件

添加删除表空间,改变表空间读写状态

添加删除重做日志文件

控制文件备份:

1)热备:

SQL>alter database backup controlfile to '/u01/oracle/controlfile2015.bak';-->归档备份

SQL>alter database backup controlfile to trace as '/u01/oracle/controlfile2015.txt';

-->归档非归档均可备份

2)rman备份

[oracle@localhost orcl]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Mar 15 19:56:47 2015

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

connected to target database: ORCL (DBID=1401907058)

RMAN> backup current controlfile;

RMAN> backup database include current controlfile;

3)设置控制文件自动备份

RMAN> show all;

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/10g/dbs/snapcf_orcl.f'; # default

通过红色部分可以看出现在controlfile的自动备份是被off的,通过以下命令打开自动备份。

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON ;

恢复:

1)控制文件不一致解决办法:

查看控制文件版本号,复制新的给旧的;

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 677

inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 668

可以看到重启数据库报错version不一致,此时应该把高版本的copy给低版本即可:

SQL>exit

[oracle@localhost orcl]$ cp control01.ctl control02.ctl

[oracle@localhost orcl]$ cp control01.ctl control03.ctl

[oracle@localhost orcl]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 15 19:29:56 2015

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> startup force

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL>

修改spfile使用最新的控制文件。

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 677

inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 668

通过以上错误,我们看到了控制文件版本号,不一致,所以修改参数文件使用最新的版本号:

SQL> alter system set control_files='/u01/oracle/oradata/orcl/control01.ctl' scope=spfile;

System altered.

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

2)控制文件丢失有备份恢复方法

A、非归档、有全备需要重建控制文件。

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

ORA-00205: error in identifying control file, check alert log for more info

通过查看警告日志alert_orc.log, control04.ctl丢失,内容如下:

[oracle@localhost ~]$ vi /u01/oracle/admin/orcl/bdump/alert_orcl.log

4051 Sun Mar 15 20:46:44 2015

4052 ORA-00202: control file: '/u01/oracle/oradata/orcl/control04.ctl'

4053 ORA-27037: unable to obtain file status

4054 Linux Error: 2: No such file or directory

4055 Additional information: 3

4056 Sun Mar 15 20:46:47 2015

4057 ORA-205 signalled during: ALTER DATABASE MOUNT...

解决方法:1)如果存在多个控制文件,只丢失了其中一个控制文件,把存在的copy给丢失的即可解决。

2)如果所有控制文件都丢失了,重建数据库(最惨情况),可以通过控制文件转储文件或跟踪文件查看内容,恢复内容。

SQL> create controlfile reuse database orcl noarchivelog noresetlogs

2 maxlogfiles 16

3 maxinstances 8

4 maxlogmembers 3

5 maxloghistory 1

6 logfile

7 group 1 '/u01/oracle/oradata/orcl/redo01.log' size 50m,

8 group 2 '/u01/oracle/oradata/orcl/redo02.log' size 50m,

9 group 3 '/u01/oracle/oradata/orcl/redo03.log' size 50m

10 datafile

11 '/u01/oracle/oradata/orcl/example01.dbf',

....................

12 charecter set utf8

SQL>alter database open;

恢复数据库:SQL>recover database;

B、归档,有备份,控制文件丢失恢复

如果数据库不是归档模式,首先将数据库改为归档模式,方法如下:

SQL> archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 12

Current log sequence 14

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 83887720 bytes

Database Buffers 192937984 bytes

Redo Buffers 7168000 bytes

Database mounted.

SQL> alter database archivelog;

Database altered.

备份控制文件:

SQL> alter database backup controlfile to '/u01/oracle/ctl2015.ctl';

Database altered.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 88082024 bytes

Database Buffers 188743680 bytes

Redo Buffers 7168000 bytes

ORA-00205: error in identifying control file, check alert log for more info

通过查看alert_orcl.log文件可知control05.ctl文件丢失:

[oracle@localhost ~]$ vi /u01/oracle/admin/orcl/bdump/alert_orcl.log

ALTER DATABASE MOUNT

Mon Mar 16 07:55:45 2015

ORA-00202: control file: '/u01/oracle/oradata/orcl/control05.ctl'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

Mon Mar 16 07:55:48 2015

ORA-205 signalled during: ALTER DATABASE MOUNT...

copy备份文件到指定文件:

SQL> ho cp /u01/oracle/ctl2015.ctl /u01/oracle/oradata/orcl/control05.ctl

SQL> alter database mount;

Database altered.

SQL> alter database open;

alter database open

ERROR at line 1:

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database recover database using backup controlfile;

alter database recover database using backup controlfile

*

ERROR at line 1:

ORA-00279: change 855457 generated at 03/16/2015 07:48:55 needed for thread 1

ORA-00289: suggestion :

/u01/oracle/flash_recovery_area/ORCL/archivelog/2015_03_16/o1_mf_1_15_%u_.arc

ORA-00280: change 855457 for thread 1 is in sequence #15

SQL> alter database recover database using backup controlfile until change 855457;

alter database recover database using backup controlfile until change 855457

*

ERROR at line 1:

ORA-00275: media recovery has already been started

至此还是没能恢复控制文件,所以我们采取重建控制文件的方法恢复(也可以设置隐藏参数):

SQL> CREATE CONTROLFILE REUSE DATABASE orcl NORESETLOGS NOARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 logfile

8 GROUP 1 '/u01/oracle/oradata/orcl/redo01.log' SIZE 50M,

9 GROUP 2 '/u01/oracle/oradata/orcl/redo02.log' SIZE 50M,

10 GROUP 3 '/u01/oracle/oradata/orcl/redo03.log' SIZE 50m

11 datafile

12 '/u01/oracle/oradata/orcl/system01.dbf',

13 '/u01/oracle/oradata/orcl/undotbs01.dbf',

14 '/u01/oracle/oradata/orcl/sysaux01.dbf',

15 '/u01/oracle/oradata/orcl/users01.dbf',

16 '/u01/oracle/oradata/orcl/example01.dbf'

17 CHARACTER SET ZHS16GBK

18 /

Control file created.

SQL> alter database open;

Database altered.

SQL> select name,value from v$parameter where name like '%control_f%';

NAME VALUE


control_files /u01/oracle/oradata/orcl/control05.ctl

control_file_record_keep_time 7

至此控制文件恢复成功。

归档、有备份:正确恢复方式

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 100664936 bytes

Database Buffers 176160768 bytes

Redo Buffers 7168000 bytes

ORA-00205: error in identifying control file, check alert log for more info

SQL> ho cp /u01/oracle/ctl.ctl /u01/oracle/oradata/orcl/control01.ctl

SQL> ho cp /u01/oracle/ctl.ctl /u01/oracle/oradata/orcl/control02.ctl

SQL> ho cp /u01/oracle/ctl.ctl /u01/oracle/oradata/orcl/control03.ctl

SQL> shutdown

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 100664936 bytes

Database Buffers 176160768 bytes

Redo Buffers 7168000 bytes

Database mounted.

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01194: file 1 needs more recovery to be consistent

ORA-01110: data file 1: '/u01/oracle/oradata/orcl/system01.dbf'

SQL> alter database recover database using backup controlfile;

alter database recover database using backup controlfile

*

ERROR at line 1:

ORA-00279: change 864828 generated at 03/16/2015 10:04:20 needed for thread 1

ORA-00289: suggestion :

/u01/oracle/flash_recovery_area/ORCL/archivelog/2015_03_16/o1_mf_1_16_%u_.arc

ORA-00280: change 864828 for thread 1 is in sequence #16

SQL> shutdown

ORA-01013: user requested cancel of current operation

SQL> startup force

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 100664936 bytes

Database Buffers 176160768 bytes

Redo Buffers 7168000 bytes

Database mounted.

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1: '/u01/oracle/oradata/orcl/system01.dbf'

SQL> recover database;

ORA-00283: recovery session canceled due to errors

ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> recover database using backup controlfile;

ORA-00279: change 864828 generated at 03/16/2015 10:04:20 needed for thread 1

ORA-00289: suggestion :

/u01/oracle/flash_recovery_area/ORCL/archivelog/2015_03_16/o1_mf_1_16_%u_.arc

ORA-00280: change 864828 for thread 1 is in sequence #16

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

/u01/oracle/oradata/orcl/redo01.log

ORA-00310: archived log contains sequence 14; sequence 16 required

ORA-00334: archived log: '/u01/oracle/oradata/orcl/redo01.log'

SQL> recover database using backup controlfile;

ORA-00279: change 864828 generated at 03/16/2015 10:04:20 needed for thread 1

ORA-00289: suggestion :

/u01/oracle/flash_recovery_area/ORCL/archivelog/2015_03_16/o1_mf_1_16_%u_.arc

ORA-00280: change 864828 for thread 1 is in sequence #16

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

/u01/oracle/oradata/orcl/redo02.log

ORA-00310: archived log contains sequence 15; sequence 16 required

ORA-00334: archived log: '/u01/oracle/oradata/orcl/redo02.log'

SQL> recover database using backup controlfile;

ORA-00279: change 864828 generated at 03/16/2015 10:04:20 needed for thread 1

ORA-00289: suggestion :

/u01/oracle/flash_recovery_area/ORCL/archivelog/2015_03_16/o1_mf_1_16_%u_.arc

ORA-00280: change 864828 for thread 1 is in sequence #16

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

/u01/oracle/oradata/orcl/redo03.log

Log applied.

Media recovery complete.

SQL> alter database open resetlogs;

Database altered.

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 0

Next log sequence to archive 1

Current log sequence 1

SQL>

加隐藏参数恢复控制文件:

SQL> startup force

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 104859240 bytes

Database Buffers 171966464 bytes

Redo Buffers 7168000 bytes

ORA-00205: error in identifying control file, check alert log for more info

SQL> ho cp /u01/oracle/ctl.ctl /u01/oracle/oradata/orcl/control01.ctl

SQL> ho cp /u01/oracle/ctl.ctl /u01/oracle/oradata/orcl/control02.ctl

SQL> ho cp /u01/oracle/ctl.ctl /u01/oracle/oradata/orcl/control03.ctl

SQL> alter database mount

Database altered.

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database recover database using backup controlfile;

alter database recover database using backup controlfile

*

ERROR at line 1:

ORA-00283: recovery session canceled due to errors

ORA-19909: datafile 1 belongs to an orphan incarnation

ORA-01110: data file 1: '/u01/oracle/oradata/orcl/system01.dbf'

SQL> recover database;

ORA-00283: recovery session canceled due to errors

ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> recover database using backup controlfile;

ORA-00283: recovery session canceled due to errors

ORA-19909: datafile 1 belongs to an orphan incarnation

ORA-01110: data file 1: '/u01/oracle/oradata/orcl/system01.dbf'

SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.

SQL> startup force;

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218968 bytes

Variable Size 104859240 bytes

Database Buffers 171966464 bytes

Redo Buffers 7168000 bytes

Database mounted.

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01092: ORACLE instance terminated. Disconnection forced

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

[uniread] Saved history (486 lines)

[oracle@localhost orcl]$ sql / as sysdba

[uniread] Loaded history (486 lines)

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 16 11:16:46 2015

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 1218968 bytes

Variable Size 104859240 bytes

Database Buffers 171966464 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database open.

SQL>

删除隐藏参数:

SQL>alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*';

相关推荐
了一li1 小时前
Qt中的QProcess与Boost.Interprocess:实现多进程编程
服务器·数据库·qt
码农君莫笑2 小时前
信管通低代码信息管理系统应用平台
linux·数据库·windows·低代码·c#·.net·visual studio
别致的影分身2 小时前
使用C语言连接MySQL
数据库·mysql
京东零售技术4 小时前
“慢”增长时代的企业数据体系建设:超越数据中台
数据库
sdaxue.com4 小时前
帝国CMS:如何去掉帝国CMS登录界面的认证码登录
数据库·github·网站·帝国cms·认证码
o(╥﹏╥)5 小时前
linux(ubuntu )卡死怎么强制重启
linux·数据库·ubuntu·系统安全
阿里嘎多学长5 小时前
docker怎么部署高斯数据库
运维·数据库·docker·容器
Yuan_o_5 小时前
Linux 基本使用和程序部署
java·linux·运维·服务器·数据库·后端
Sunyanhui15 小时前
牛客网 SQL36查找后排序
数据库·sql·mysql
老王笔记5 小时前
MHA binlog server
数据库·mysql