Frequently asked questions - SQL Server 2000 - Log shipping (314515)



The information in this article applies to:

  • Microsoft SQL Server 2000 Enterprise Edition
  • Microsoft SQL Server 2000 Enterprise Evaluation Edition
  • Microsoft SQL Server 2000 Developer Edition

This article was previously published under Q314515

SUMMARY

This article discusses several aspects of log shipping and answers the most commonly asked questions regarding setup, security, monitoring, role-change and the removal of log shipping in SQL Server 2000 Enterprise Edition.

MORE INFORMATION

Log shipping in SQL Server 2000 provides a means of establishing a warm back up solution by using the SQL Server Maintenance Plan Wizard. Transaction log backups from a database can be automatically shipped to a different server and applied to a standby database. You can use the standby database to perform read-only operations (depending on the load state).

Log shipping set up

Q1: What edition of SQL Server do I have to have to set up log shipping?

A1: The following matrix shows the edition of SQL Server that is required for the three components that participate in log shipping:
ComponentEdition of SQL Server required
Primary ServerEnterprise or Developer Edition
Secondary ServerEnterprise or Developer Edition
Monitor ServerAny Edition


Q2: What do I have to do before I start the log shipping set up through SQL Server Enterprise Manager?

A2: Here is the list of what you must do before you start log shipping in SQL Server 2000.

  • Either start SQL Server and SQL Server Agent services under a domain account or configure the relevant primary, secondary and monitor servers for pass-through security (see question three in this heading for more information).
  • You can set up log shipping from any computer that has SQL Server Enterprise Manager (SEM) installed. You must register all computers that are running SQL Server that function as servers, which are intended to be the secondary servers, through SEM, on the computer from which log shipping is going to be set up.
  • Create a folder on the primary server for the transaction log back ups. You can create this folder anywhere on the primary computer. There must be enough free disk space on the drive on which you place the folder to hold at least one days worth of transaction log back ups. The exact space required is not easy to predict because it depends on the size and frequency of the transaction log back ups for the database. Microsoft recommends that you create a different folder for each database that you log ship.
  • Share the folders you created in the previous step. Make sure that you grant READ and CHANGE permissions to the Microsoft Windows NT accounts under which SQL Server and SQL Server Agent services are started for the servers that participate in log shipping. If you use pass-through security, grant these permissions to the local Windows NT account, under which the SQL Server related services are started.
  • Remove or disable any transaction log back up jobs on the databases that will be log shipped. This includes any third party back up jobs.
Q3: Do I have to start SQL Server related services under a domain account as opposed to a local Windows NT account?

A3: It is possible to configure SQL Server services to start under a local Windows NT account, unless SQL Server is configured to run as a virtual server in conjunction with Microsoft Cluster Service. You can use Windows NT pass-through security for this purpose. Follow these steps to configure pass-through security:
  • Create a Windows NT account on the primary, secondary and monitor computers with the same name and passwords.
  • Configure SQL Server related services to start under these Windows NT accounts on all computers.
The SQL Server services must be started under a domain account if SQL Server is configured to run as a virtual server with Microsoft Cluster Service. Even if SQL Server is a virtual server, Microsoft recommends that you use a domain account to start the services when SQL Server computers are in a domain. You gain the following advantage by having SQL Server related services start under a domain account:
  • Change of password for the SQL Server start up account will not result in a failure of log shipping jobs. To successfully continue log shipping in a pass-through security situation, all the servers must have the password changed for the Windows NT start up account, at the same time.
Q4: Where can I set up log shipping from?

A4: In SQL Server Enterprise Manager, right-click the database for which log shipping has to be set up, and then click Maintenance Plan. In the Welcome dialog box, click Next. Click to select the Ship the transaction log to other SQL Servers (log shipping) check box. The check box indicates to the SQL Server Maintenance Plan Wizard that this database must have log shipping. You can perform this step from a client that has SQL Server Enterprise Manager installed.

Q5: Why is the log shipping check box sometimes dimmed in the Maintenance Plan dialog box?

A5: The check box can be dimmed for one of the following reasons:
  • Multiple databases might be selected for the Maintenance Plan.
  • The database that is selected is not in the Full or Bulk Logged Recovery model.
  • SQL Server 2000 Enterprise Edition is not installed on the server.
