The invention provides a method for on-line migration of a database, The source database reads all the data blocks and all the changed data blocks in the source database on line, synchronizes them tothe target database, writes the data blocks to the local data file by the target database, and adds, deletes and modifies the data blocks locally by the target database, so as to achieve the consistent state with the source database. If across operate system platforms, Migration of file types, A target library-side database complete that conversion and writes the data block into a target databasedata file, Moreover, the invention also provides a device for online migration of a database, which not only can realize online migration of the database, but also can realize online migration of thedatabase across operating system platforms and across data file types, thereby reducing service interruption time, improving migration efficiency and lowering technical requirements for database migration engineers.