当前位置:Gxlcms > mysql > Oracle控制文件备份恢复noresetlogs恢复

Oracle控制文件备份恢复noresetlogs恢复

时间:2021-07-01 10:21:17 帮助过:23人阅读

控制文件的备份有两种格式的备份,一种是文本格式的备份另一种是二进制格式的备份 备份文本格式 SQLgt; alterdatabase backup c

控制文件的备份有两种格式的备份,一种是文本格式的备份另一种是二进制格式的备份

备份文本格式

SQL> alterdatabase backup controlfile to trace as '/bk/con.sql';

Databasealtered.

备份二进制格式

SQL> alterdatabase backup controlfile to trace as '/bk/con.ctl';

Databasealtered.

----加上as字句是为了自定义存储的位置

noresetlog重建控制文件SQL>!cp /etc/passwd /u01/tiger/oradata/orcl2/control01.ctl

SQL> altersystem swirch logfile;

alter systemswirch logfile

*

ERROR at line 1:

ORA-02065:illegal option for ALTER SYSTEM

SQL> altersystem switch logfile;

alter systemswitch logfile

*

ERROR at line 1:

ORA-03113:end-of-file on communication channel

SQL> conn /assysdba

Connected to anidle instance.

SQL> startup

Oracle instancestarted.

Total SystemGlobal Area 314572800 bytes

Fixed Size 1219136 bytes

VariableSize 109053376 bytes

DatabaseBuffers 197132288 bytes

RedoBuffers 7168000 bytes

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

这里发现当mount的时候发现控制文件有问题,,这样我们可以根据之前备份的控制文件的文本文件来恢复控制文件

CREATECONTROLFILE REUSE DATABASE "ORCL2" NORESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1'/u01/tiger/oradata/orcl2/redo01.log' SIZE 50M,

GROUP 2'/u01/tiger/oradata/orcl2/redo02.log' SIZE 50M,

GROUP 3'/u01/tiger/oradata/orcl2/redo03.log' SIZE50M

DATAFILE

'/u01/tiger/oradata/orcl2/system01.dbf',

'/u01/tiger/oradata/orcl2/tiger.dbf',

'/u01/tiger/oradata/orcl2/sysaux01.dbf',

'/u01/tiger/oradata/orcl2/users01.dbf',

'/u01/tiger/oradata/orcl2/undotbs02.dbf',

'/u01/tiger/oradata/orcl2/undotbs01',

'/u01/tiger/oradata/orcl2/tiger01.dbf'

CHARACTER SETZHS16GBK

SQL> alterdatabase open;

alter databaseopen

*

ERROR at line 1:

ORA-01113: file1 needs media recovery

ORA-01110: datafile 1: '/u01/tiger/oradata/orcl2/system01.dbf'

SQL> recoverdatabase;

Media recoverycomplete.

SQL> alterdatabase open;

Databasealtered.

linux

人气教程排行