Tag Archive for migration

Migrating a vCenter and Update Manager Database from SQL 2008 to SQL 2012

SQLDB

Migration Options

There are 3 options available to migrate a SQL server database

  • Backup and Restore
  • Detach and Attach the Database
  • Copy the Database using SQL Server Management Studio

I am simply going to use the Copy the Database using SQL Server Management Studio option as this is quickest and easiest in my opinion

Instructions

  • On the Windows Server 2012 server, open the SQL Management Studio console and connect to the old SQL server instance. From the File menu choose Connect Object Explorer, or click the icon from the Object Explorer window.

Screen Shot 2016-08-22 at 10.36.48

  • Connect to your Windows Server 2008 R2 SQL Server

Screen Shot 2016-08-22 at 10.37.14

  • Now that we are connected to the old SQL server, right-click the database and choose Tasks > Copy Database.
  • You will get the Welcome to Copy Database wizard

Screen Shot 2016-08-22 at 10.41.18

  • The wizard will automatically knows the source server, but make sure you check it anyway. If is not the one you want, type it in the Source server box
  • Select whether to use Windows or SQL Authentication

Screen Shot 2016-08-22 at 11.42.09

  • On the destination server, the server name most likely will be wrong, so we need to type the correct one. Click Next when you’re done
  • Select whether to use Windows or SQL Authentication

Screen Shot 2016-08-22 at 11.42.21

  • Next you are on the Select a Transfer Method
  • Once source & destination server details given, you need to select the way by which you are going to copy move the database.
  • Detach Attach Faster methods, requires db to be offline. Users will be disconnected and physical files of the db will be copied to the destination server
  • SMO Slower method, db will be in online state. This will create the db in the destination server with the same name and copy all the datas from source. I used this method

Screen Shot 2016-08-22 at 11.42.35

  • Next Select the Database you want to move or copy. I kept mine as Copy as when it has finished copying I can simply take the original database offline

IMG_1358

  • On the Configure Destination Database Page, you need to provide the new db name and the path where CDW should place the physical files in the destination serve

IMG_1359

  • If there are any related objects to this database, select them, then press the arrow to move them to the right, to the Selected related objects section.

IMG_1360

  • On the Configure a Package

IMG_1361

  • In the next page you need to provide the package name and the log file for this process, so that you can review any failures.

IMG_1362

  • Check the details in the final wizard and click Finish

IMG_1363

  • All actions should have success next to them

IMG_1365

  • Refresh the console and you should see the database up and running on the new server.
  • There is one more step that applies to all three migration methods. The database needs to be put in a 2012 mode, or the latest version of your SQL server in case you are not using SQL 2012. This is to take advantage of all the features that the latest SQL edition provides. After the database has been moved, right-click it and choose Properties.
  • Click the Options page and on the Compatibility level box choose the latest edition of SQL server. In mine case is 2012. You have to be careful with this, because if you ever wanted to migrate the database to an older SQL version is not going to work. There are going to be incompatibility problems, so again…caution.

Screen Shot 2016-08-22 at 11.49.59

  • On the vCenter server, open the ODBC Connection and adjust the connection to point to the new SQL server
  • If the connection doesn’t work, check the logins on the new server as these can come across as disabled. Right click on the user account, select Properties > Status > Under Login, select Enabled
  • Next go to the original database and select to take offline. if you have problems taking the database offline then follow the link below to kill existing connections to the database

How to fix a SQL Server Database stuck going offline

Considerations

  • You cannot move system databases
  • Selecting move option will delete the source db once it moves the db to destination server
  • If you use SMO method to move full text catalogs then you need to repopulate it
  • SQL Server Agent should be running or else it will fail in job creation step
  • You cant move encrypted objects (like objects, certificates etc) using CDW

Using SQL Server Copy Database Wizard

SQLMigration

The Task

Move our SCOM DB from a Windows 2003 server running SQL 2005 to a Windows 2008 R2 server running SQL 2008.

The Plan

SQL Server has a copy Database functionality. The Copy Database Wizard provides a convenient way to transfer, move or copy, one or more databases and their objects from an SQL Server 2000 or SQL Server 2005 instance to an instance of SQL Server 2005 or higher.

SCOMDBUpgrade1

You can use the Copy Database Wizard to perform the following tasks:

  • Transfer a database when the database is still available to users by using the SQL Server Management Objects (SMO) method.
  • Transfer a database by the faster detach-and-attach method with the database unavailable during the transfer.
  • Transfer databases between different instances of SQL Server 2005.
  • Upgrade databases from SQL Server 2000 to SQL Server 2005.

Requirements

  • The destination server must be running SQL Server 2005 Service Pack 2 or a later version. The computer on which the Copy Database Wizard runs may be the source or destination server, or a separate computer. This computer must also be running SQL Server 2005 Service Pack 2 or a later version to use all the features of the wizard.
  • To use the Copy Database Wizard, you must be a member of the sysadmin fixed server role on the source and destination servers. To transfer databases by using the detach-and-attach method, you must have file system access to the file-system share that contains the source database files

Considerations

SCOMDBUpgrade2

Instructions

  • Open SQL Server Management Studio.
  • In Object Explorer, expand Databases, right-click a database, point to Tasks, and then click Copy Database.

Copydb01

  • Click Next

SCOMDBUpgrade3

  • Select the Database you want and choose the authentication

Copydb02

  • Select a destination server. You may need to browse for other servers. E.g I want to copy a database from my server dacvsq001 to dacvsql002

Copydb03

  • If you get an error saying “Index was outside the bounds of the array” you may need to install a higher version of SQL Management Studio on the source server
  • You can select to transfer while the DB is offline or online

Copydb04

  • Next select the database you want to copy or move

Copydb05

  • Here you can change the name of the database and also select the location of the database and logs to copy or move

Copydb06

  • Next you can select additional objects to copy

Copydb07

  • Specify a file share containing the source database files

Copydb08

  •  Configure the package

Copydb09

  • Run immediately or schedule the job

Copydb10

  • Check the details you have configured and click Finish

Copydb11