LOG SHIPPING Lg shipping is a HA ptin. Lg shipping ensures that lg backups frm Primary are cntinuusly applied n standby. Lg shipping fllws a warm standby methd because manual prcess is invlved t ensure standby is made primary during disaster. Lg shipping invlves fur jbs mainly. Backup Cpy Restre Alert jb Backup jb is always present n the Primary server and Cpy/Restre jbs are present n Standby server/stand by server. Alert jb is generally present in Mnitr server, if mnitr server is nt available then Alert jb wuld be present at bth Primary and Standby. Backup jb (Primary Main Service Accunt) requires Read and Write permissins n the Backup Share. Cpy jb (Standby Agent Service Accunt) requires nly Read permissins n it. Lg shipping is a lw cst technique fr disaster recvery slutin which yu can setup n primary server database and ne r mre secndary server databases. This is basically a three step prcesses backup, cpy and restre invlved in t cnfigure lg shipping. Once this technique is implemented it will autmatically backup the transactin lg n primary server as per jb schedule then it will cpy the transactin lg n secndary server and finally it will restre lg backups. Yu shuld have sysadmin rights n the server t implement lg shipping and read write permissin n flder invlved t hld transactin lg.
It is better t have same versin f SQL Server n bth side f primary and secndary server s that yu can d manual failver. Yu can d failver frm lwer versin f SQL Server t higher versin f SQL Server but reverse is nt pssible. Yur database must be in full recvery mdel r bulk-lgged recvery mdel t cnfigure and implement lg shipping. The fallwing diagram shws primary server, secndary server and mnitr server and their jbs and peratins.
Reasns fr Lg Shipping Failure: Jbs disabled can be a cause fr LS failure. Backup Share permissin issues. Space issues in the backup share/lcal cpy lcatin. SQL Server Agents stpped at Primary/Standby/Mnitr. Manual lg backup tk can be cause f LS break. Recvery Mdel change frm Full/Bulk Lgged t Simple. Backup/Cpy/Restre Jb wner change can cause permissin issues and break LS. Netwrk Issues with Backup Share. WITH RECOVERY statement fired at Standby server can bring secndary database ONLINE breaking LS. Service Accunt changes can lead t permissin issues. Lg backups getting crrupted /deleted. Backup schedule if changed can cause lt f delay which might raise an alert. Time zne differences between servers(primary/standby/mnitr) can cause issues in the backup/restre/cpy timings and can cause an issue.
Lg shipping may fail due t TUF file crruptin. Metadata tables in Lg shipping: Tables at Primary server:- lg_shipping_primary_databases cntains last backup file and date/timestamp. lg_shipping_primary_secndaries cntains primary and secndary details. lg_shipping_primaries cntains additinal clumns and has fcus n Planned Outage Timings. Tables at Secndary server:- lg_shipping_secndary cntains infrmatin abut last cpied file and timestamp. lg_shipping_secndary_databases cntains infrmatin abut last restred file and timestamp. lg_shipping_secndaries cntains additinal clumns and has fcus n Planned Outage Timings. Tables at Mnitr server: lg_shipping_mnitr_primary lg_shipping_mnitr_secndary lg_shipping_mnitr_alert lg_shipping_mnitr_errr_detail lg_shipping_mnitr_histry_detail Implementatin Plan fr Lg Shipping: Verified all the deplyed servers are able t ping each ther (Primary, Standby and Mnitr-BS) We can setup dmain and add all servers t dmain with single netwrk and assign IP address per every server. 10.10.10.1 - Primary 10.10.10.2 - Secndary
10.10.10.3 - Mnitr 10.10.10.3 - BackupShare \\10.10.10.3\LSBackupShare. (netwrk path ) Agent shuld be up and running DB shuld be in Full Recvery Mdel Backup Share shuld be created Permissins shuld be granted. Verified that all Instances and Agents are up and running with dmain service accunts. SQLPriSrv and SQLPriAgt SQLSecSrv and SQLSecAgt SQLMnSrv and SQLMnAgt Create backup share n a third server and grant SQL Server Main Service accunt f Primary instance Read and Write permissins. Verify the backup share frm Primary server with a sample DB backup test. Grant Read Permissins t SQL Server Agent and Main Service Accunt f Standby instance n backup share. Create a Lcal Cpy flder, s that Cpy jb can cpy files frm backup share int it. Identify the Primary database in the Primary server and check the recvery mdel f the database. LSDB -> Prperties -> Transactin Lg Shipping Enable this database as Primary in Lg Shipping Cnfiguratin Cnfigure Backup settings Prvide netwrk path: \\10.10.10.3\BackupShare Change the backup jb schedule as needed and alert timelines. Add Standby Servers (ne r many). LS allws unlimited standby but Micrsft recmmendatin is 10 standby databases per Primary. Add Standby and cnfigure settings fr Standby database. Enable Remte Cnnectins in Standby instance. sp_cnfigure 'remte admin cnnectins',1 recnfigure with verride
Enable prtcls in Cnfiguratin Manager at bth Client and Server. Initialize the standby: Let LS nly initialize the standby but we need t grant "Read" permissins t Secndary Server Main Service Accunt. Only then Secndary server can restre the Full backup directly frm Backup share. Map Service Accunts f bth Primary and Standby Agents int Mnitr Instance as lgins and grant them Sysadmin rights. This is required fr Backup, Cpy, Restre jbs t cmmunicate their status t Mnitr instance. Alternatively we can als use a SQL Authenticated Accunt if service accunts shuld nt be mapped. Create a SQL Authenticated lgin in Mnitr server and make sure the instance cnnectivity mde is Mixed mde. Als grant this lgin (mnitrinf) SYSADMIN rights t save secndary and primary cnfiguratin infrmatin. Advantages f Lg Shipping Althugh lg shipping requires the DBA's help t wrk, it des ffer sme advantages ver ther frms f failver: Easy setup. Lg shipping can be cnfigured by using the Database Maintenance Plan Wizard. With a few muse clicks and sme careful planning, yu can have a dependable failver slutin. Standby databases can be available fr read-nly queries. In sme envirnments, standby servers are used fr reprting. Nte, hwever, that a lg-shipped database will NOT be available while transactin lgs are applied t it. Therefre, if yu take transactin lg backups every hur, and if applying the backup t the standby server takes 10 minutes, the lg-shipped database will be available fr queries nly 50 minutes ut f every hur. Lw maintenance. Lg shipping usually wrks well; if ne f the steps fails SQL Server picks up exactly where it left ff and very little trubleshting is required. Multiple standby servers can be cnfigured. Yu can ship the transactin lgs frm the primary server t multiple standby servers. This way, yu further reduce the chances f dwntime. In additin, each standby server can be used fr a different purpse ne server can be used fr reprting and anther ne fr prviding high availability.
Disadvantages f Lg Shipping Unfrtunately, lg shipping des have a few issues that the DBA shuld be aware f prir t relying n this methd f failver: Pssible data lss when the primary server fails. If the primary server becmes cmpletely unusable, transactins that ccurred after the last transactin lg backup that was cpied t the standby server are lst. Fr example, suppse that server A fails at 5 a.m. and yu cannt get t it at all. If the last backup cpied t server B was taken at 4:45 a.m., all transactins that ccurred between 4:45 a.m. and 5 a.m. are lst frever. Sme manual DBA wrk is required t bring the standby server nline, as discussed in this article. Lg shipping setup cannt be scripted. This means that yu cannt mimic the prductin envirnment fr testing purpses withut ging thrugh the wizard screens. The Enterprise editin f SQL Server 2000 is required n primary and standby servers. If yu run any ther versin/editin f SQL Server, yu're ut f luck. The Develper editin can be used t learn hw t set up lg shipping, but it cannt be used in a prductin envirnment. Nte hwever, that lg shipping is merely an autmated way f cpying transactin lg backups, s a savvy DBA can easily set up jbs t accmplish the same functinality. Difficult trubleshting. Lg shipping usually wrks very well, but if there are prblems, they're difficult t trublesht dcumentatin is sparse and typically nt helpful fr slving a particular prblem. Frtunately Micrsft's Knwledge Base articles have gd infrmatin fr trubleshting lg-shipping issues. Each database that needs t be lg-shipped must be set up thrugh a separate maintenance plan. Database Mirrring benefits: Instantaneus synchrnizatin f changes Easy setup and maintenance
Autmated failver (in High Availability Mde) Easy t perfrm failver Fast failver. (if n transactins are queued) Applicatins can be mirrring aware using failver partner parameter in cnnectin string Database Mirrring limitatins: Limited number f databases can be mirrred per SQL instance. (hwever, this number is higher than the 10 yu see plastered everywhere, but really depends n yur hardware) Mirrred database cannt be queried, backed up, r basically tuched in any way (snapsht can be taken hwever) Only supprts ne t ne server pairings Cannt mirrr a database mre than nce Synchrnus mirrring is intlerant t latency and bandwidth cnstraints (Asynchrnus mirrring has n prblems with latency r bandwidth) Lg Shipping benefits: Very flexible Independent jbs gvern backup/cpy/restre behavir Delay f restre jb can prtect frm database crruptin Lg shipped database can be queried. (in standby mde) Lg shipping allws multiple standby databases Perhaps mre tlerant t latency than synchrnus mirrring. Desn t affect perfrmance f primary server Easy setup Lg Shipping limitatins: N autmated failver Cannt synchrnize faster than nce a minute Failver is mre cmplicated than mirrring Harder t view status f lg shipping