![]() |
|
|
|
By: Jugal Shah | Read Comments (37) | Related Tips: 1 | 2 | 3 | 4 | 5 | More > Log Shipping |
Setting up Log Shipping for SQL Server is not that difficult, but having a step by step process is helpful if this is the first time you have setup Log Shipping. In this tip we walk through the steps to setup Log Shipping.
Log Shipping is a basic level SQL Server high-availability technology that is part of SQL Server. It is an automated backup/restore process that allows you to create another copy of your database for failover.
Log shipping involves copying a database backup and subsequent transaction log backups from the primary (source) server and restoring the database and transaction log backups on one or more secondary (Stand By / Destination) servers. The Target Database is in a standby or no-recovery mode on the secondary server(s) which allows subsequent transaction logs to be backed up on the primary and shipped (or copied) to the secondary servers and then applied (restored) there.
To setup a log-shipping you must have sysadmin rights on the server.
In addition, you should use the same version of SQL Server on both ends. It is possible to Log Ship from SQL 2005 to SQL 2008, but you can not do it the opposite way. Also, since Log Shipping will be primarly used for failover if you have the same versions on each end and there is a need to failover you at least know you are running the same version of SQL Server.
1. Make sure your database is in full or bulk-logged recovery model. You can change the database recovery model using the below query. You can check the database recovery model by querying sys.databases
2. On the primary server, right click on the database in SSMS and select Properties. Then select the Transaction Log Shipping Page. Check the "Enable this as primary database in a log shipping configuration" check box.

3. The next step is to configure and schedule a transaction log backup. Click on Backup Settings… to do this.

If you are creating backups on a network share enter the network path or for the local machine you can specify the local folder path. The backup compression feature was introduced in SQL Server 2008 Enterprise edition. While configuring log shipping, we can control the backup compression behavior of log backups by specifying the compression option. When this step is completed it will create the backup job on the Primary Server.

4. In this step we will configure the secondary instance and database. Click on the Add… button to configure the Secondary Server instance and database. You can add multiple servers if you want to setup one to many server log-shipping.

When you click the Add… button it will take you to the below screen where you have to configure the Secondary Server and database. Click on the Connect… button to connect to the secondary server. Once you connect to the secondary server you can access the three tabs as shown below.
In this step you can specify how to create the data on the secondary server. You have three options: create a backup and restore it, use an existing backup and restore or do nothing because you have manually restored the database and have put it into the correct state to receive additional backups.

In this tab you have to specify the path of the Destination Shared Folder where the Log Shipping Copy job will copy the T-Log backup files. This step will create the Copy job on the secondary server.

Here you have to specify the database restoring state information and restore schedule. This will create the restore job on the secondary server.

5. In this step we will configure Log Shipping Monitoring which will notify us in case of any failure. Please note Log Shipping monitoring configuration is optional.
Click on Settings… button which will take you to the “Log Shipping Monitor Settings” screen. Click on Connect … button to setup a monitor server. Monitoring can be done from the source server, target server or a separate SQL Server instance. We can configure alerts on source / destination server if respective jobs fail. Lastly we can also configure how long job history records are retained in the MSDB database. Please note that you cannot add a monitor instance once log shipping is configured.

6. Click on the OK button to finish the Log Shipping configuration and it will show you the below screen.

