If the 32 bit (x86) version of SQL Server has been installed on a Windows x64 system, and you want to migrate the entire SQL Server up to the x64 edition, follow these steps.
All databases, and logins, passwords, and scheduled jobs are preserved.
Step-by-step guide
- Disable SQL Agent service to prevent backups and other scheduled jobs from interrupting
- Shrink databases + log
Shrinking is optional, but reducing database sizes will make backups smaller and faster. Do this for each database of significant size or interest.
DBCC SHRINKFILE (N'logicalfilenamefordata', 100) GO DBCC SHRINKFILE (N'logicalfilenameforlog', 100) GO
- Backup all non-system databases
- Backup msdb
- Backup master
- Backup model
- Stash backups away for safety - eg: into a c:\backups folder
- Stop SQL Services via services.msc
- Uninstall SQL Server and associated components - Take note of installed features (so when install of x64 is done, we match features - eg: reporting services, et al). Note the databases in C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL will stay where they are - the new x64 SQL will still use these.
- Reboot
- Install SQL x64 - Make sure to set mixed mode authentication and provide the sa password. Also make sure you match the features from step 9.
- Reboot
- Restore system databases
- Put server into single user mode
- Stop SQL server agent
- Stop the SQL Service using services.msc
Using an elevated command prompt, start in single user mode
CD C:\Program Files\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL\Binn sqlservr.exe -m -s<instance name>
Restore Master database from backup by running SQLCMD.exe from an elevated command prompt
CD C:\Program Files\Microsoft SQL Server\110\Tools\Binn SQLCMD.EXE -S .\<instance name> -U sa -P <sa password> 1>RESTORE DATABASE master FROM DISK = 'C:\backups\master.bak' WITH REPLACE 2>GO
- Copy model database + log (model.mdf and modellog.ldf) from new x64 folder back to old x86 folder - ie:
FROM
C:\Program Files\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL\DATA
TO
C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL\DATA - Copy MSDB database + log (MSDBData.mdf and MSDBLog.ldf) from x64 back to old x86 folder - ie:
FROM
C:\Program Files\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL\DATA
TO
C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL\DATA - Start SQL Service from services.msc, make sure SQL Agent stopped
- Login using Management Studio
- Right click msdb, choose properties - Options and change "Restrict Access" option to "SINGLE_USER"
Restore msdb using new query in management studio:
USE master GO RESTORE DATABASE [msdb] FROM DISK = N'C:\backups\msdb.bak' WITH REPLACE GO
- msdb should automatically go back to "Restrict Access" option value of MULTI_USER when restored.
- Start SQL Agent using services.msc
- Put server into single user mode
- Verify applications
- Should be able to login to jiwa databases using the Jiwa application with no issues
- Other applications using other database should also work
- Verify SQL jobs (eg: backups) are present and enabled.
NOTE: the folders used for databases and backups will return to be the x86 folder because that information is all stored in master / msdb, so C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.<instance name>\MSSQL needs to be kept - don't delete this! It would be a good idea to move everything out of the x86 folder at some point to avoid confusion and possible mistakes in the future. Be aware, however some SQL Jobs may refer to physical file paths (such as backup jobs) and may need to be modified.
Related articles