Already a member?
Sign in
Migrating a database from one SQL Server to another one
To Migrate an eLink database from one SQL Server to another one the routine is as follows:
Open the SQL Server Management Studio, connect as user 'sa' and then open a New Query. To get the names of the data file and the log file, run the following code (editing the location and file name to the right ones):
RESTORE FILELISTONLY FROM DISK = 'D:\eLink\SQLData\backups\YourDatabaseBackup.bak'
This will result in you seeing both the logical names (_DAT and _LOG) and the physical names (.bak). Then restore the database using the following code in the query:
RESTORE DATABASE YOURDATABASENAME
FROM DISK = 'D:\eLink\SQLData\backups\YourDatabaseBackup.bak'
WITH MOVE 'YOURDATABASENAME_DAT' TO 'D:\eLink\SQLData\YOURDATABASENAME.mdf',
MOVE 'YOURDATABASENAME_LOG' TO 'D:\eLink\SQLData\YOURDATABASENAME.ldf'
Run this code in the query to see if the database owner already exists (if the owner shows up in the list then you need to execute the next bit):
sp_change_users_login @Action='Report';
Then, if the owner does not exist, in the Query you need to execute the following code:
CREATE LOGIN YourDatabaseOwnerName WITH PASSWORD = 'YourDatabaseOwnerNamePassword';
Once the owner exists you need to execute the following code:
sp_change_users_login @Action='update_one', @UserNamePattern='YourDatabaseOwnerName', @LoginName='YourDatabaseOwnerName';
You can now check whether this has worked by running this code again (the database owner should not now show up):
sp_change_users_login @Action='Report';
- Make a backup of the current database.
- Transfer the backup to the physical disk of the new server.
- Restore the database using the following steps
Restoring the Database
- Connect to SQL Server Management Studio
- Restore the Database Files
- Create the Database Owner
- Change Users Login
- Finishing up
Step 1 - connection to SQL Server Management Studio
Open the SQL Server Management Studio, connect as user 'sa' and then open a New Query. To get the names of the data file and the log file, run the following code (editing the location and file name to the right ones):
Step 2 - Restore the Database Files
RESTORE FILELISTONLY FROM DISK = 'D:\eLink\SQLData\backups\YourDatabaseBackup.bak'
This will result in you seeing both the logical names (_DAT and _LOG) and the physical names (.bak). Then restore the database using the following code in the query:
RESTORE DATABASE YOURDATABASENAME
FROM DISK = 'D:\eLink\SQLData\backups\YourDatabaseBackup.bak'
WITH MOVE 'YOURDATABASENAME_DAT' TO 'D:\eLink\SQLData\YOURDATABASENAME.mdf',
MOVE 'YOURDATABASENAME_LOG' TO 'D:\eLink\SQLData\YOURDATABASENAME.ldf'
STEP 3 - Add the owner of the database to SQL Server
Run this code in the query to see if the database owner already exists (if the owner shows up in the list then you need to execute the next bit):
sp_change_users_login @Action='Report';
Then, if the owner does not exist, in the Query you need to execute the following code:
CREATE LOGIN YourDatabaseOwnerName WITH PASSWORD = 'YourDatabaseOwnerNamePassword';
STEP 4 - Change User's Login
Once the owner exists you need to execute the following code:
sp_change_users_login @Action='update_one', @UserNamePattern='YourDatabaseOwnerName', @LoginName='YourDatabaseOwnerName';
You can now check whether this has worked by running this code again (the database owner should not now show up):
sp_change_users_login @Action='Report';
Step 5 - Finishing up
- Add the Alias in the Alias Administrator tool;
- Test the owner login works;
- If the version of eLink is different, then upgrade the database to local version using the Link Instant Upgrade Wizard;
- Test the user logins, (for old eLink databases you may need to switch users to Native authentication instead of Database authentication - this is done in the eConfig Tool).
- If you are using the Link Notifications service then you need to add this database as follows: Stop the NextApp smtp service, uninstall the service, refresh the services page, open the smtp administrator and add your new alias, test run the smtp administrator, install the smtp notification service, start the smtp service, stop and clost the smtp administrator;
- Send an email to the users with details of how to migrate to their new settings;
- remove the Alias on the old server and remove the database from eLink Notifications service on old server.
mbw |
Latest page update: made by mbw
, Feb 5 2008, 5:50 AM EST
(about this update
About This Update
Clearly identify restore steps
- mbw
58 words added 2 words deleted view changes - complete history) |
|
Keyword tags:
SQL Server 2005
More Info: links to this page
|