A method of arranging synchronization of databases, the method comprising the steps of: establishing a logical data transmission connection for synchronization according to Synchronized Markup Language synchronization protocol between a first and a second device which synchronize databases, transmitting a Last anchor, which is stored at least in the first device and describes the latest synchronization event the first and the second device have performed in the databases, during initialization of synchronization from the first device to the second device, and a Next anchor, which is defined by the first device and describes the present synchronization, storing temporarily said Next anchor in the first device and in the second device; comparing the Last anchor received in the second device with the Last anchor stored in the second device, performing synchronization in the requested manner if the received Last anchor corresponds to the stored Last anchors, synchronizing all data units of the databases if the received Last anchor does not correspond to the stored Last anchor; and updating the contents of the Last anchors stored in the devices with the contents of said temporarily stored Next anchor in the first device and in the second device if synchronization has been performed and after this said logical data transmission connection has been ended properly in a manner after which no transport layer messages are waited for, and not updating the contents of the Last anchors stored in the devices with the contents of said temporarily stored Next anchor in the first device and in the second device if the synchronization has not been performed and/or the logical data transmission connection has not been ended properly in a manner after which no transport layer messages are waited for. establishing a logical data transmission connection for synchronization according to Synchronized Markup Language synchronization protocol between a first and a second device which synchronize databases, transmitting a Last anchor, which is stored at least in the first device and describes the latest synchronization event the first and the second device have performed in the databases, during initialization of synchronization from the first device to the second device, and a Next anchor, which is defined by the first device and describes the present synchronization, storing temporarily said Next anchor in the first device and in the second device; comparing the Last anchor received in the second device with the Last anchor stored in the second device, performing synchronization in the requested manner if the received Last anchor corresponds to the stored Last anchors, synchronizing all data units of the databases if the received Last anchor does not correspond to the stored Last anchor; and updating the contents of the Last anchors stored in the devices with the contents of said temporarily stored Next anchor in the first device and in the second device if synchronization has been performed and after this said logical data transmission connection has been ended properly in a manner after which no transport layer messages are waited for, and not updating the contents of the Last anchors stored in the devices with the contents of said temporarily stored Next anchor in the first device and in the second device if the synchronization has not been performed and/or the logical data transmission connection has not been ended properly in a manner after which no transport layer messages are waited for.