Q6: Why does the log shipping set up fail while performing the initial configuration?

A6: There are several reasons that may cause the log shipping set up to fail. At this time there is at least one known problem that causes this behavior. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

298743 BUG: All changes may not be rolled back when Log Shipping Maintenance Wizard fails

Q7: Are the table schema and database file structure changes propagated to the secondary server?

A7: In SQL Server 2000, all table schema and database file structure changes are logged operations. However, if a new NDF or LDF file is added to the primary database, the transaction log restore job fails while loading the transaction log backup that was performed immediately after the database file was added to the primary database. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

286280 Description of the effect to database recovery after you add or remove database files

Q8: Can I script log shipping?

A8: No. Currently, it is not possible to script log shipping. The only supported means of setting up log shipping is through the wizard as described in question 4 of this section.

Q9: Can I set up log shipping between servers in multiple domains?

A9: Yes. It is possible to set up log shipping between servers that are in separate domains. There are two ways to do this:
  • Use pass-through security. Configure Windows NT accounts with the same name and passwords on the primary, secondary and monitor servers. Configure SQL Server related services to start under these accounts on all servers and use SQL authentication while setting up log shipping to connect to the monitor server. -or-

  • Use conventional Windows NT security. You must configure the domains with two-way trusts. SQL Server related services can be started under domain accounts. Either SQL authentication or Windows authentication can be used by jobs on the primary and secondary servers to connect to the monitor server. All other requirements are the same as explained in question 2 of this section.
Q10: Can I configure primary and secondary servers to use SQL authentication to connect to the monitor server?

A10: Yes. It is possible to use either Windows or SQL authentication for primary and secondary servers to connect to the monitor server. Microsoft recommends that you use Windows authentication for this purpose. However, if it is not possible to use Windows authentication, you can use SQL authentication. SQL Server will create a "log_shipping_monitor_probe" account on the primary, secondary and monitor servers, if it does not already exist, with the password specified when you set up log shipping. If SQL authentication is used for log shipping, you must configure SQL Server on the primary, secondary and monitor servers to use Mixed Mode authentication.

Log shipping security considerations

Q1: If I make the "guest" account unavailable before setting up log shipping, and I want my secondary database to be in a standby state, how can I allow users to have access to the secondary database (enforcing the same security model as the primary server)?

A1: The "guest" account must not be removed from SQL Server for any reason. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

315523 Removal of the guest account may cause a 916 error in SQL Server 2000 SP4 or a handled exception access violation in earlier versions of SQL Server 2000

However, you can can make the "guest" account unavailable for databases where there might be security concerns. Because the secondary database is in a standby state, it is not possible to use the sp_change_users_login stored procedure to re-map the logins appropriately. To enforce the same security model on a standby database, create the logins on the secondary server by using the same security identifier (SID) value as the primary server. Read the following Microsoft Knowledge Base article for more information about creating logins with the same SID values:

303722 How to grant access to SQL logins on a standby database when the guest user is disabled in SQL Server

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

321247 How to configure security for SQL Server log shipping

Q2: What does sp_resolve_logins do?

A2: At the time of the log shipping role change, the sp_resolve_logins stored procedure requires a BCP file of the syslogins system table from the primary server. This stored procedure loads the BCP file into the temporary table and loops through each login to verify if a login with the same name exists in the secondary server's syslogins system table. It then checks to see if the SID value for this login exists in the secondary database's sysusers system table. It finally checks to see if the SID value in secondary database's sysusers system table is not the same as the SID value in the secondary server's syslogins table. If these checks are satisfied, the sp_resolve_logins stored procedure runs the sp_Change_users_login stored procedure for that login, and fixes the SID in the secondary database's sysusers system table. Execution of this stored procedure is required only if there are new logins created on the primary server after log shipping has been initialized and those same logins are not created on the secondary servers with the same SID (as described in Microsoft Knowledge Base article Q303722).

Q3: The sp_resolve_logins stored procedure runs successfully; however, it does not perform the expected modifications to the security on the secondary server. Why?

