Question

Photo of Don Smallman

0

Migrating to a new server

Has anyone gone through the process of migrating from one server to another?  If so, can you share your experiance?

Thanks,
Don

  • Photo of Don Smallman

    0

    OK  Here is what I ended up doing.  Thank you, to all that commented on this issue.

    • Created a BACPAC file from the old SQL DB using SQL Management Studio.
    • Deleted the default database that RMS installed on the new server
    • Imported the BACPAC onto the new server
    • Renamed the wwroot folder on the new server to old_wwwroot
    • copied the wwwroot folder from the old server to the new server and voila!

     

    Since I kept the DB name and the DB username & password all the same, I did not have to make any changes to any config files.

    • Ken Roach

      Thanks, Don, for this elegant approach! I've expanded the steps below (for my own sake when I come to do this again down the track :) )


      How to use the BACPAC method to move servers:



      1. Connect to your old SQL db using SQL Management Studio.

      2. Right click your db, Tasks, Export data-tier Application.

      3. Next from Introduction, specify a local file name in Export Settings, Next, Finish. This saves the BACPAC.

      4. Create a new database and new user on your new server with the same database name, username and password as your old db. (It's important that you create the db from within Plesk (for 3essentials) so that the db is accessible in the list of dbs for your site.)

      5. Install Rock using this new database, as per the Rock instructions.
        5a. Flick the switch, and upgrade Rock until you get to the same version.

      6. From within SQL Server Management Studio, connect to your new server using your MS SQL system admin login. (In 3essentials this can be set here: Server, (Applications & Databases) Database Servers, click Local MS SQL Server link, Settings, then change the Authentication Adminstrator's username and password.)

      7. Expand the Database tree under your Server name and delete the database you created earlier.

      8. Right click 'Database', Import Data-tier Application, Next, specify the BACPAC to import (find it where you saved it), specify the name of the database your are creating (it will default to your old db name), Finish. This will create a copy of your db on your new server.

      9. Either
        9.1 Rename the httpdocs directory or delete its contents, then copy the contents of your old wwwroot directory (from Arvixe) into your httpdocs directory (on 3essentials).
        OR
        9.2.1 Copy over the PasswordKey and DataEncryptionKey from your old web.config file to your new web.config file (in Files, yourdomain, httpdocs).
        9.2.2 Edit the web.ConnectionStrings.config file, and change the database name, username and password so that Rock can access your db.

      10. Restart Rock and logon with an existing user.


      If you get a "Server Error in '/' Application." error message, edit web.config and set customErrors mode="Off". This will expand the error message. You might have the username and password wrong in the web.ConnectionStrings.config file.


      (The potential disadvantage of this approach, especially if your db is large, is that if the upload bombs out part way through you might need to start the BACPAC import again. Using the MS Visual Studio Tools method below allows you copy the db in smaller chunks.)

  • Photo of Ken Roach

    0

    Hi Don. Yes. I have.  Forced to move from Arvixe as a result of their problems.  I'll add more details this evening.  Short version:

    Set up new hosting server  (e.g. 3essentials).
    Used MS SqlServer Management Studio to create script export of old database.  Learned the hard way to make sure ANSI_PADDING settings are set to 'False' in Management Studio BEFORE doing the export, and/or check all ANSI_PADDING entries in the script file are to set ANSI_PADDING ON.  Create new databse on new server.  I uploaded the script file (in two parts) due to timeouts.  Then used MS Visual Studio to compare the two database on the two servers to ensure consistency in schema and data (TOOLS, SQL Server, Compare).  (Could have used Visual Studio to copy the database over.  I did try uploading the .BAK from Arvixe to 3essentials, but I didn't get that to work for some reason and didn't try to work out why.)  (Warning: deleting a database in 3essentials also deletes all backups linked to that database. Create the database. Create the backup file. Upload the backup file to overwrite the existing database.  Don't delete the database and then try to upload to reinstate it.)

    Downloaded and ran the Rock installer on the new server as per Rock instructions. Used a temporary database.  Then pointed Rock to my production database by editing the webconfig file.

    Unfortunately I pointed to my production db (the one I'd uploaded) before I ran the upgrade from 3.1 to 3.4. (Rock install downloads as 3.1 at the moment.)  Now I have an unresolved problem with editing variables in Workflows - there is a script error.  So I'm going to reinstate the production database, reinstall Rock using a new temporary database, upgrade from 3.1 to 3.4 (while pointing to the temporary database), THEN point to my production database, and see if that fixes the problem.  If not, then I'll try FTPing my entire web site from old server to the new server.  (This is just SO much slower than reinstalling.)

    Because I used the same web site name, I didn't have to make any config changes in my database.

    • Don Smallman

      Since I cannot login to the RMS Admin portal, does anyone know of a way to verify what version I am on, so I can install the correct version before migrating? I was on the latest version, but have not checked for upgrades for a couple of weeks.

    • Ken Roach

      Check out this page for dates of the releases: http://www.rockrms.com/Rock/ReleaseNotes.
      Check the __MigrationHistory table in your database.
      select * from __MigrationHistory will give you the date of the release package in its name, and a ProductVersion. Not sure how the product version relates to version 3.1 etc. Check the github site for Rock to see if you can make the link. Let me know if you find out.

    • Don Smallman

      Do you know if RMS will work with SQL 2012 Web Version? I assume so, since it will work with Express.

    • Don Smallman

      It says 6.1.0-30225 in the DB, and I don't see a way to make the connection to 3.4. Since the last update was 6/11, I must be on 3.4, because I know I have checked for upgrades since then.

    • Ken Roach

      Check in your packages.config file in your wwwroot directory.
      I have a line that reads
      package id="Antlr" version="3.5.0.2" targetFramework="net451" /

    • Don Smallman

      Thanks Ken, I will do that. Do you know what this line from the installation manual means? "SQL Server Express will work betst with fewer than 20,000 records". Is it referring to Rock RMS records or database records?


      I'm trying to figure out if SQL express will work for us.

    • Ken Roach

      (I'm just not sure if the Antlr line is relevant, now. 3.5 <> 3.4 (the latest Rock version).)


      I would think database records? We are a church of average Sunday attendance of around 200. There are 1756 people in our Person table, but 499,000 total rows in the db. 40% of these (206,000) are in the WorkflowLog table (I've been doing lots of testing - and this table is growing every 10 mins - need to look into this). Next largest table is PageViews (28% 138,000 rows), all the rest are smaller. Our History table is 31,000 (6%). (Hope that gives you some sense of scale.)

    • Don Smallman

      Ken, when you said that you "Used MS SqlServer Management Studio to create script export of old database". What script did you use? I have never exported an entire DB.


      Also, when I do the export, it only has one place to set ANSI Padding to "True". Is "True" the right options?

    • Ken Roach

      I will write up the process I followed and what I learned. In the meantime, Google 'how to generate script SQL server management studio'.



      1. In Management Studio right click your database, Tasks, Generate Scripts.

      2. Next, Choose Objects: 'Script entire database and all database objects.'

      3. Set Scripting Options:

        • save to specific location, and specify a file name.



      4. Click the Advanced button.

      5. Make sure ANSI Padding is FALSE, Script Logins is False, Script Owner is False (you wont be moving the logins and owner over, you'll be creating new ones on your new server(, Types of data to script - Schema and data, and I had Script Indexes, Primary Keys, Triggers and Unique Keys all True.

      6. When the script file is downloaded edit it. You might need to download emeditor if the file is large.

      7. Comment out all the lines that create the database, and any to do with logins.

      8. Make sure any ANSI PADDING is set to ON, and there are no other ANSI PADDING lines in the script. (this created problems). Read this: http://sqlmag.com/blog/sql-server-management-studio-s-ugly-ansipadding-bug.

      9. Create a new SQL database on your new server. Add a new user.

      10. On your PC where you downloaded the script open a Command Prompt window, and type:
        sqlcmd -S YourNewServerName -d YourNewDatabaseThatYouCreated -i TheNameOfYourScriptFile -o TheNameOfaTextOutputFile -U NewServerDatabaseUserName -P NewServerDatabasePassword -e

      11. I had to break my file into two to get it uploaded.


      I'll also document later how you can use Management Studio itself to copy the db across.

    • Trey Hendon III

      SQL Web Version is "higher" than SQL Express in the product line. Technically, Rock will perform better in SQL Web because SQL Web is allowed access to more resources on your server than SQL Express. Here's the MS comparison of the versions: https://msdn.microsoft.com/en-us/library/cc645993(v=sql.110).aspx


      You'll notice the biggest difference is that SQL Express can only access 1 GB ram while SQL Web can access up to 64 GB. Also, SQL Express's DB can only be 10GB and Web is effectively unlimited (524 PB).


      Those two limitations give our team pause to recommending SQL Express to any church over a 2,500 attenders that plan to use Rock for a long time. Granted, our stats to compare that against come from a different software, however, we feel the large-ticket data items saved in the DB are similar (person and check images) and know how quickly those images monopolized space in the other software.

    • Don Smallman

      Thanks Trey! Yes, I have read the docs, but there is no reference to the ANSI Padding settings that Ken is talking about.

    • Ken Roach

      The easier way to do this is to use MS Visual Studio Express.

      (I couldn't get the upload of a .bak database backup to work between Arvixe and 3essentials, but I might not have been doing it right.)



      1. Create a new database on your new server.

      2. Using Visual Studio, Tools, SQL Server, connect to your old database as Source, and your new database as Target.

      3. Use the compare tool to compare the schema. Update the schema.

      4. Use the compare tool to compare the data tables, then update the data tables. You might need to do this in groups. I found it bombed out if I tried to do my whole db in one go.


      After I successfully copied the database over I reinstalled Rock from a fresh download.



      1. Create a new database you can use during the install.

      2. Start with an empty directory, upload the Rock install Start file, and do the install as per Rock instructions.

      3. Run any upgrades so you get to the version of Rock you were on.

      4. Modify the web.ConnectionStrings.config file in your wwwroot or httpdocs directory. Change the name of your database to the database that contains your production data. (Assumes your host is 'localhost'.)

      5. Copy over the (PasswordKey, DataEncryptionKey) values from your old web.config on Arvixe to your new web.config on 3Essentials. This gives you access to your old passwords.


      Note : I am encountering a script error when editing Workflow variables. I'm not sure if this is a browser issue, or a result of the new install. So I'm not yet sure I've done everything that needs to be done...

    • Ken Roach

      When following the Rock instructions for Setting Permissions on the web directories I had to go into the Advanced button to give all subdirectories full permission.


      Don't forget to copy any pics you had in your old web site directories across.

  • Photo of Jay Greentree

    0

    If you do a right click in the browser and go to View Source it will have a Rock Genertor tag that will show your version of rock. If its 1.3.4 then you have version 3.4

    example: <meta name="generator" content="Rock v1.3.4.0" />
    • Ken Roach

      Thanks Jay! Now, any way to confirm what version of upgrades a database has got to? Or does it not matter: upgrades can be re-run on a database but will only apply once?

    • Arran France

      Hey Ken.
      The best way to see what version your DB is is to check out your migration history in the DB. That's the most accurate way of seeing what changes have occurred.
      I'm not quite sure what you mean by the second part of your question. If you're asking if migrations can be run multiple times the answer is that they won't if your DB has them listed in the migration history. It is possible to undo a migration though.