Backup and Restore AssetCentre

26
Protect Your FactoryTalk AssetCentre Data Backing up and Restoring FactoryTalk AssetCentre with Microsoft SQL Server 2005 How to properly backup and restore FactoryTalk AssetCentre data in the MSSQL database

Transcript of Backup and Restore AssetCentre

Page 1: Backup and Restore AssetCentre

Protect Your FactoryTalk AssetCentre Data Backing up and Restoring FactoryTalk AssetCentre with Microsoft SQL Server 2005 How to properly backup and restore FactoryTalk AssetCentre data in the MSSQL database

Page 2: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

2

Table of Contents Retain your FactoryTalk AssetCentre Data .................................................................................................................1 Introduction .................................................................................................................................................................3

Planning an AssetCentre Maintenance Window ............................................................................................ 3 Backing Up FactoryTalk AssetCentre in Microsoft SQL Server 2005..........................................................................4

AssetCentre Database Backup.................................................................................................................... 4 AssetCentre Database Transaction Log Backup ........................................................................................... 8 Scheduling Backups ................................................................................................................................. 10

Restoring FactoryTalk AssetCentre in Microsoft SQL Server 2005...........................................................................15 Restoring AssetCentre Database and Transaction Log................................................................................ 15 AssetCentreUser Configuration (optional)................................................................................................... 18 FactoryTalk AssetCentre Data Source Configuration Wizard........................................................................ 23

Page 3: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

3

Introduction Proper retention of data is a mission critical task in any industry. For FactoryTalk AssetCentre, this means backing up the data stored in the FactoryTalk AssetCentre database. All information in FactoryTalk AssetCentre, from audits and events, to the asset tree itself, is stored in the AssetCentre database within the Microsoft SQL (MSSQL) server. This whitepaper is designed to assist MSSQL 2005 database administrators with the procedure of backing up the AssetCentre database, and in the event of an unlikely system failure, quickly restoring that backup to minimize down time.

Planning an AssetCentre Maintenance Window When backing up any production system, such as FactoryTalk AssetCentre, it is critical to plan the event as a scheduled maintenance window. A maintenance window is a period of time that is planned to make a production system unavailable to its users, thus allowing for proper maintenance to that system to ensure continued system health. During the backup of the FactoryTalk AssetCentre system, user access should be limited. While users can continue to query the system during the backup, it is not recommended to have any user activity occur during this time. Fortunately, the MSSQL server is capable of handling user queries of a database it is currently backing up, meaning that the FactoryTalk AssetCentre system does not need to be stopped in order to proceed with a backup.

Page 4: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

Backing Up FactoryTalk AssetCentre in Microsoft SQL Server 2005 The following set of instructions is intended for use on systems using Microsoft SQL Server 2005. Proper steps for manual backup of the AssetCentre database and the accompanying transaction log will be shown. A backup operation will essentially create a copy of the current database contents, and store them in a user-defined location.. It should be noted that this process can also be automated, which is covered at the end of this section.

AssetCentre Database Backup During the backup of the FactoryTalk AssetCentre system, user access should be limited. While users can continue to query the system during the backup, it is not recommended to have any user activity occur during this time. Additionally, it is advisable to run the Database Cleanup Wizard from the FactoryTalk AssetCentre client prior to backing up the system to clean out any aged data that no longer needs to be retained (see online help in FactoryTalk AssetCentre client for this procedure.)

1. Open up SQL Server Management Studio on the existing SQL Server machine. Go to Windows Start Programs Microsoft SQL Server 2005 SQL Server Management Studio, as shown in the image below:

2. Connect to the appropriate Microsoft SQL Server 2005 database server (administrative credentials

needed.)

4

Page 5: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

3. Once the Microsoft SQL Server 2005 Management Studio has connected to the database server hosting the AssetCentre database and opened, navigate to the AssetCentre database.

4. Right-click on the AssetCentre database and select Tools Back Up…

5

Page 6: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

5. The following screen will be displayed

5c: Add location on local hard drive to store backup file.

5b: Name backup

5a: Select AssetCentre database to

5b: Backup Set Name: This will be the name of the database backup file. Backup set will expire: This will be a retention period for each backup performed. If the backup should never expire, leave this setting at the default of 0. 5c: Destination The default destination for this backup is “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\AssetCentre.bak”. To remove this location, select it, then click the Remove button. Click the Add button to select a user defined location and filename for the backup. A preferred location would be a separate hard drive from the one on which the database resides (thus saving the backup location if the database’s hard drive fails.)

6

Page 7: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

6. Note the Options from the tree on the left of the screen. In this example, all options are left at default.

7. Click OK to initiate the backup.

8. Upon successful completion of the backup, the following window will be displayed

The AssetCentre database is now backed up.

7

Page 8: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

AssetCentre Database Transaction Log Backup It is strongly recommended to backup the database transaction log in addition to the database itself. The transaction log essentially keeps audits of the database, recording actions performed upon it. Both the transaction log and database can be stored in the same file, specified in the section above on how to back up the database.

1. Right-click on the AssetCentre database and select Tools Back Up… (if SQL Management Studio isn’t already open, see Steps 1-4 from the AssetCentre Database Backup section.)