| Tuesday, February 22, 2011 - 7:42:57 AM - Dana | Read The Tip |
|
Thank you for the explinations. I have a document with similar screen shots that I developed for internal use, now I have the background. |
|
| Tuesday, May 01, 2012 - 9:13:54 PM - Abdul Haseeb | Read The Tip |
|
That is a good and more cleared explanation I have ever found. Great Work. |
|
| Wednesday, May 02, 2012 - 11:12:44 AM - Jugal | Read The Tip |
|
Thanks Abdul |
|
| Monday, May 28, 2012 - 3:14:30 AM - shivaji | Read The Tip |
|
Excellent.Thanks for your clear explanation.................Great job |
|
| Thursday, June 21, 2012 - 8:32:00 AM - Hassan | Read The Tip |
|
I follow all steps but I have the following error message "Cannot open backup device \\server1\DB_logshipping\db.bak operating system error 1326(failed to retrieve text for this error : Reason 1815) RESTORE FILELIST is terminating abnormally (Microsoft SQL server , Error : 3201)" Note : the log shipping used between sql server 2008 and sql server 2008 R2
|
|
| Thursday, June 21, 2012 - 12:48:38 PM - Jugal | Read The Tip |
|
Can you check for the permision of the SQL Agent Service account on backup share and let us know... Agent Service account must have the read/write permission on the backup share. |
|
| Friday, July 13, 2012 - 10:17:52 AM - Jhansi | Read The Tip |
|
Log shipping for sql has started from version 2000 of SQL Server so the 1st point in the minimum requirement can be changed as sql server 2000 version or later.. but still same versions of primary and secondary is required while performing log shipping...
|
|
| Wednesday, August 01, 2012 - 8:53:58 AM - wannabeDBA | Read The Tip |
|
hi could add what rights the services of both primary and secondary need for the file shares..
I keep getting into problems.. Is it the SQL Server service or the Agent for the primary that needs permissions to the folder that its backing up to? and same for the secondary reading the folders... I thought they both only ever needed read/write.. but i got errors on permissions doing it that way..
|
|
| Sunday, August 05, 2012 - 10:56:47 PM - Pete Ocasio | Read The Tip |
|
I setup a log shipping configuration without setting up a monitoring server. I have since changed my mind about this and will like to setup the monitoring server which will be the monitor server. Will setting up the monitoring server break the current log shipping configuration by setting it up at this late date? Will it be better to setup the alerts as a separate job(s) that will look across servers without setting up a monitoring server?
|
|
| Monday, August 06, 2012 - 10:59:21 AM - Jugal | Read The Tip |
|
@WannabeDBA, Can you please paste the error message? SQL Server Service Accounts reuires the Read\Change permission. |
|
| Tuesday, September 25, 2012 - 9:45:03 AM - Kapil | Read The Tip |
|
Hi Jugal, this is a very good summary. Thanks. A question, in SQL Server 2008, I am told that when applying the logs to the target/secondary database, users have to be kicked off/disconneted. Is this true in SQL 2012 also? By the screen shoots, it looks like we could choose not to disconnect users. Have you tried/confirmed this at all? |
|
| Tuesday, September 25, 2012 - 1:52:25 PM - Jugal | Read The Tip |
|
f you choose "Disconnect User Option" - users will be disconnected from the database each time the log shipping restore job attempts to restore a transaction log to the secondary database.
f you do not choose "Disconnect User Option" In this case, the restore job cannot restore transaction log backups to the secondary database if there are users connected to that database. Transaction log backups will accumulate until there are no user connections to the database.
Yes in SQL Server 2012 as well.
|
|
| Thursday, October 11, 2012 - 6:46:16 AM - Rajumella | Read The Tip |
|
That is a verygood and more cleared explanation I have ever found. Great Work. |
|
| Thursday, October 18, 2012 - 6:49:20 AM - Prabhakar lam | Read The Tip |
|
Good article |
|
| Tuesday, October 23, 2012 - 3:19:28 AM - Yasir Baig | Read The Tip |
|
Good article but when i'm applying the same steps as you mentioned above but on the second step of "Restoring Backup to secondary database[db name]" status Error Message: Canot open backup device "\\hscvm\Replication\dbname.bak". Operating System Error 5 (Access Denied). RESTORE FILELIST is terminating abnormally. (Microsoft SQL Server, Error:3201)
can u help me in thie regards.
|
|
| Thursday, December 20, 2012 - 1:48:27 AM - Raveendra | Read The Tip |
|
Q)I follow all steps but I have the following error message "Cannot open backup device \\server1\DB_logshipping\db.bak operating system error 1326(failed to retrieve text for this error : Reason 1815) RESTORE FILELIST is terminating abnormally (Microsoft SQL server , Error : 3201)" Note : the log shipping used between sql server 2008 and sql server 2008 R2
A)Hi Hassan you have to give permissions on Shared folder.The below are the permissions for shared folder. 1)Network 2)Network Service. The above pemissions are the solution for ur problem. Regards, Raveendra. |
|
| Saturday, December 22, 2012 - 8:18:40 PM - Ogan | Read The Tip |
|
I'm setting up log shipping for 2 server that are not in domain. I've gotten to get the initial Backup and restore to the second server succesfull and the second DB goes into Stanby/Read only mode. However, the rest is not working. Btw, it took not only to change the SQL server Agent to a local user, but also changing SQL Server user to a local user as well. For some reason NT Service/MSSQLSERVER user would not be able to read the directory since it was a completely different directory. I may try to put the log directory inside of the data or log directory created by SQL Server. anyhow, all 3 jobs on the secondary server are failing. Thank you in advance for your guidence ------------------- LSAlert - with the following error. LSCopy - with the following error. ------------------
Log Job History (LSCopy_ccw-stg-sql1.vpc.ccw_CCW_DM) Log Job History (LSCopy_ccw-stg-sql1.vpc.ccw_CCW_DM)
Log Job History (LSCopy_ccw-stg-sql1.vpc.ccw_CCW_DM) Log Job History (LSCopy_ccw-stg-sql1.vpc.ccw_CCW_DM) ----------------- LSRestore with the following error Log Job History (LSRestore_ccw-stg-sql1.vpc.ccw_CCW_DM) |
|
| Tuesday, January 01, 2013 - 8:46:59 AM - dinesh | Read The Tip |
|
System.Data.SqlClient.SqlError: Cannot open backup device '\\DINESH\ames.BAK'. Operating system error 67(The network name cannot be found. please let me, i had given network path everyone permision with full right.is there anything missing ?5c |
|
| Tuesday, January 01, 2013 - 9:59:45 AM - Jugal | Read The Tip |
|
Hi Dinesh, Please confirm if your services are running under local system account or Windows AD account? |
|
| Tuesday, January 01, 2013 - 10:44:36 PM - Dinesh | Read The Tip |
|
It running on local system only. |
|
| Wednesday, January 02, 2013 - 8:31:18 AM - Jugal | Read The Tip |
|
Please use AD acccount & give it permission on shared folder. |
|
| Tuesday, January 08, 2013 - 9:48:15 AM - dinsa | Read The Tip |
|
step no. 3, how to give a path. Just say I a laptop no network folder. My backup is saveed on c: and path is C:\sqlbackup\tes.bak Would you plz help me to fill both 'Network path to backup folder' and 'If backup folder is located on primary server....' place with example. |
|
| Tuesday, January 08, 2013 - 10:47:56 AM - Jugal | Read The Tip |
|
You can make the folder share & give access to SQL Server Serivce account on that folder. You can give the path as \\ComputerName\Foldername |
|
| Wednesday, January 09, 2013 - 6:45:50 PM - Brian | Read The Tip |
|
Great article!
Question: In step-4 where it says "Click on the Connect… button to connect to the secondary server"; my understanding is that this step is being initiated on the primary server to connect to the secondary SQL Server; in my case I am working in a SharePoint 2010 farm environment and the log shippiong is being set up between two different data center locations and there is no direct connection between the database servers but only between the web front end servers (only the web front end servers have external IP addresses). How can I connect to the secondary SQL Server instance in one data center from the primary SQL server located in another data center? Do we need to assign external public IP addresses to each of the SQL Server instances in the twp data centers so they can see one another?
Thank you in advance for your response, Brian
|
|
| Wednesday, January 23, 2013 - 4:25:51 PM - James | Read The Tip |
|
I've followed the steps exactly, I keep getting this error:
Cannot open backup device '\\primaryserver\DatabaseBackup\Tracker.bak'. Operating system error 2(The system cannot find the file specified.). I'm positive that the filepath is correct. I've ensured that the SQL Server Agent service is running under the domain user. I've ensured that the SQL Server service is also running under the domain user. The domain user that is running the process has full read write access on both servers, and all shares. I have logged into the secondary server with the domain account that is running all the services and it can access the share listed above just fine.
I'm at a loss here, nothing left for me to troubleshoot; any help would be appreciated! |
|
| Wednesday, January 30, 2013 - 4:57:07 AM - Pradeep | Read The Tip |
|
*** Can you tell me log shipping is possible in a single server *** |
|
| Monday, February 25, 2013 - 8:48:45 AM - stephane | Read The Tip |
|
Hello,
your problem is probably due to the use of a workgroup configuration instead of AD. in case of workgroup configuration you have to create on the 2 servers the same windows user with the same password (for example: winsqlUsr). Then you have to modify on the 2 servers the users of MSSQL service and MSSQL service agent to have them run under this user (winsqlUsr). then check on the 2 servers your share and windows permission on the shared directory to have this user winsqlUsr have full access... this should solve your issue. best regards Stephane
|
|
| Saturday, March 09, 2013 - 3:18:10 AM - dinesh | Read The Tip |
|
How can remove loggshipping ?? |
|
| Thursday, April 04, 2013 - 7:04:43 AM - Sendhilraja | Read The Tip |
|
Thanks,,,,,Very clear to understand the ariticle ....... |
|
| Sunday, April 14, 2013 - 3:19:31 AM - CHANDRA | Read The Tip |
|
hi If you want to change the log shipping schedule time, how can we do? tell me process ...,
|
|
| Thursday, April 18, 2013 - 12:32:42 AM - Roopesh Kavukuntla | Read The Tip |
|
What an awesome illustration jugal superb |
|
| Thursday, April 18, 2013 - 2:51:08 AM - chandrasekhar | Read The Tip |
|
Thanks a lot.. Its crystal clear in configuring logshipping.... |
|
| Friday, May 10, 2013 - 12:31:09 PM - Rajesh | Read The Tip |
|
Hi Jugal, Thanks for your article. However i have few doubts on this topic, i really don't know how reasonable they are Below is what my current log shipping setup. Primary Server Name: PrimaryServer Primary Server DB: PrimaryDB Drives on Primary Server: C,D,E & F PrimaryDB files location: .mdf(D) & .ldf(E) Seconday Server Name: SecondayServer Seconday Server DB: SecondaryDB Drives on Seconday Server: C,D & E SecondaryDB files location: .mdf(D) & .ldf(E) Question1: If suppose i created a secondary data file(.ndf) for primary database and kept it in F drive on Primary server.In this case, will the secondary data file(.ndf) be created over there in secondary database located on Secondary server? If so, where it will be created i mean in which drive it will be created? Question2: As you said, If you choose "Disconnect User Option" - users will be disconnected from the database each time the log shipping restore job attempts to restore a transaction log to the secondary database.
If you do not choose "Disconnect User Option" In this case, the restore job cannot restore transaction log backups to the secondary database if there are users connected to that database. Transaction log backups will accumulate until there are no user connections to the database.
From the second stmt, if suppose users stay connected forever on secondary DB for reporting purpose, then the copy files in copy directory on secondary servers will be committed for a specific threshold hours(let say 72 hours). Next restoration will not be possible though we have t-log backups from past 72 hours, since definitely we will get LSN mismatch error while SQL Agent job attempt to restore the t-logs.
How far the second stmt is correct? What is the use of TUF(Transact Undo File)?
|
|
| Saturday, May 18, 2013 - 10:44:04 PM - Mahmood | Read The Tip |
|
Hi,
I have a question related to monitoring of Log shipping, our requirement is to trigger an alert to notify DBA if the latency of the log shipping exceeds 60 minutes.
I am not sure where should I configure that.
The queries are 1. If I set a threshold value of 60 minutes in the primary server, by going into secondary settings of the log shipping database.
2. How frequently I need to schedule the restore job which I configured in the 1st step.
Thanks, Mahmood |
|
| Thursday, May 23, 2013 - 3:32:42 AM - vinay | Read The Tip |
|
1. what is LSN? 2. What is Tuf? 1. Diff b/w readonly & Standalone? 2. when we use standalone in LogShipping? |
|
| Tuesday, June 04, 2013 - 12:52:23 PM - sunny | Read The Tip |
|
*** NOTE *** - If you want to include code from SQL Server Management Studio (SSMS) in your post, please copy the code from SSMS and paste the code into a text edi Hi... am configuring Logshipping on SQL Server 2008r2 but i am getting the error:3201 in my primary, secondary servers are running on same editon and i have created 2 folders with the name testing_backup, testing_copy on that 2 folders i have given the full access but still am getting the error.
please provide me the solution for this. very urgent.
tor like NotePad before copying the code below to remove the SSMS formatting.
|
|
| Tuesday, June 04, 2013 - 2:08:51 PM - Jason | Read The Tip |
|
Hi and thanks for the great article.
I work in a unique scenario. We have a production SQL 2008 Server on one network within it's own active directory forrest. We use a SQL Service Account to manage the SQL Database. A few blocks away, we have a back up facility on it's own network with it's own active directory forrest. We also use a SQL Service Account to manage the SQL Database. Both SQL Service Accounts are named the same, and have the same password. Is it possible to log ship from our production network to our back up facility network even though the servers are not in the same domain/forrest? Also, what network ports would need to be opened on the inbound firewall to allow for log shipping. The network are separated by 2 firewalls, and are on separate VLAN's. |
|
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |