The invention relates to the technical field of
database synchronization, and provides a
data synchronization method and device based on
database restoration, and the method comprises the steps that a source end synchronization tool obtains a
backup file generated by a source end
database; sending the
backup file to a destination synchronization tool to enable the destination synchronization tool to obtain a
reference database; obtaining a minimum log serial number corresponding to an active transaction in a source end database at the
backup starting moment and a maximum log serial number corresponding to the backup finishing moment; reading an operation log of which the log serial number is greater than the minimum log serial number in a log file of the source end database, and modifying a submission operation of which the log serial number is less than or equal to the maximum log serial number into a
rollback operation to obtain a target operation log, the target end synchronization tool carries out
data synchronization on the target end database according to the
reference database and the target operation log. According to the method, the consistency of the data is effectively maintained on the premise that the active transaction is automatically rolled back after the backup of the destination end database is restored.