2. The following screen will be displayed

8

3. Note the Options from the tree on the left of the screen. In this example, all options are left at default.

Note that the location is carried over from previous backup.

5c: Name backup

5b: Select Transaction Log as the backup type.

5a: Select AssetCentre database to

4. Click OK to initiate the backup.

Page 9: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

5. Upon successful completion of the backup, the following window will be displayed

The AssetCentre database’s transaction log has now been backed up successfully.

9

Page 10: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

Scheduling Backups Using the MSSQL Server Agent, it is possible to schedule backups of the AssetCentre database and transaction log on a user defined schedule. Typically, an entire database backup is scheduled less often than the transaction log backup (e.g., the database might be backed up weekly, whereas the transaction log is backed up daily.) Since the MSSQL Server Agent is performing the operation, its service must be running for scheduled activities to run correctly. It is recommended to set this service to automatic, such that the service will start on reboots without user intervention.

Note: The steps below assume a configuration of two separate maintenance plans: one for the transaction log and one for the database itself. It is possible to configure both in the same plan.

1. Ensure that the SQL Server Agent is started. This can be accomplished directly from the Microsoft SQL

Server Management Studio, at the bottom of the navigation tree.

10

If the Agent is not started, right-click on it and select Start.

Click Yes when prompted to start the service.

Page 11: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

2. Once the SQL Server Agent is started, right-click on Management -> Maintenance Plans and select Maintenance Plan Wizard.

11

3. Click Next on the opening screen

4. Enter a name for the maintenance plan, then click the Change button to schedule the plan.

Page 12: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

5. Use the following screen to configure the schedule for the operation, then click OK to continue

12

6. Click Next to progress past this screen now that the schedule is configured

7. Select ‘Back Up Database (Full)’ to configure this maintenance task to backup the database itself. Click

Next to continue.

Note that a transaction log backup can also be selected here.

8. Click Next

Page 13: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

9. Select the AssetCentre database from the drop down menu and click OK.

13

10. Specify the location to store the backup file.

Note: A preferred location would be a separate hard drive from the one on which the database resides (thus saving the backup location if the database’s hard drive fails.)

11. Click Next

Page 14: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

12. Click Next

Note: It is possible to configure email reporting from this screen.

13. Click Finish to finalize the maintenance plan.

14. Once the success of the operation is reported, click Close.

A database backup has now been scheduled. To configure a maintenance plan for the transaction log, simply follow these steps again and select ‘Back Up Database (Transaction Log)’ instead of ‘Back Up Database (Full)’ in Step 6.

14

Page 15: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

Restoring FactoryTalk AssetCentre in Microsoft SQL Server 2005 To restore the AssetCentre database in Microsoft SQL Server 2005, there are two or three main steps that must be taken, dependent on the SQL Server to be restored to. The first is to actually restore the database and transaction log. Following that, it is possible that the SQL user used by the FactoryTalk AssetCentre server to communicate to the AssetCentre database must be resolved. This step must be taken on restores that are performed on ‘new’ SQL Servers (servers different from the ones on which the original backups were taken.) Finally, use the FactoryTalk AssetCentre Data Source Configuration Wizard to reconnect FactoryTalk AssetCentre to the new database.

Restoring AssetCentre Database and Transaction Log Before beginning the process of restoring the database, all users of the FactoryTalk AssetCentre system should be disconnected. It is advisable to simply stop the FactoryTalk AssetCentre server service until the MSSQL database restore and re-connecting of the FactoryTalk AssetCentre server is complete. Additionally, the World Wide Web Publishing service should also be stopped.

1) To disable the FactoryTalk AssetCentre server service, open up the Service Control Manager (Control Panel -> Administrative Tools -> Services.

2) Right-click on the FactoryTalk AssetCentre Server listing and select ‘Stop’

3) Stop the World Wide Web Publishing service in the same way.

15

Page 16: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

4) On the SQL Server, open up the SQL Server Management Studio and right-click on ‘Databases’, then select ‘Restore Database’

16

5) In the ‘To database’ field, enter the name “AssetCentre”, then select the “From Device” radio button and

click the corresponding browse button.

Browse to the backup file and select it, then press OK to continue.

Page 17: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

6) The backup list below the browse button will populate.

In the steps specified in the manual backup sections above, all defaults were selected, which means that each backup appends to the existing backups and puts both the database and transaction log in the same file. Since that is the case, all checkboxes should be checked in the ‘Restore’ column, corresponding to each database and transaction log backup. Press OK to continue.

Note: If different options are selected, such as overwriting on each backup, then there will not be as many rows to select from. Additionally, if no transaction logs were backed up, there will only be one checkbox available, corresponding to the AssetCentre database itself. It is also possible to perform restores of just the transaction log or database, depending on the checkbox selections. These steps show the process for restoring both at the same time. In the scheduled backup examples, the database and transaction log were backed up to separate files (.bak and .trn). These would need to be restored separately as well, as opposed to having both files in the same restore list as shown here.

SQL will now restore the AssetCentre database.

17

Page 18: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

