Happy2Play 8281 Posted January 12, 2017 Share Posted January 12, 2017 Since I don't really know databases, I don't understand this procedure. Can someone break this down for someone who has no idea. What do you enter when it ask "Please specify the database name under which you want to access the attached database"? Where does that command go? Restore User Data Your user data is stored in our old library.db file, and we'll need to run some sql queries to import this into the new library.db in the new Emby Server installation. You'll need a Sqlite database editor such as DB Browser for Sqlite. You'll need to open the old library.db file, then attach the new library.db file. You can then migrate the data using: REPLACE INTO NewDB.userdata SELECT * FROM userdata Link to comment Share on other sites More sharing options...
Happy2Play 8281 Posted January 14, 2017 Author Share Posted January 14, 2017 Anyone? Link to comment Share on other sites More sharing options...
Vicpa 552 Posted January 14, 2017 Share Posted January 14, 2017 Hi @@Happy2Play I am a database guy and that message is confusing to me as well. Where does it show up? Is it in the "Backup Plugin"? Link to comment Share on other sites More sharing options...
Happy2Play 8281 Posted January 14, 2017 Author Share Posted January 14, 2017 @@Vicpa How to migrate Emby Server It is the new process since userdata_v2.db was merge into library.db in 3.1 Link to comment Share on other sites More sharing options...
Vicpa 552 Posted January 14, 2017 Share Posted January 14, 2017 Hi @@Happy2Play Oh sure then it is easy , Based on your posts and what I have. still one question Quote from the wiki Shutdown the old server instance and backup the following files and directories: /ProgramData/config/ProgramData/plugins/ProgramData/data/collections/ProgramData/data/playlists/ProgramData/data/displaypreferences.db /ProgramData/data/userdata_v2.db (if present)/ProgramData/data/users.db @@Luke userdata_v2.db isn't being updated any longer and was not auto deleted (which is fine) , if it is copied over it will import again right? If so you may want to add it as an optional step to the wiki with a warning that unless the replace is run, users and watched state etc will only be current as the date on the file. As this really isn't for the casual user.. another thought would be to add up front... That some basic familiarity with sql and SQLite tools is required to successfully complete this manually. @@Happy2Play the steps to run the replace will vary based on the tool (I am most familiar with SQLite Studio). Maybe we could put together a script ? Restore User Data Your user data is stored in our old library.db file, and we'll need to run some sql queries to import this into the new library.db in the new Emby Server installation. You'll need a Sqlite database editor such as DB Browser for Sqlite. You'll need to open the old library.db file, then attach the new library.db file. You can then migrate the data using: REPLACE INTO NewDB.userdata SELECT * FROM userdata Link to comment Share on other sites More sharing options...
Luke 37060 Posted January 14, 2017 Share Posted January 14, 2017 SqliteBrowser is pretty good as well. Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 2, 2017 Share Posted April 2, 2017 I have followed the process and opened the old library and attached the new one, using DB Browser for SQLIte. What do I do now with "REPLACE INTO NewDB.userdata SELECT * FROM userdata" Where exactly do I place that text? I never used this program before. THanks in advance Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 3, 2017 Share Posted April 3, 2017 Also when I attach the new library database, Db Browser asks me to type a database name: "Please specify the database name under which you want to access the attached database". What name should I type? Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 3, 2017 Share Posted April 3, 2017 When I run the SQL by placing the text in the EXECUTE SQL tab, I get the following no such table: NewDB.userdata: REPLACE INTO NewDB.userdata SELECT * FROM userdata Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 3, 2017 Share Posted April 3, 2017 BTW I have a premiere account, but my motherboard died so I had to do a clean reinstall of windows on a different hard-disk. So no way to create a backup for me.. Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 3, 2017 Share Posted April 3, 2017 So I started again and this time typed NewDB when DB Browser asks me to type a database name. It reports: "Query executed successfully: REPLACE INTO NewDB.userdata SELECT * FROM userdata (took 423ms)" Do I need to save anything now for it to work? I clicked on Write Changes as well. I restarted emby and no favourites or watched items or even names of useres have migrated across Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 3, 2017 Share Posted April 3, 2017 So I even tried exporting the userdata table and importing it back in as suggested in https://emby.media/community/index.php?/topic/46104-restore-user-data-emby-migration-clarification/ I get the same error message reported there: "There is already a table of that name and an import into an existing table is only possible if the numbers of columns match". This is so frustrating... Link to comment Share on other sites More sharing options...
ebr 14911 Posted April 3, 2017 Share Posted April 3, 2017 Has the scan completely finished on the new setup and everything is properly identified? Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 3, 2017 Share Posted April 3, 2017 yep that happened weeks ago all my movies are listed, it took days before the scan picked up everything. Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 4, 2017 Share Posted April 4, 2017 What if I deleted the userdata table and imported the old one? Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 5, 2017 Share Posted April 5, 2017 I exported and opened the old userdata table, it runs to TTK column in the spreadsheet, and the data is unintelligible to me ��! It only contains 59 rows. Is that right? Same number of rows (59) on the new table, but it runs only to SGZ columns. Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 5, 2017 Share Posted April 5, 2017 Deleted the table and tried importing the old one: Error importing table unrecognized token etc etc massive list error box Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 5, 2017 Share Posted April 5, 2017 Tried to plainly replace the new library file with the older one. None of the old favourites or watched movies are retained. Put the new one back in and i can see the new favorites and played items since I rebuilt the database. I am out of ideas here guys. Link to comment Share on other sites More sharing options...
gnollo 16 Posted April 5, 2017 Share Posted April 5, 2017 I discovered that you can use Macrium Reflect to build a Windows PE bootable disc to repair any boot issues. I will build one now and switch the old hard disk back and try to repair the windows 10 installation. If that works I can install the backup plugin and fix it that way. Link to comment Share on other sites More sharing options...
CaptainSandwich 0 Posted July 21, 2018 Share Posted July 21, 2018 So I started again and this time typed NewDB when DB Browser asks me to type a database name. It reports: "Query executed successfully: REPLACE INTO NewDB.userdata SELECT * FROM userdata (took 423ms)" Do I need to save anything now for it to work? I clicked on Write Changes as well. I restarted emby and no favourites or watched items or even names of useres have migrated across I'm also new to all this SQL stuff and have reached this point as well. My new database didn't have a 'userdata' table, so the replace command didn't intially work. After creating a userdata table in the new database, the replace command successfully ran. But, could someone please describe how this change is saved permanently to the database? After exiting dbviewer and opening the new database, the userdata table is still empty. Thanks muchly. Link to comment Share on other sites More sharing options...
Happy2Play 8281 Posted July 21, 2018 Author Share Posted July 21, 2018 I'm also new to all this SQL stuff and have reached this point as well. My new database didn't have a 'userdata' table, so the replace command didn't intially work. After creating a userdata table in the new database, the replace command successfully ran. But, could someone please describe how this change is saved permanently to the database? After exiting dbviewer and opening the new database, the userdata table is still empty. Thanks muchly. What program are you using to view the database? In DB Browser for SQLite when I make changes it ask me if I want to save when database is closed/exit. You can click "File" and select write changes (CTRL+s) also. Link to comment Share on other sites More sharing options...
Happy2Play 8281 Posted July 21, 2018 Author Share Posted July 21, 2018 Ideally you should use the "Server Configuration Backup" plugin for this . Link to comment Share on other sites More sharing options...
CaptainSandwich 0 Posted July 22, 2018 Share Posted July 22, 2018 What program are you using to view the database? In DB Browser for SQLite when I make changes it ask me if I want to save when database is closed/exit. You can click "File" and select write changes (CTRL+s) also. I'm using DB Browser for SQLite. Ah, looks like that did the trick. It threw me a little bit by asking if I wanted to save changes to the old database file. Ideally you should use the "Server Configuration Backup" plugin for this . Yeah, after the above the results weren't quite as expected. Tried the plugin and it looks to have worked a treat. Thanks! Link to comment Share on other sites More sharing options...
bradford 5 Posted July 26, 2018 Share Posted July 26, 2018 (edited) The new database I was importing into had a "UserDatas" table, but even after merging it didn't work (syncing up my view history). I used the plugin to restore a backup and it's the same thing, view history isn't synced. Edit - I stand corrected! The new install created a user 'emby' - I had to switch to the user that I backed up and imported to see the view history. Edited July 26, 2018 by bradford Link to comment Share on other sites More sharing options...
Luke 37060 Posted July 26, 2018 Share Posted July 26, 2018 @@bradford, with the 3.5 server release, the database table name has changed to UserDatas. I have updated our backup guide to reflect this: https://github.com/MediaBrowser/Wiki/wiki/Backup Thanks ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now