A3: The sp_resolve_logins stored procedure requires an up-to-date BCP file of the primary server's syslogins system table. These logins must already by created on the secondary server. If these two conditions are met, the sp_resolve_logins stored procedure performs the modifications to the sysusers system table in the secondary database.

Q4: Do I have to run a Transfer Logins DTS task in conjunction with the sp_resolve_logins stored procedure before performing the role change?

A4: Yes. You must use the Transfer Logins task to make sure that the logins exist in the syslogins system table on the secondary server. This does not guarantee that the user can use the secondary database (if the secondary database is loaded in standby mode). If the user has to use the secondary database before performing the log shipping role change, see question 1 in this section.

Q5: Does the sp_resolve_logins stored procedure work for remote logins in SQL Server?

A5: No. The sp_resolve_logins stored procedure only works for typical logins. Any remote logins must be created manually on the secondary server.

Log shipping monitoring

Q1: Log Shipping Backup and Out of Sync alerts are firing, even when the secondary server is updated with the transaction log backups. Is this possible?

A1: Yes. It is possible that the alerts might fire even when the secondary database is being updated. If the alert threshold is set to a value less than double the time between back up and copy or restore jobs, the alerts might be raised. If the alerts are being raised and the threshold is close to or less than two times the time between subsequent backup and copy or restore jobs, go ahead and increase the threshold.

Q2: Why do the transaction log backups fail to restore on the secondary server?

A2: Transaction Log backups can only be restored if they are in a sequence. This sequence is determined by the LastLSN and FirstLSN fields that are returned by the RESTORE HEADERONLY command. If the LastLSN field and the FirstLSN field do not display the same number on consecutive transaction log backups, they are not restorable in that sequence. There may be several reasons for transaction log backups to be out of sequence. Some of the most common reasons are:
  • There are redundant transaction log backup jobs on the primary server that are causing the sequence to be broken.
  • There are non-logged operations performed in the database. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

    272093 Description of the effects of nonlogged and minimally logged operations on transaction log backup and the restore process in SQL Server

  • The recovery model of the database was probably toggled between transaction log backups.
  • The Data Transformation Services (DTS) task on the primary server might be causing this problem. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

    308267 FIX: DTS Copy Objects Task (DMO) breaks transaction log backup chain by switching recovery mode to Simple during transfer

Q3: Where can I find information about errors while performing back up, copy or restore operations?

A3: To get more information about a particular log shipping pair, follow these steps:
  1. Open SQL Server Enterprise Manager, and then connect to the monitor server.
  2. Under Management, click Log Shipping Monitor. In the right window pane, all the log shipping pairs are displayed (that have been configured with this server as the monitor server). If the log shipping pair is not visible, right-click the Log Shipping Monitor (under Management), and then click Refresh.
  3. Right-click the log shipping pair that you want information about, and then click View Backup History to view the back up job history.
  4. Right-click the log shipping pair, and then click View Copy/Restore History to view the history for copy and restore jobs.
  5. Right-click the log shipping pair, and then click Properties to view the current log shipping status, Source, and Destination alert status.
Q4: Does the file name first_file_000000000000.trn indicate that the copy or restore job was unsuccessful?

A4: Each run of the copy and restore job is associated with at least one file. By default, if no files are copied or restored in a certain run of any of these two jobs, SQL Server places first_file_000000000000.trn in the file name field. This may or may not indicate a problem. For example, the very first time that copy or restore jobs are run on the secondary server, there might not be any files available to copy or restore. In this case, first_file_000000000000.trn does not necessarily represent an error. However, under certain circumstances, this might represent a problem. Read the following Microsoft Knowledge Base article for more information:

292586 Backup, copy, and load job information is not updated on the log shipping monitor

Q5: Is it possible to modify the frequency and destination of the transaction log backups, on the primary server, after log shipping has been operational for a while?

A5: Yes. This information is in the Maintenance Plan on the primary server. To view the information, follow these steps:
  1. Double-click the Maintenance Plan on the primary server for the database for which this information must be modified.
  2. Click the Transaction Log Backup tab. Modify the destination and frequency in the dialog box.
  3. Because the copy job on the secondary server is expecting to copy transaction log backups from the share specified at the time log shipping was set up, this job might fail after modifying the target folder for the transaction log back ups. For more information about how to work around this problem, read the following article in the Microsoft Knowledge Base:

    314570 Cannot modify backup network share after you change the transaction log backup folder

