|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
因此,我们的第一个“米”,就是二进制日志binlog必须是rowbased的。在rowbase下,二进制日志binlog同时记录了更新前后的整行记录。恢复|数据|数据库
比来经由过程做实行总结出一种数据库恢复办法,对从此的事情很有匡助:
数据库为非回档形态,只要一周前的数据文件的备份,无redolog,回档日记和controlfile的备份,此种情形一但数据库出妨碍只能做不完整恢复,会丧失一周前做备份时到出妨碍那一时分的一切数据,详细恢复办法以下:
操纵体系为solaris8,内存2G,2颗CPU.
实行步骤:
$sqlplus/nolog
SQL>connect/assysdba
SQL>archiveloglist
DatabaselogmodeNoArchiveMode
AutomaticarchivalEnabled
Archivedestination/opt/oracle/arch/ORCL
Oldestonlinelogsequence895
Currentlogsequence897
SQL>select*fromv$logfile;
GROUP#STATUS
-----------------
MEMBER
--------------------------------------------------------------------------------
3
/opt/oracle/db04/oradata/ORCL/redo03.log
2
/opt/oracle/db03/oradata/ORCL/redo02.log
1
/opt/oracle/db02/oradata/ORCL/redo01.log
SQL>select*fromv$controlfile;
STATUS
-------
NAME
--------------------------------------------------------------------------------
/opt/oracle/db02/oradata/ORCL/control01.ctl
/opt/oracle/db03/oradata/ORCL/control02.ctl
/opt/oracle/db04/oradata/ORCL/control03.ctl
SQL>alterdatabasebackupcontrolfiletotrace;
(备份把持文件,此时会在$ORACLE_BASE/admin/ORCL/udump目次里天生trace文件)
SQL>shutdownimmediate(封闭以后数据库)
Databaseclosed.
Databasedismounted.
ORACLEinstanceshutdown.
SQL>quit
Disconnected
摹拟数据丧失:
删除以后一切的数据文件,把持文件和redolog文件:
$rm-rf?/opt/oracle/db02/oradata/ORCL/*
$rm/opt/oracle/db03/oradata/ORCL/redo02.log
$rm/opt/oracle/db03/oradata/ORCL/control02.ctl
$rm/opt/oracle/db04/oradata/ORCL/redo03.log
$rm/opt/oracle/db04/oradata/ORCL/control03.ctl
把一周前备份的数据文件copy返来,目次布局和之前一样,但这时候由于没有redolog和controlfile文件,数据库只能启动到nomount形态:
编纂udump目次下天生的orcl_ora_7140.trc文件,把内里的创立controlfile的那部份内容粘贴上去放在SQL里实行:
(这里要注重必定要用resetlogs体例重修把持文件,resetlogs以后会天生新的redolog,而且把以后redofile的sequence置为1,不然创立把持文件会失利):
SQL>STARTUPNOMOUNT
SQL>CREATECONTROLFILEREUSEDATABASE"ORCL"RESETLOGSNOARCHIVELOG
2MAXLOGFILES32
3MAXLOGMEMBERS2
4MAXDATAFILES254
5MAXINSTANCES8
6MAXLOGHISTORY907
7LOGFILE
8GROUP1/opt/oracle/db02/oradata/ORCL/redo01.logSIZE50000K,
9GROUP2/opt/oracle/db03/oradata/ORCL/redo02.logSIZE50000K,
10GROUP3/opt/oracle/db04/oradata/ORCL/redo03.logSIZE50000K
11DATAFILE
12/opt/oracle/db02/oradata/ORCL/system01.dbf,
13/opt/oracle/db02/oradata/ORCL/tools01.dbf,
14/opt/oracle/db02/oradata/ORCL/rbs01.dbf,
15/opt/oracle/db02/oradata/ORCL/temp01.dbf,
16/opt/oracle/db02/oradata/ORCL/users01.dbf,
17/opt/oracle/db02/oradata/ORCL/indx01.dbf,
18/opt/oracle/db02/oradata/ORCL/drsys01.dbf,
19/opt/oracle/db02/oradata/ORCL/wacos.dbf,
20/opt/oracle/db02/oradata/ORCL/wacos01.dbf,
21/opt/oracle/db02/oradata/ORCL/wacos02.dbf,
22/opt/oracle/db02/oradata/ORCL/wacos03.dbf,
23/opt/oracle/db02/oradata/ORCL/wacos04.dbf,
24/opt/oracle/db02/oradata/ORCL/wacos05.dbf,
25/opt/oracle/db02/oradata/ORCL/wacos06.dbf,
26/opt/oracle/db02/oradata/ORCL/nms.dbf,
27/opt/oracle/db02/oradata/ORCL/test.dbf
28CHARACTERSETWE8ISO8859P1;
Controlfilecreated.
SQL>alterdatabaseopenresetlogs;(以resetlogs体例翻开数据库)
Databasealtered.
SQL>selectstatusfromv$instance;(反省数据库的形态)
STATUS
-------
OPEN
SQL>select*fromv$logfile;(反省logfile的形态)
GROUP#STATUS
-----------------
MEMBER
--------------------------------------------------------------------------------
3
/opt/oracle/db04/oradata/ORCL/redo03.log
2
/opt/oracle/db03/oradata/ORCL/redo02.log
1
/opt/oracle/db02/oradata/ORCL/redo01.log
SQL>select*fromv$controlfile;(反省把持文件的形态)
STATUS
-------
NAME
--------------------------------------------------------------------------------
/opt/oracle/db02/oradata/ORCL/control01.ctl
/opt/oracle/db03/oradata/ORCL/control02.ctl
/opt/oracle/db04/oradata/ORCL/control03.ctl
导致了一个使用几乎和mSQL一样的API接口的用于他们的数据库的新的SQL接口的产生,这样,这个API被设计成允许为用于mSQL而写的第三方代码更容易移植到MySQL。 |
|