AssetCentreUser Configuration (optional) If the database has been restored to a SQL Server other than the one upon which it was backed up, the AssetCentre users need to be resolved. The restored database has brought all of the previous SQL Server database’s settings with it, including a user that either does not exist (if the server has not had been connected to FactoryTalk AssetCentre previously) or whose security identifier (SID) does not match the existing user. To resolve this, this user will need to be removed and created anew.

Reminder: This section does not need to be performed if the database has been restored to the same SQL Server upon which it was backed up. Proceed to the next section (FactoryTalk AssetCentre Data Source Configuration Wizard) if restoring to the same SQL Server.

To begin, the user’s ownership of the AssetCentre schema must be removed. This step must be performed prior to deleting the user. Remove the ownership by temporarily assigning it to the guest user.

1) Expand the newly restored AssetCentre database and navigate to the ‘Security’ folder. Double-click on the ‘guest’ user to open its properties.

18

2) Under the ‘Owned Schemas’ list, check the box next to AssetCentreUser. Doing so will automatically

remove ownership from the AssetCentreUser user. Click OK to continue.

Page 19: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

3) Now the AssetCentreUser user can be deleted. Right-click on it and select ‘Delete.’

19

4) Click No if prompted to delete both the user and the schema (do not delete the schema, only the user.)

5) Click OK to proceed with the deletion

6) Begin by collapsing the ‘Databases’ folder and navigating to ‘Security -> Logins’ from the root. Double-click

on the AssetCentreUser.

Note: For MSSQL Servers that have not been previously been connected to FactoryTalk AssetCentre, it will be necessary to manually create this user (Right-click on the ‘Logins’ folder and select ‘New Login’)

Page 20: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

7) Verify this user’s name is ‘AssetCentreUser’, select ‘SQL Server authentication’, and input a password. Uncheck the ‘User must change password at next login’ and ‘Enforce password expiration’ boxes.

Note: This password can be overwritten by the FactoryTalk AssetCentre software (if desired) when reconnecting the FactoryTalk AssetCentre server.

8) Next, select ‘User Mapping’ from the navigation pane on the left. From the new menu, check the box next

to the ‘AssetCentre’ database, then click the browse button under the ‘Default Schema’ column

20

Page 21: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

9) Type in ‘AssetCentreUser’ and click OK to continue.

10) Under the Permissions list, check the box next to ‘db_datareader’, ‘db_datawriter’, and ‘db_dataexecute’.

11) Click OK to continue

21

Page 22: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

12) Now, navigate back to the ‘AssetCentre’ database to ‘Security -> Users’ and double-click on AssetCentreUser.

22

13) Under the ‘Owned Schemas’ list, check the box next to ‘AssetCentreUser.’ Doing so automatically

removes the ownership from the ‘guest’ user assigned earlier.

The new AssetCentre MSSQL Server Database is now configured. Continue on to the section entitled “FactoryTalk AssetCentre Data Source Configuration Wizard” to finish the restore process.

Page 23: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

FactoryTalk AssetCentre Data Source Configuration Wizard If the AssetCentre database has been moved or restored on an MSSQL Server, it is important to reconnect the FactoryTalk AssetCentre server to this new database. The steps below will walk through the FactoryTalk AssetCentre Data Source Configuration Wizard, installed by default along with the FactoryTalk AssetCentre server.

Note: The FactoryTalk AssetCentre server and World Wide Web Publishing services should still be stopped at this point, following the restoration of the database. If this is not so, stop them now.

1) From the FactoryTalk AssetCentre server machine, go to Start -> Programs -> Rockwell Software ->

FactoryTalk AssetCentre Server -> Data Source Configuration

2) Click Next on the first screen

23

Page 24: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

3) Input the name of the MSSQL Server in the ‘FactoryTalk AssetCentre SQL Server’ dropdown menu, and leave the ’AssetCentre SQL Server Authentication’ settings at default. These settings will be used to reset the AssetCentreUser settings in the new SQL server, including the password.

24

Note: If the password specified in SQL for the AssetCentreUser account is desired, simply input it as the password here instead of accepting the default.

4) Click Next to continue

5) Enter the user credentials of a SQL Server administrator on the new SQL Server. Leave the ‘Change

FactoryTalk AssetCentre SQL Server…” checkbox checked.

6) Click Next to continue

Page 25: Backup and Restore AssetCentre

RETAIN YOUR FACTORYTALK ASSETCENTRE DATA

7) Click Finish, and a data source test window will appear.

8) Press ‘Test Data Source’ to test the connection that you’ve just configured and verify that the test completes successfully.

25

9) Click Done to close the wizard.

10) Finally, start the FactoryTalk AssetCentre and World Wide Web Publishing services again. Open the

Service Control Manager (Control Panel -> Administrative Tools -> Services). Start the World Wide Web Publishing service first (right-click, and select ‘Start.’)

The PC could also just be rebooted.

The FactoryTalk AssetCentre server is now connected to the newly restored database.

Page 26: Backup and Restore AssetCentre

Publication FTALK-WP016A-EN-E – April 2009 Copyright © 2009 Rockwell Automation, Inc. All Rights Reserved. Printed in USA.