Log shipping role change

Q1: How do I perform a log shipping role change?

A1: Click the following link to read the SQL Server 2000 Books Online topic about performing a log shipping role change:

How to set up and perform a log shipping role change (Transact-SQL)

Q2: Can I perform a role change while the primary server is offline or unavailable?

A2: Yes. Running the sp_change_primary_role stored procedure on the primary server is optional.

Q3: Why does the sp_resolve_logins stored procedure fail with error message 208 when run from the secondary database at the time of a role change?

A3: The sp_resolve_logins stored procedure does not qualify the sysusers system table with the master database prefix. This is a known problem with the code for the sp_resolve_logins stored procedure. For more information about this problem, read the following article in the Microsoft Knowledge Base:

310882 BUG: sp_resolve_logins stored procedure fails if executed during log shipping role change

Q4: Is there a problem when promoting a secondary server to be a primary server, when there are multiple secondary servers involved in a role change?

A4: Read the following Microsoft Knowledge Base article about a known problem that can cause errors while performing a role change that involves multiple secondary servers:

300497 FIX: Log shipping: Cannot change role from secondary to primary when database names are different

Q5: How can I re-establish log shipping after promoting the secondary server to be the primary server?

A5: If the Allow database to assume Primary role check box is selected, while setting up log shipping, in the Add Destination Database dialog box, follow these steps to add a new secondary server after performing a role change. If the setting was not selected, use the Maintenance Plan Wizard to set up log shipping after a role change.
  1. Open SQL Server Enterprise Manager, and then connect to the promoted primary server. Register the server that you intend to add as the secondary server.
  2. Expand Management (in SQL Server Enterprise Manager), and then click Maintenance Plans. Right-click the appropriate Maintenance Plan from the list, and then click Properties.
  3. Click the Log Shipping tab, and then click Add.
  4. Provide the appropriate information regarding the secondary server about this dialog box, and then click OK. This will add the new secondary server to log shipping.
Q6: How can I continue to log ship to the former primary server without restoring a database backup?

A6: It is possible to log ship between two servers repeatedly without having to restore the complete database backup. The requirement is that both the primary and secondary servers are available when you perform the role change procedure. As part of performing the role change, you must run the sp_change_primary_role stored procedure. You must run the sp_change_primary_role stored procedure with a @final_state parameter of either 2 or 3. This will leave the primary database in an unrecovered state after performing the transaction log back up. Because the database is left in an unrecovered state, this database can be selected when the log shipping destination is added (as explained in the previous question). This way you do not have to reload a database backup.

Log shipping removal

Q1: How can I stop log shipping for a particular log shipping pair?

A1: Follow these steps to remove a log shipping pair:
  1. Open the SQL Server Enterprise Manager on the primary server. Expand Management, and then click Maintenance Plan. Right-click the Maintenance Plan, and then click Properties.
  2. Click the Log Shipping tab, and then click to select the log shipping pair that you want to remove.
  3. Click the Delete command button to remove this pair from log shipping. If this is the last pair in log shipping, clicking Delete removes log shipping. If you want to continue log shipping to a different server or to a database, click Add. Then, click to select the appropriate server or database to act as the secondary server before you remove the existing log shipping secondary.
Q2: Is there a problem with removing log shipping for a database that has special characters in it's name?

A2: Read the following Microsoft Knowledge Base article, which discusses this problem in more detail:

295936 FIX: Error removing log shipping on secondary database when database name has a quote

REFERENCES

For more information about log shipping, visit the following Microsoft Web sites:

275146 Frequently asked questions - SQL Server 7.0 - Log shipping

Didn't see an answer to your question? Visit the Microsoft SQL Server Newsgroups at: Comments about this or other Microsoft Knowledge Base articles? Drop us a note at SQLKB@Microsoft.com.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

917544 BUG: You receive an error message when you run the "Log Shipping Alert Job - Restore" job in SQL Server 2000

REFERENCES


Modification Type:MajorLast Reviewed:6/30/2006
Keywords:kbinfo KB314515 kbAudDeveloper