Auto kill the connection

Dear
I am using 9i, when i use sqlplus remote connect to database server after no action around 1 hrs. the remote connection will be dicsconnect automaticlly. How can i solve this problem?
Regards

This is generally related to profiles limits.
Check the user profile (in DBA_USERS) and then check the IDLE_TIME value from your profile (in DBA_PROFILES).
If you're not the DBA, ask him.
Regards,
Yoann.

Similar Messages

  • High CPU load kills ethernet connection

    Short spikes in CPU load (MenuMeters installed) are constantly killing my internet connection.
    I use an ethernet connection with a cable modem (Motorola SB 4200 E) and have a MB 2 CD, 2 GB of RAM and OS X 10.4.9.
    After the ethernet connection is killed, only a complete re-start can fix the problem (and today alone I had to do something like 15 of them already).
    These sudden spikes in CPU load can be caused by all different kinds of activity, e.g.
    1.) playing back video files which my machine has problems dealing with (like .mkv files),
    2.) playing back 'regular' .avi files,
    3.) browsing the net (Camino, Safari, Opera, Firefox) and displaying flash content (just watching something on youtube creates a CPU load which kills the connection regularly),
    4.) any kind of activity which asks a high CPU load in general.
    It seems that the problem is caused by the CPU load in general, not by any particular application which causes the high workload.
    What I have tried:
    1.) PRAM reset
    2.) Apple Hardware Test (extended, loop)
    3.) de-installed Flash player
    4.) created a new user (admin)
    5.) made a clean 10.4.11 install on an external USB drive and booted from there
    6.) used Airport instead of the ethernet/cable modem
    7.) checked system temperatures (which are ok)
    8.) changed/exchanged/checked the RAM
    9.) made enough free disk space on my HD (15 GB)
    10.) repaired disk permissions
    but to no avail.
    Any help would be very much appreciated (since I'm ready to get a MS machine and wave my Mac good bye).
    Kind regards
    FC

    Hi Fred, and a warm welcome to the forums!
    What Firmware cersion is it?
    http://www.dslreports.com/forum/remark,5221851
    Mac Modem problems with Broadcom Chipset...
    All Linksys Cable Modems
    All Motorola Cable Modems except for the SB5120
    All Scientific Atlanta Cable Modems
    http://discussions.apple.com/thread.jspa?messageID=2985422&#2985422
    t seems that the problem is caused by the CPU load in general, not by any particular application which causes the high workload.
    Do you have Activity Monitor set to Show All Processes?

  • Ni server killing network connection

    Hi, for some reason when i try to connect to an OPC item using labview datasocket/ni server. Its killing the connection between remote opc server and the client Labview client i have created. It even crashes the opc server by hanging for some reason.
    Stuart

    Hi and thank you for your quick response.
    So what should i do if want to use the VPN Service (thats what the DHCP and Internet sharing is for)?
    What Firewall settings should i check?
    The VPN Network hat no limitation in the Firewall.
    My current workaround is to reboot every night, witch is NOT a very good and/or permanent solution.

  • TS1398 when i update my software to 6.1.3(10B329)to I phone 4s the wifi is not working and not auto join the network that i have already connected to

    when i update my software to 6.1.3(10B329)to I phone 4s the wifi is not working and not auto join the network that i have already connected to

    First, grow up.  Just because YOUR phone isn't working, doesn't mean Apple put out bad software.  I've not had any difficulty, nor has anyone else I know.  And just how is Apple risking lives with Bluetooth kits not working?  It's YOUR decision to talk on the phone or text and drive.  Not Apple's.
    We're users here, volunteering our time to help others.  Posts like yours, which are whiny and ranting, simply means we're likely to ignore you and not provide you with any help.  Not to mention, it makes you look absolutely foolish.
    Further making you look foolish is the fact that you haven't even asked a technical support question, nor have you provided anyone here with any troubleshooting steps you might have taken, including those recommended in the user guide.
    Good luck getting help.
    GDG

  • How do you turn off Auto-Sync without connecting  the ipod  to PC?

    My Purchased Tracks was deleted off my computer, but I still have all of them on my ipod. I have iTunes 7, so I am aware I can transfer all my purchased music from my ipod to itunes. But I know auto-sync is set up, so when I connect it to my computer, won't it automatically sync itunes with my ipod and therefore delete my purchased music on my ipod? Can I turn off auto-sync without connecting my ipod?

    A couple of ways...
    Hold down the Shift + Ctrl keys when you plug in the iPod. (For a PC)
    Or...
    Connect your iPod, but before it starts to sync, click that little X on the right hand side of the ITunes display at the top of the page. (Next to the "Do Not Disconnect" message.)
    Then click box at bottom that says manually manage music.

  • Kill the RFC connection as soon as the call is completed in Web Dynpro JAVA

    Hi Experts,
    Please guide us how to kill the RFC Connection from web dynpro java as soon as the execution is completed.The FM connection (Adaptive RFC) isnt getting closed in IS-U side. Please guide us how to close them explicitly.
    We are getting the following error
    (102) RFC_ERROR_COMMUNICATION max number of cpic clients exceeded (300)

    hi suvankar ,
    wdContext.current<Modelname>_InputElement().modelObject().modelInstance().disconnectIfAlive();
    use this option after executing your rfc, it will remove the connection to the r/3.
    adn this
    (102) RFC_ERROR_COMMUNICATION max number of cpic clients exceeded (300)  -- is occuring because the pool size defined the jco destination is not sufficient, ask your basis team to increase the pool size.
    Regards
    Govardan

  • Timeout: Tuxedo kills the service but not the database connection

    Hi all,
    I am experiencing some performance problems on my system due an efficient SQL and a Tuxedo improper timeout handling.
    A service is using a "problematic" SQL (we will tune it but it's not the main problem). After 60 seconds from the execution, Tuxido kills the services for a timeout.
    At this point I would like Tuxedo to notify DB2 database as well in order to stop processing the SQL. Instead the SQL continues running on the database (also if the service is killed) and this produce a gradual slow down of the performances.
    In the UBBCONFIG, we are using a service configuration like the following timeout configuration:
    .RESOURCES
    SCANUINIT 5
    SANITYSCAN 6
    BLOCKTIME 12
    .SERVICES
    DEFAULT: SVCTIMEOUT=45
    service1 SVCTIMEOUT=60 TRANTIME=60
    service2 SVCTIMEOUT=60 TRANTIME=60
    Note: not all the services are listed in the .SERVICES section and we are using the default NOTIFY as well as an OPENINFO.
    Can you please help me in finding a configuration to kill both the services and the database?
    Thanks in advance,
    Benedetto

    Hi Benedetto.
    First of all, Tuxedo doesn't kill services, it kills servers. Your UBBCONFIG file specifies three timeouts, BLOCKTIME, SVCTIMEOUT, and TRANTIME.
    BLOCKTIME specifies how long a Tuxedo API that needs a response will wait for that response. If the response isn't received in that period of time, Tuxedo will return TPETIME to the caller. As with any failure, if the request was part of a transaction, the transaction is marked rollback only. Note, this timeout does not affect the request, whether sitting in a server's IPC queue or currently executing in a server.
    SVCTIMEOUT is a much more severe timeout and determines how long Tuxedo will allow a service implementation to execute. If a service implementation doesn't reply within the SVCTIMEOUT period, Tuxedo will issue an OS level KILL request to kill the process. If the server is marked restartable, Tuxedo will then try to restart the server assuming none of the restart limits have been reached. Killing the server causes the request to be lost within the server so the caller will stay blocked until BLOCKTIME is reached at which point the above actions will take place.
    TRANTIME is the amount of time Tuxedo allows a transaction to remain active and viable. When this period expires, Tuxedo will mark the transaction as timed out with the only option being rollback. As well, Tuxedo aborts any API requests that would normally cause messaging to occur, i.e., making a tpcall() within a timed out transaction will fail without any attempt to call the service.
    So in your case, the issue is partially that you have the values of your timeouts in somewhat reverse order. Typically we see BLOCKTIME being the smallest value, with TRANTIME typically larger than BLOCKTIME, and SVCTIMEOUT larger even still, although there are good reasons for exceptions to this guideline. Part of the reasoning behind this is that killing a server is a significant thing and its usually best to try and let the server complete whatever its doing, if if the work has been timed out either due to BLOCKTIME or TRANTIME, since the cost of killing and restarting a server is significant.
    Tuxedo will notify the database of the transaction status when the application finally issues a tpcommit() or a tpabort() request, but not until then. Although, if SVCTIMEOUT is hit, then killing the server should cause the database connection to be lot.
    If you could describe the behavior you are seeing and the relevant portions of your ULOG we can try to make some sense of what is happening.
    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect

  • Stale connection kills the VM

    Here is the scoop: a process (JDK 1.3 w/ Oracle OCI driver v8.1.6, running on Windows 2000) establishes a connection to the database (Oracle 7.3.4) and opens a number of PreparedStatement(s). While the connection is open and idle, the database instance bounces. After that, any calls on PreparedStatements on that connection kills the VM with this message:
    # An EXCEPTION_ACCESS_VIOLATION exception has been detected in native code outside the VM.
    # Program counter=0x604b0ae1
    # Problematic Thread: prio=5 tid=0x12738ee0 nid=0x514 runnable
    I believe an error occurs in the native OCI driver code and is not mapped to a JVM exception.
    Did anyone else see this? On a related subject, is there a good way to ping the conneciton? (isClosed() did not work)
    null

    Anyone? Bueler?

  • To kill a connection (and the thread running it)

    As a last resort to deal with potential hanging in the DB (Sybase), I'd like to
    find a way to stop the processing. I'm willing to violate some rule, such as calling
    Thread.stop. But that doesn't seem to drop the connection. Any suggestion how
    I can drop that connection? Thanks. /Bill

    Joe, as you know I also posted at Sybase/jdbc. I'm reposting the last post here
    for the benefits of anyone else might be interested in the thread.
    I tried out cancel and it essentially did the same thing as set timeout, except
    the time is more precise since the application controls it. Set timeout is more
    economical to operate though. I'll probably take one of these, which do solve
    half of the problem, for the time being until something better comes along. Unfortunately,
    though, the other half causes more problems because when that happens, other executions
    will pile on and get blocked as well.
    Joseph Weinstein <[email protected]> wrote:
    >
    >
    Bill wrote:
    As a last resort to deal with potential hanging in the DB (Sybase),I'd like to
    find a way to stop the processing. I'm willing to violate some rule,such as calling
    Thread.stop. But that doesn't seem to drop the connection. Any suggestionhow
    I can drop that connection? Thanks. /BillKilling the thread is bad for the server, because it only creates a fixed
    number of
    execute-threads to do user work... The things you should try are:
    1 - Call cancel() on the jdbc statement that is hanging. Call connection.close()
    on the connection. This requires having access to those objects from
    another
    thread.
    2 - Find out the spid of the hung DBMS session (either record it ahead
    of time or
    query the DBMS with another connection) and use T-SQL to kill that DBMS
    session.
    3 - Try resetting the pool.
    Joe

  • OS 8.0 update OTA to my 4S has killed the device. After the initial attempt failed I tried via iTune Restore and got Error 29. Attempts to restore to an older version (7.1.2) failed as well. Same error. The phone is stuck in the familiar "connect to

    OS 8.0 update OTA to my 4S has killed the device. After the initial attempt failed I tried via iTune Restore and got Error 29.
    Attempts to restore to an older version (7.1.2) failed as well. Same error.
    The phone is stuck in the familiar "connect to iTunes" screen. 
    Has iOS8 destroyed my phone?

    Hi vijay294,
    Welcome to the Apple Support Communities!
    I understand that you received a restore error while attempting to update to iOS 8 and now you see the Connect to iTunes graphic on your display. In this situation, I would recommend using recovery mode to restore your iPhone. Please use the instructions located in the attached article to complete this process. 
    If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support
    Best regards,
    Joe

  • Save as template kill the web part connection

    Hi,
    I have a Sharepoint web site and I would like to save it as a template in order to create several site with the same structure and the same web pages.
    On some of my web part pages I have some webpart connected to each other (mostly BDC List web part and BDC related list web part). When I save the site as a template and create a new site based on this template most of the connection are not present in the
    new site. Does anyone know what is the problem and how to solve it? I really need this to work as the site template will contains tens of pages with those connection and we will have to create tens of site with that template so manually recreating the connection
    is not possible.
    Thank you for your help.

    No web part connections are managed by sharepoint and are stored on the page on which the connected web part are as I know.
    Any way I managed to find a solution. I deleted all the web part connections (Open sharepoint designer and deleted all the SPWebPartConnection tags.) and then I recreated all the connections within the browser.  I don't know why but now it works.
    The mysteries of SharePoint are endless.

  • Having trouble streaming videos.  Is there anything I can do to speed up the connection?

    Having trouble streaming videos. Is there anything I can do to speed up the connection?

    Here is the information....
    Problem description: Having trouble with streaming videos. Slow and unresponsive. EtreCheck version: 2.1.5 (108) Report generated December 28, 2014 at 10:27:27 PM EST Click the [Support] links for help with non-Apple products. Click the [Details] links for more information about that line. Click the [Adware] links for help removing adware. Hardware Information: ℹ️ iMac (24-inch, Early 2008) (Verified) iMac - model: iMac8,1 1 2.8 GHz Intel Core 2 Duo CPU: 2-core 2 GB RAM Upgradeable BANK 0/DIMM0 1 GB DDR2 SDRAM 800 MHz ok BANK 1/DIMM1 1 GB DDR2 SDRAM 800 MHz ok Bluetooth: Old - Handoff/Airdrop2 not supported Wireless: en1: 802.11 a/b/g/n Video Information: ℹ️ ATI Radeon HD 2600 Pro - VRAM: 256 MB iMac 1920 x 1200 System Software: ℹ️ OS X 10.10.1 (14B25) - Uptime: 7:20:12 Disk Information: ℹ️ Hitachi HDP725032GLA380 disk0 : (320.07 GB) EFI (disk0s1) <not mounted> : 210 MB Macintosh HD (disk0s2) / : 319.21 GB (230.03 GB free) Recovery HD (disk0s3) <not mounted> [Recovery]: 650 MB USB Information: ℹ️ Apple Inc. Built-in iSight Apple Inc. BRCM2046 Hub Apple Inc. Bluetooth USB Host Controller Apple Computer, Inc. IR Receiver Gatekeeper: ℹ️ Mac App Store and identified developers Adware: ℹ️ Downlite [Remove] Problem System Launch Daemons: ℹ️ [killed] com.apple.wdhelper.plist one process killed due to memory pressure Launch Agents: ℹ️ [loaded] com.coupons.coupond.plist [Support] [invalid?] com.vsearch.agent.plist Adware! [Remove] [running] jp.co.canon.ScanGearMF.appl.Canon-MF-Scan-Agent.plist [Support] Launch Daemons: ℹ️ [loaded] com.adobe.fpsaud.plist [Support] [invalid?] com.vsearch.daemon.plist Adware! [Remove] [invalid?] com.vsearch.helper.plist Adware! [Remove] User Login Items: ℹ️ iTunesHelper Application (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app) Microsoft Messenger Application (/Applications/Microsoft Office 2008/Microsoft Messenger.app) apple-scc-20141118-211745 UNKNOWN (missing value) Internet Plug-ins: ℹ️ FlashPlayer-10.6: Version: 16.0.0.235 - SDK 10.6 [Support] CouponPrinter-FireFox_v2: Version: 5.0.3 - SDK 10.6 [Support] Flash Player: Version: 16.0.0.235 - SDK 10.6 [Support] QuickTime Plugin: Version: 7.7.3 Default Browser: Version: 600 - SDK 10.10 3rd Party Preference Panes: ℹ️ Flash Player [Support] Time Machine: ℹ️ Auto backup: YES Volumes being backed up: Macintosh HD: Disk size: 319.21 GB Disk used: 89.18 GB Destinations: moms stuff [Local] Total size: 0 B Total number of backups: 1 Oldest backup: 2014-11-19 03:42:00 +0000 Last backup: 2014-11-19 03:42:00 +0000 Size of backup disk: Too small Backup size 0 B < (Disk used 89.18 GB X 3) Top Processes by CPU: ℹ️ 14% VTDecoderXPCService 3% WindowServer 1% coreaudiod 0% AppleSpell 0% askpermissiond Top Processes by Memory: ℹ️ 86 MB Safari 52 MB com.apple.WebKit.WebContent 49 MB Mail 34 MB WindowServer 28 MB Microsoft Word Virtual Memory Information: ℹ️ 42 MB Free RAM 558 MB Active RAM 528 MB Inactive RAM 347 MB Wired RAM 3.53 GB Page-ins 67 MB Page-outs Diagnostics Information: ℹ️ Dec 28, 2014, 03:07:57 PM Self test - passed Dec 27, 2014, 03:32:55 AM /Library/Logs/DiagnosticReports/discoveryd_2014-12-27-033255_[redacted].crashPr oblem description: Having trouble with streaming videos. Slow and unresponsive. EtreCheck version: 2.1.5 (108) Report generated December 28, 2014 at 10:27:27 PM EST Click the [Support] links for help with non-Apple products. Click the [Details] links for more information about that line. Click the [Adware] links for help removing adware. Hardware Information: ℹ️ iMac (24-inch, Early 2008) (Verified) iMac - model: iMac8,1 1 2.8 GHz Intel Core 2 Duo CPU: 2-core 2 GB RAM Upgradeable BANK 0/DIMM0 1 GB DDR2 SDRAM 800 MHz ok BANK 1/DIMM1 1 GB DDR2 SDRAM 800 MHz ok Bluetooth: Old - Handoff/Airdrop2 not supported Wireless: en1: 802.11 a/b/g/n Video Information: ℹ️ ATI Radeon HD 2600 Pro - VRAM: 256 MB iMac 1920 x 1200 System Software: ℹ️ OS X 10.10.1 (14B25) - Uptime: 7:20:12 Disk Information: ℹ️ Hitachi HDP725032GLA380 disk0 : (320.07 GB) EFI (disk0s1) <not mounted> : 210 MB Macintosh HD (disk0s2) / : 319.21 GB (230.03 GB free) Recovery HD (disk0s3) <not mounted> [Recovery]: 650 MB USB Information: ℹ️ Apple Inc. Built-in iSight Apple Inc. BRCM2046 Hub Apple Inc. Bluetooth USB Host Controller Apple Computer, Inc. IR Receiver Gatekeeper: ℹ️ Mac App Store and identified developers Adware: ℹ️ Downlite [Remove] Problem System Launch Daemons: ℹ️ [killed] com.apple.wdhelper.plist one process killed due to memory pressure Launch Agents: ℹ️ [loaded] com.coupons.coupond.plist [Support] [invalid?] com.vsearch.agent.plist Adware! [Remove] [running] jp.co.canon.ScanGearMF.appl.Canon-MF-Scan-Agent.plist [Support] Launch Daemons: ℹ️ [loaded] com.adobe.fpsaud.plist [Support] [invalid?] com.vsearch.daemon.plist Adware! [Remove] [invalid?] com.vsearch.helper.plist Adware! [Remove] User Login Items: ℹ️ iTunesHelper Application (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app) Microsoft Messenger Application (/Applications/Microsoft Office 2008/Microsoft Messenger.app) apple-scc-20141118-211745 UNKNOWN (missing value) Internet Plug-ins: ℹ️ FlashPlayer-10.6: Version: 16.0.0.235 - SDK 10.6 [Support] CouponPrinter-FireFox_v2: Version: 5.0.3 - SDK 10.6 [Support] Flash Player: Version: 16.0.0.235 - SDK 10.6 [Support] QuickTime Plugin: Version: 7.7.3 Default Browser: Version: 600 - SDK 10.10 3rd Party Preference Panes: ℹ️ Flash Player [Support] Time Machine: ℹ️ Auto backup: YES Volumes being backed up: Macintosh HD: Disk size: 319.21 GB Disk used: 89.18 GB Destinations: moms stuff [Local] Total size: 0 B Total number of backups: 1 Oldest backup: 2014-11-19 03:42:00 +0000 Last backup: 2014-11-19 03:42:00 +0000 Size of backup disk: Too small Backup size 0 B < (Disk used 89.18 GB X 3) Top Processes by CPU: ℹ️ 14% VTDecoderXPCService 3% WindowServer 1% coreaudiod 0% AppleSpell 0% askpermissiond Top Processes by Memory: ℹ️ 86 MB Safari 52 MB com.apple.WebKit.WebContent 49 MB Mail 34 MB WindowServer 28 MB Microsoft Word Virtual Memory Information: ℹ️ 42 MB Free RAM 558 MB Active RAM 528 MB Inactive RAM 347 MB Wired RAM 3.53 GB Page-ins 67 MB Page-outs Diagnostics Information: ℹ️ Dec 28, 2014, 03:07:57 PM Self test - passed Dec 27, 2014, 03:32:55 AM /Library/Logs/DiagnosticReports/discoveryd_2014-12-27-033255_[redacted].crash

  • The "Connecting..." goes on forever even if web page is already loaded (With NoScript addon)

    The "connecting ..." green circle goes on forever, even though web pages loaded correctly, and no problem surfing *all* web sites. I suspect NoScript addon blocks some of the contents. At those web sites, if I allow NoScript to load all ("temporary allow all" it will stop this problem and no more green circles. But the 'Allow All" must apply to all tabs. Applying to only one tab won't do. Even if only one tab is partially blocked by NoScript, the green circle will be on ALL the tabs.
    Request Firefox fix this in future version.
    My system Info:
    Win7 Home Premium 64-bit, 8G memory, Firefox 12. Addon: NoScript 2.4.3 (it auto updates)

    I’ve seen several different discussions about this issue, and none of them have a real solution to it. It affects too few users for FF Support to get a handle on what the issue is. Here are links to some other discussions.
    https://groups.google.com/forum/?fromgroups#!topic/mozilla.support.firefox/M-fmY6bbCE8
    This user has a similar issue, and is blaming a particular site:
    http://support.mozilla.org/en-US/questions/941659
    Several of the users posting here seem to have the same issue:
    http://forums.mozillazine.org/viewtopic.php?t=2322845&f=38
    I have had this problem fairly consistently in FF7 and in FF8, on my PC at work. I usually have several FF windows open with multiple tabs open in each.
    FF works fine, but after some time has gone by, when I click a link or try to refresh a page, the Connecting issue appears. When one page (tab) does this, all the pages do it and nothing will load or reload in FF. Note that I often have IE pages open as well, and they continue to work. The only solution for me has been to go to Task Manager and kill the Firefox process. Then when I open Firefox it offers to restore the pages (and includes an unnecessary apology). I restore the pages and everything is back to working fine.
    When I leave for the day, I leave my PC on and logged in, and after some time the screen locks. In the morning I log in to unlock the screen and begin working. This is when the issue most often appears.
    This morning, when the issue started, I went to Error Console and found these warnings. This list goes on for several screenfuls. All of the errors are at nyt or nytimes URLs. Most of them have a timestamp of 7:27 – 7:51 last night. The rest are at 8:02 this morning, which is probably when I first clicked a link on an FF page. Not that I had logged in (unlocked) the PC around 7:30, and no errors were logged until I tried to click something.
    Timestamp: 11/29/2012 8:02:06 AM
    Warning: Error in parsing value for 'background-image'. Declaration dropped.
    Source File: http://css.nyt.com/css/0.1/screen/common/modal/nytModal.css
    Line: 199
    Timestamp: 11/29/2012 8:02:06 AM
    Warning: Error in parsing value for 'background-image'. Declaration dropped.
    Source File: http://css.nyt.com/css/0.1/screen/common/modal/nytModal.css
    Line: 203
    Timestamp: 11/29/2012 8:02:06 AM
    Warning: Error in parsing value for 'background-image'. Declaration dropped.
    Source File: http://css.nyt.com/css/0.1/screen/common/modal/nytModal.css
    Line: 207
    Timestamp: 11/29/2012 8:02:06 AM
    Warning: Unknown property '-moz-box-shadow'. Declaration dropped.
    Source File: http://css.nyt.com/css/app/facebook/newsletterPrefs.css
    Line: 17
    Timestamp: 11/29/2012 8:02:09 AM
    Warning: Unknown property '-moz-border-radius'. Declaration dropped.
    Source File: http://www.nytimes.com/
    Line: 6

  • BACKUP LOG suddenly failed with Msg 35250, Level 16, State 11 The connection to the primary replica is not active. The command cannot be processed.

    I have AlwaysOn SQL 2012 Enterprise set-up using Windows Failover Clustering Services (not FCI), and have 1 Primary node (P), 1 Synchronous Commit Auto Failover (SC), and 1 Asynchronous Commit Manual Failover (AC) node.  It is set up to prefer secondary,
    with the highest priority given to AC node.
    I am using Ola Hollengren's scripts for Database Maintenance jobs, including a native BACKUP LOG job for the transaction logs of all user databases on a 1 minute schedule.  His scripts already consider AlwaysOn, and although the job is set-up on all
    3 nodes, only ever runs on AC node.
    The job has been running successfully since initial set-up almost 1 year ago, but suddenly yesterday morning started to fail with the following error, only on 1 of the 13 databases in my availability group:
    Date and time: 2014-06-08 09:36:11
    Command: BACKUP LOG [my_db] TO DISK = N'E:\MSSQL\\Transaction Dumps\my_db\MySQLCL$MySQLAG_my_db_20140608_093610_U_LOG.trn' WITH CHECKSUM, COMPRESSION
    Msg 35250, Level 16, State 11, Server AC, Line 1
    The connection to the primary replica is not active.  The command cannot be processed.
    Msg 3013, Level 16, State 1, Server AC, Line 1
    BACKUP LOG is terminating abnormally.
    Outcome: Failed
    Duration: 00:01:00
    The other 12 databases continued to backup successfully.
    Checking the Availability Group dashboard, windows event logs, and SQL Server error logs, including Failover Cluster events showed no issues.
    However, monitoring software (Idera SQLdm) showed blocked sessions on P node.  When I ran sp_who2, it showed that a background process was being blocked by another background process with an HADR BACKUP LOCK.
    Since both processes were background processes, I was unable to kill either process.  I temporarily disabled the transaction log backup job, but the blocked process was still active.
    I ran DBCC CHECKDB (my_db) WITH all_errormsgs, no_infomsgs, data_purity on both P and AC nodes, with no errors.  However, on AC node, it also showed 1 transaction rolled forward and 0 transactions rolled back.  This also had the effect of releasing
    the blocked background process, but another background process was now blocking with the same HADR BACKUP LOCK.
    I tried to restart SQL Server Agent on AC node, which did not immediately seem to work.  However, after a few minutes, I noticed that the block had disappeared.  I re-enabled the transaction log backup job on AC and it started working normally
    again.  The error has not occurred again, but I am at a loss as to what happened, and how to prevent it from happening again.
    Any help would be greatly appreciated.
    Diane

    And here is part 2 of the stored procedure:
    --// Execute backup commands //--
    WHILE EXISTS (SELECT * FROM @tmpDatabases WHERE Selected = 1 AND Completed = 0)
    BEGIN
    SELECT TOP 1 @CurrentDBID = ID,
    @CurrentDatabaseName = DatabaseName,
    @CurrentDatabaseNameFS = DatabaseNameFS,
    @CurrentDatabaseType = DatabaseType
    FROM @tmpDatabases
    WHERE Selected = 1
    AND Completed = 0
    ORDER BY ID ASC
    SET @CurrentDatabaseID = DB_ID(@CurrentDatabaseName)
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    BEGIN
    IF EXISTS (SELECT * FROM sys.database_recovery_status WHERE database_id = @CurrentDatabaseID AND database_guid IS NOT NULL)
    BEGIN
    SET @CurrentIsDatabaseAccessible = 1
    END
    ELSE
    BEGIN
    SET @CurrentIsDatabaseAccessible = 0
    END
    END
    ELSE
    BEGIN
    SET @CurrentIsDatabaseAccessible = 0
    END
    SELECT @CurrentDifferentialBaseLSN = differential_base_lsn
    FROM sys.master_files
    WHERE database_id = @CurrentDatabaseID
    AND [type] = 0
    AND [file_id] = 1
    -- Workaround for a bug in SQL Server 2005
    IF @Version >= 9 AND @Version < 10
    AND EXISTS(SELECT * FROM sys.master_files WHERE database_id = @CurrentDatabaseID AND [type] = 0 AND [file_id] = 1 AND differential_base_lsn IS NOT NULL AND differential_base_guid IS NOT NULL AND differential_base_time IS NULL)
    BEGIN
    SET @CurrentDifferentialBaseLSN = NULL
    END
    SELECT @CurrentDifferentialBaseIsSnapshot = is_snapshot
    FROM msdb.dbo.backupset
    WHERE database_name = @CurrentDatabaseName
    AND [type] = 'D'
    AND checkpoint_lsn = @CurrentDifferentialBaseLSN
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    BEGIN
    SELECT @CurrentLogLSN = last_log_backup_lsn
    FROM sys.database_recovery_status
    WHERE database_id = @CurrentDatabaseID
    END
    SET @CurrentBackupType = @BackupType
    IF @ChangeBackupType = 'Y'
    BEGIN
    IF @CurrentBackupType = 'LOG' AND DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') <> 'SIMPLE' AND @CurrentLogLSN IS NULL AND @CurrentDatabaseName <> 'master'
    BEGIN
    SET @CurrentBackupType = 'DIFF'
    END
    IF @CurrentBackupType = 'DIFF' AND @CurrentDifferentialBaseLSN IS NULL AND @CurrentDatabaseName <> 'master'
    BEGIN
    SET @CurrentBackupType = 'FULL'
    END
    END
    IF @CurrentBackupType = 'LOG'
    BEGIN
    SELECT @CurrentLatestBackup = MAX(backup_finish_date)
    FROM msdb.dbo.backupset
    WHERE [type] IN('D','I')
    AND is_damaged = 0
    AND database_name = @CurrentDatabaseName
    END
    IF @Version >= 11 AND @Cluster IS NOT NULL
    BEGIN
    SELECT @CurrentAvailabilityGroup = availability_groups.name,
    @CurrentAvailabilityGroupRole = dm_hadr_availability_replica_states.role_desc
    FROM sys.databases databases
    INNER JOIN sys.availability_databases_cluster availability_databases_cluster ON databases.group_database_id = availability_databases_cluster.group_database_id
    INNER JOIN sys.availability_groups availability_groups ON availability_databases_cluster.group_id = availability_groups.group_id
    INNER JOIN sys.dm_hadr_availability_replica_states dm_hadr_availability_replica_states ON availability_groups.group_id = dm_hadr_availability_replica_states.group_id AND databases.replica_id = dm_hadr_availability_replica_states.replica_id
    WHERE databases.name = @CurrentDatabaseName
    END
    IF @Version >= 11 AND @Cluster IS NOT NULL AND @CurrentAvailabilityGroup IS NOT NULL
    BEGIN
    SELECT @CurrentIsPreferredBackupReplica = sys.fn_hadr_backup_is_preferred_replica(@CurrentDatabaseName)
    END
    SELECT @CurrentDatabaseMirroringRole = UPPER(mirroring_role_desc)
    FROM sys.database_mirroring
    WHERE database_id = @CurrentDatabaseID
    IF EXISTS (SELECT * FROM msdb.dbo.log_shipping_primary_databases WHERE primary_database = @CurrentDatabaseName)
    BEGIN
    SET @CurrentLogShippingRole = 'PRIMARY'
    END
    ELSE
    IF EXISTS (SELECT * FROM msdb.dbo.log_shipping_secondary_databases WHERE secondary_database = @CurrentDatabaseName)
    BEGIN
    SET @CurrentLogShippingRole = 'SECONDARY'
    END
    -- Set database message
    SET @DatabaseMessage = 'Date and time: ' + CONVERT(nvarchar,GETDATE(),120) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Database: ' + QUOTENAME(@CurrentDatabaseName) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Status: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Standby: ' + CASE WHEN DATABASEPROPERTYEX(@CurrentDatabaseName,'IsInStandBy') = 1 THEN 'Yes' ELSE 'No' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Updateability: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Updateability') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'User access: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'UserAccess') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Is accessible: ' + CASE WHEN @CurrentIsDatabaseAccessible = 1 THEN 'Yes' ELSE 'No' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Recovery model: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') AS nvarchar) + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Availability group: ' + @CurrentAvailabilityGroup + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Availability group role: ' + @CurrentAvailabilityGroupRole + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Is preferred backup replica: ' + CASE WHEN @CurrentIsPreferredBackupReplica = 1 THEN 'Yes' WHEN @CurrentIsPreferredBackupReplica = 0 THEN 'No' ELSE 'N/A' END + CHAR(13) + CHAR(10)
    IF @CurrentDatabaseMirroringRole IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Database mirroring role: ' + @CurrentDatabaseMirroringRole + CHAR(13) + CHAR(10)
    IF @CurrentLogShippingRole IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Log shipping role: ' + @CurrentLogShippingRole + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Differential base LSN: ' + ISNULL(CAST(@CurrentDifferentialBaseLSN AS nvarchar),'N/A') + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Differential base is snapshot: ' + CASE WHEN @CurrentDifferentialBaseIsSnapshot = 1 THEN 'Yes' WHEN @CurrentDifferentialBaseIsSnapshot = 0 THEN 'No' ELSE 'N/A' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Last log backup LSN: ' + ISNULL(CAST(@CurrentLogLSN AS nvarchar),'N/A') + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = REPLACE(@DatabaseMessage,'%','%%') + ' '
    RAISERROR(@DatabaseMessage,10,1) WITH NOWAIT
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    AND NOT (DATABASEPROPERTYEX(@CurrentDatabaseName,'UserAccess') = 'SINGLE_USER' AND @CurrentIsDatabaseAccessible = 0)
    AND DATABASEPROPERTYEX(@CurrentDatabaseName,'IsInStandBy') = 0
    AND NOT (@CurrentBackupType = 'LOG' AND (DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') = 'SIMPLE' OR @CurrentLogLSN IS NULL))
    AND NOT (@CurrentBackupType = 'DIFF' AND @CurrentDifferentialBaseLSN IS NULL)
    AND NOT (@CurrentBackupType IN('DIFF','LOG') AND @CurrentDatabaseName = 'master')
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'FULL' AND @CopyOnly = 'N' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'FULL' AND @CopyOnly = 'Y' AND (@CurrentIsPreferredBackupReplica <> 1 OR @CurrentIsPreferredBackupReplica IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'DIFF' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'LOG' AND @CopyOnly = 'N' AND (@CurrentIsPreferredBackupReplica <> 1 OR @CurrentIsPreferredBackupReplica IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'LOG' AND @CopyOnly = 'Y' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT ((@CurrentLogShippingRole = 'PRIMARY' AND @CurrentLogShippingRole IS NOT NULL) AND @CurrentBackupType = 'LOG')
    BEGIN
    -- Set variables
    SET @CurrentDate = GETDATE()
    IF @CleanupTime IS NULL OR (@CurrentBackupType = 'LOG' AND @CurrentLatestBackup IS NULL) OR @CurrentBackupType <> @BackupType
    BEGIN
    SET @CurrentCleanupDate = NULL
    END
    ELSE
    IF @CurrentBackupType = 'LOG'
    BEGIN
    SET @CurrentCleanupDate = (SELECT MIN([Date]) FROM(SELECT DATEADD(hh,-(@CleanupTime),@CurrentDate) AS [Date] UNION SELECT @CurrentLatestBackup AS [Date]) Dates)
    END
    ELSE
    BEGIN
    SET @CurrentCleanupDate = DATEADD(hh,-(@CleanupTime),@CurrentDate)
    END
    SELECT @CurrentFileExtension = CASE
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'FULL' THEN 'bak'
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'DIFF' THEN 'bak'
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'LOG' THEN 'trn'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'FULL' THEN 'bak'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'DIFF' THEN 'bak'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'LOG' THEN 'trn'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'FULL' THEN 'sqb'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'DIFF' THEN 'sqb'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'LOG' THEN 'sqb'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'FULL' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'DIFF' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'LOG' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'FULL' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'DIFF' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'LOG' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'FULL' THEN 'safe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'DIFF' THEN 'safe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'LOG' THEN 'safe'
    END
    INSERT INTO @CurrentDirectories (ID, DirectoryPath, CreateCompleted, CleanupCompleted)
    SELECT ROW_NUMBER() OVER (ORDER BY ID), DirectoryPath + CASE WHEN RIGHT(DirectoryPath,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END, 0, 0
    FROM @Directories
    ORDER BY ID ASC
    SET @CurrentFileNumber = 0
    SET @CurrentMirrorFilePath = NULL
    WHILE @CurrentFileNumber < @NumberOfFiles
    BEGIN
    SET @CurrentFileNumber = @CurrentFileNumber + 1
    SELECT @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE @CurrentFileNumber >= (ID - 1) * (SELECT @NumberOfFiles / COUNT(*) FROM @CurrentDirectories) + 1
    AND @CurrentFileNumber <= ID * (SELECT @NumberOfFiles / COUNT(*) FROM @CurrentDirectories)
    SET @CurrentFilePath = @CurrentDirectoryPath + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + @CurrentDatabaseNameFS + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    IF LEN(@CurrentFilePath) > 257
    BEGIN
    SET @CurrentFilePath = @CurrentDirectoryPath + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + LEFT(@CurrentDatabaseNameFS,CASE WHEN (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) < 20 THEN 20 ELSE (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) END) + '...' + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    END
    IF @CurrentFileNumber = 1 AND LEN(@MirrorDirectory) > 0
    BEGIN
    SET @CurrentMirrorFilePath = @MirrorDirectory + CASE WHEN RIGHT(@MirrorDirectory,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + @CurrentDatabaseNameFS + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    IF LEN(@CurrentFilePath) > 257
    BEGIN
    SET @CurrentMirrorFilePath = @MirrorDirectory + CASE WHEN RIGHT(@MirrorDirectory,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + LEFT(@CurrentDatabaseNameFS,CASE WHEN (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) < 20 THEN 20 ELSE (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) END) + '...' + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    END
    END
    INSERT INTO @CurrentFiles (CurrentFilePath)
    SELECT @CurrentFilePath
    SET @CurrentDirectoryPath = NULL
    SET @CurrentFilePath = NULL
    END
    -- Create directory
    WHILE EXISTS (SELECT * FROM @CurrentDirectories WHERE CreateCompleted = 0)
    BEGIN
    SELECT TOP 1 @CurrentDirectoryID = ID,
    @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE CreateCompleted = 0
    ORDER BY ID ASC
    SET @CurrentCommandType01 = 'xp_create_subdir'
    SET @CurrentCommand01 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_create_subdir N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''' IF @ReturnCode <> 0 RAISERROR(''Error creating directory.'', 16, 1)'
    EXECUTE @CurrentCommandOutput01 = [dbo].[CommandExecute] @Command = @CurrentCommand01, @CommandType = @CurrentCommandType01, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput01 = @Error
    IF @CurrentCommandOutput01 <> 0 SET @ReturnCode = @CurrentCommandOutput01
    UPDATE @CurrentDirectories
    SET CreateCompleted = 1,
    CreateOutput = @CurrentCommandOutput01
    WHERE ID = @CurrentDirectoryID
    SET @CurrentDirectoryID = NULL
    SET @CurrentDirectoryPath = NULL
    SET @CurrentCommand01 = NULL
    SET @CurrentCommandOutput01 = NULL
    SET @CurrentCommandType01 = NULL
    END
    -- Perform a backup
    IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE CreateOutput <> 0 OR CreateOutput IS NULL)
    BEGIN
    IF @BackupSoftware IS NULL
    BEGIN
    SELECT @CurrentCommandType02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP_DATABASE'
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP_LOG'
    END
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @Compress = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COMPRESSION'
    IF @Compress = 'N' AND @Version >= 10 SET @CurrentCommand02 = @CurrentCommand02 + ', NO_COMPRESSION'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SELECT @CurrentCommandType02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'xp_backup_database'
    WHEN @CurrentBackupType = 'LOG' THEN 'xp_backup_log'
    END
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_database @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    WHEN @CurrentBackupType = 'LOG' THEN 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_log @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    END
    SELECT @CurrentCommand02 = @CurrentCommand02 + ', @filename = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ', @with = '''
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    SET @CurrentCommand02 = @CurrentCommand02 + ''''
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', @read_write_filegroups = 1'
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @compressionlevel = ' + CAST(@CompressionLevel AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @buffercount = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @maxtransfersize = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @threads = ' + CAST(@Threads AS nvarchar)
    IF @Throttle IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @throttle = ' + CAST(@Throttle AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @desc = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @cryptlevel = ' + CASE
    WHEN @EncryptionType = 'RC2-40' THEN '0'
    WHEN @EncryptionType = 'RC2-56' THEN '1'
    WHEN @EncryptionType = 'RC2-112' THEN '2'
    WHEN @EncryptionType = 'RC2-128' THEN '3'
    WHEN @EncryptionType = '3DES-168' THEN '4'
    WHEN @EncryptionType = 'RC4-128' THEN '5'
    WHEN @EncryptionType = 'AES-128' THEN '6'
    WHEN @EncryptionType = 'AES-192' THEN '7'
    WHEN @EncryptionType = 'AES-256' THEN '8'
    END
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptionkey = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ' IF @ReturnCode <> 0 RAISERROR(''Error performing LiteSpeed backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType02 = 'sqlbackup'
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', COMPRESSION = ' + CAST(@CompressionLevel AS nvarchar)
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', THREADCOUNT = ' + CAST(@Threads AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', KEYSIZE = ' + CASE
    WHEN @EncryptionType = 'AES-128' THEN '128'
    WHEN @EncryptionType = 'AES-256' THEN '256'
    END
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', PASSWORD = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqlbackup N''-SQL "' + REPLACE(@CurrentCommand02,'''','''''') + '"''' + ' IF @ReturnCode <> 0 RAISERROR(''Error performing SQLBackup backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType02 = 'BACKUP_DATABASE'
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType02 = 'xp_ss_backup'
    SET @CurrentCommand02 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_backup @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    SELECT @CurrentCommand02 = @CurrentCommand02 + ', ' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) = 1 THEN '@filename' ELSE '@backupfile' END + ' = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    IF @CurrentMirrorFilePath IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @mirrorfile = N''' + @CurrentMirrorFilePath + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ', @backuptype = ' + CASE WHEN @CurrentBackupType = 'FULL' THEN '''Full''' WHEN @CurrentBackupType = 'DIFF' THEN '''Differential''' WHEN @CurrentBackupType = 'LOG' THEN '''Log''' END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', @readwritefilegroups = 1'
    SET @CurrentCommand02 = @CurrentCommand02 + ', @checksum = ' + CASE WHEN @CheckSum = 'Y' THEN '1' WHEN @CheckSum = 'N' THEN '0' END
    SET @CurrentCommand02 = @CurrentCommand02 + ', @copyonly = ' + CASE WHEN @CopyOnly = 'Y' THEN '1' WHEN @CopyOnly = 'N' THEN '0' END
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @compressionlevel = ' + CASE WHEN @CompressionLevel = 5 THEN N'ispeed' WHEN @CompressionLevel = 6 THEN N'isize' ELSE CAST(@CompressionLevel AS nvarchar) END
    IF @RetryWrites IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @retrywrites = N''' + @RetryWrites + ''''
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @threads = ' + CAST(@Threads AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @desc = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptiontype = N''' + CASE
    WHEN @EncryptionType = 'AES-128' THEN 'AES128'
    WHEN @EncryptionType = 'AES-256' THEN 'AES256'
    END + ''''
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptedbackuppassword = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ' IF @ReturnCode <> 0 RAISERROR(''Error performing SQLsafe backup.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput02 = [dbo].[CommandExecute] @Command = @CurrentCommand02, @CommandType = @CurrentCommandType02, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput02 = @Error
    IF @CurrentCommandOutput02 <> 0 SET @ReturnCode = @CurrentCommandOutput02
    END
    -- Verify the backup
    IF @CurrentCommandOutput02 = 0 AND @Verify = 'Y'
    BEGIN
    IF @BackupSoftware IS NULL
    BEGIN
    SET @CurrentCommandType03 = 'RESTORE_VERIFYONLY'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SET @CurrentCommandType03 = 'xp_restore_verifyonly'
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_restore_verifyonly'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' @filename = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ', @with = '''
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    SET @CurrentCommand03 = @CurrentCommand03 + ''''
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand03 = @CurrentCommand03 + ', @encryptionkey = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand03 = @CurrentCommand03 + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying LiteSpeed backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType03 = 'sqlbackup'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand03 = @CurrentCommand03 + ', PASSWORD = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqlbackup N''-SQL "' + REPLACE(@CurrentCommand03,'''','''''') + '"''' + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying SQLBackup backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType03 = 'RESTORE_VERIFYONLY'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType03 = 'xp_ss_verify'
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_verify @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    SELECT @CurrentCommand03 = @CurrentCommand03 + ', ' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) = 1 THEN '@filename' ELSE '@backupfile' END + ' = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying SQLsafe backup.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput03 = [dbo].[CommandExecute] @Command = @CurrentCommand03, @CommandType = @CurrentCommandType03, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput03 = @Error
    IF @CurrentCommandOutput03 <> 0 SET @ReturnCode = @CurrentCommandOutput03
    END
    -- Delete old backup files
    IF (@CurrentCommandOutput02 = 0 AND @Verify = 'N' AND @CurrentCleanupDate IS NOT NULL)
    OR (@CurrentCommandOutput02 = 0 AND @Verify = 'Y' AND @CurrentCommandOutput03 = 0 AND @CurrentCleanupDate IS NOT NULL)
    BEGIN
    WHILE EXISTS (SELECT * FROM @CurrentDirectories WHERE CleanupCompleted = 0)
    BEGIN
    SELECT TOP 1 @CurrentDirectoryID = ID,
    @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE CleanupCompleted = 0
    ORDER BY ID ASC
    IF @BackupSoftware IS NULL
    BEGIN
    SET @CurrentCommandType04 = 'xp_delete_file'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + @CurrentFileExtension + ''', ''' + CONVERT(nvarchar(19),@CurrentCleanupDate,126) + ''' IF @ReturnCode <> 0 RAISERROR(''Error deleting files.'', 16, 1)'
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SET @CurrentCommandType04 = 'xp_slssqlmaint'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_slssqlmaint N''-MAINTDEL -DELFOLDER "' + REPLACE(@CurrentDirectoryPath,'''','''''') + '" -DELEXTENSION "' + @CurrentFileExtension + '" -DELUNIT "' + CAST(DATEDIFF(mi,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + '" -DELUNITTYPE "minutes" -DELUSEAGE'' IF @ReturnCode <> 0 RAISERROR(''Error deleting LiteSpeed backup files.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType04 = 'sqbutility'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqbutility 1032, N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''', N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + CASE WHEN @CurrentBackupType = 'FULL' THEN 'D' WHEN @CurrentBackupType = 'DIFF' THEN 'I' WHEN @CurrentBackupType = 'LOG' THEN 'L' END + ''', ''' + CAST(DATEDIFF(hh,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + 'h'', ' + ISNULL('''' + REPLACE(@EncryptionKey,'''','''''') + '''','NULL') + ' IF @ReturnCode <> 0 RAISERROR(''Error deleting SQLBackup backup files.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType04 = 'xp_delete_file'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + @CurrentFileExtension + ''', ''' + CONVERT(nvarchar(19),@CurrentCleanupDate,126) + ''' IF @ReturnCode <> 0 RAISERROR(''Error deleting files.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType04 = 'xp_ss_delete'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_delete @filename = N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + '\*.' + @CurrentFileExtension + ''', @age = ''' + CAST(DATEDIFF(mi,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + 'Minutes'' IF @ReturnCode <> 0 RAISERROR(''Error deleting SQLsafe backup files.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput04 = [dbo].[CommandExecute] @Command = @CurrentCommand04, @CommandType = @CurrentCommandType04, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput04 = @Error
    IF @CurrentCommandOutput04 <> 0 SET @ReturnCode = @CurrentCommandOutput04
    UPDATE @CurrentDirectories
    SET CleanupCompleted = 1,
    CleanupOutput = @CurrentCommandOutput04
    WHERE ID = @CurrentDirectoryID
    SET @CurrentDirectoryID = NULL
    SET @CurrentDirectoryPath = NULL
    SET @CurrentCommand04 = NULL
    SET @CurrentCommandOutput04 = NULL
    SET @CurrentCommandType04 = NULL
    END
    END
    END
    -- Update that the database is completed
    UPDATE @tmpDatabases
    SET Completed = 1
    WHERE Selected = 1
    AND Completed = 0
    AND ID = @CurrentDBID
    -- Clear variables
    SET @CurrentDBID = NULL
    SET @CurrentDatabaseID = NULL
    SET @CurrentDatabaseName = NULL
    SET @CurrentBackupType = NULL
    SET @CurrentFileExtension = NULL
    SET @CurrentFileNumber = NULL
    SET @CurrentDifferentialBaseLSN = NULL
    SET @CurrentDifferentialBaseIsSnapshot = NULL
    SET @CurrentLogLSN = NULL
    SET @CurrentLatestBackup = NULL
    SET @CurrentDatabaseNameFS = NULL
    SET @CurrentDatabaseType = NULL
    SET @CurrentDate = NULL
    SET @CurrentCleanupDate = NULL
    SET @CurrentIsDatabaseAccessible = NULL
    SET @CurrentAvailabilityGroup = NULL
    SET @CurrentAvailabilityGroupRole = NULL
    SET @CurrentIsPreferredBackupReplica = NULL
    SET @CurrentDatabaseMirroringRole = NULL
    SET @CurrentLogShippingRole = NULL
    SET @CurrentCommand02 = NULL
    SET @CurrentCommand03 = NULL
    SET @CurrentCommandOutput02 = NULL
    SET @CurrentCommandOutput03 = NULL
    SET @CurrentCommandType02 = NULL
    SET @CurrentCommandType03 = NULL
    DELETE FROM @CurrentDirectories
    DELETE FROM @CurrentFiles
    END
    --// Log completing information //--
    Logging:
    SET @EndMessage = 'Date and time: ' + CONVERT(nvarchar,GETDATE(),120)
    SET @EndMessage = REPLACE(@EndMessage,'%','%%')
    RAISERROR(@EndMessage,10,1) WITH NOWAIT
    IF @ReturnCode <> 0
    BEGIN
    RETURN @ReturnCode
    END
    END
    GO
    ALTER AUTHORIZATION ON [dbo].[DatabaseBackup] TO SCHEMA OWNER
    GO
    Diane

  • The connection to Microsoft Exchange is unavailable

    Environment: Windows 7 Pro 64bit
    Setup: Fresh install of Office 2010 64-bit from office 365 web site on a fresh install of Win 7 Pro 64bit.
    Issue: I first launched Outlook and tried to link a new account to the client by putting in my email address and password.  It seemed to take it, but a new dialog box keeps poping up asking me for my password (it shows the email address
    already filled in).  It acts as if it does not like my password, but I know it is correct because I can log in and get my mail through the web access.
    When after 5 or 6 tries, I press cancel, I get the error message  " The action cannot be completed. The connection to Microsoft Exchange is unavailable.  Outlook must be online or connected to complete this action."  Then I get a
    dialog box listing the Microsoft Exchange Server and Mailbox.
    Steps to resolve:
    I am at a total loss on how to resolve this issue, is there anyway to manually connect to M.E> as it is just saying the connection is unavailable.  All of the other threads dealing with this issue have been no help.  I can sign into my account
    at login.microsoftonline.net so I know the account is valid.  I also receive email to my iPhone with the account and server.  Any advice would be wonderful.
    I went into Control Panel ->Mail, and deleted the profile.  Then I tried to create a new profile and I got the same results as the first time through Outlook directly.  Also, this is Windows 7 64 and office 64, but in Control Panel, it says
    Mail(32bit).  This is a completely new install so I don't know why it is not working.  I have performed this exact same install on a dozen machines over the last 2 years without a single hitch.
    I checked my DNS records and everything seems to check out.  I haven't changed anything in DNS for over a year.
    I am out of the office so I cannot copy some of the registry entries as some of the other posts recommend.
    I ran remote connectivity analyzer.  I don't know what it is saying, but below are the things that seemed to be irregular:
    1) Attempting to test potential Autodiscover URL https://X123.com:443/Autodiscover/Autodiscover.xml
      Testing of this potential Autodiscover URL failed.
    2)Testing TCP port 443 on host X123.com to ensure it's listening and open.
        The specified port is either blocked, not listening, or not producing the expected response.
    Any help would really be appreciated.
    Tom

    Hi Tom,
    Please manually configure your Office 365 account in Outlook 2010 to check whether the issue persists. About how to manually configure Outlook for Office 365 account, please refer to:
    http://blogs.technet.com/b/hot/archive/2012/02/06/how-to-manually-configure-outlook-office-365.aspx
    If the account can be manually configured but can’t be auto-configured by using autodiscover, please open Outlook - press CTRL key - right click on the Outlook icon from right bottom corner taskbar - Test Email AutoConfiguration. Put your email address -
    uncheck use guessmart and secure guessmart authentication - click Test to check your Autodiscover service. If possible, please post the
    Results tab and Log tab here for further troubleshooting.
    Regards,
    Winnie Liang
    TechNet Community Support

Maybe you are looking for

  • Scanning different size documents.

    I need to scan letter and legal size documents into one PDF. I have adjusted the presets to Automatic in the paper size section but it only scans them to letter. Help!

  • "Invalid column type" error while calling pl/sql function in AM

    Code written in AM is ... String MISSING_TIME_SHEET_CALL = "begin ? = missing_time_sheet(?,?,?,?); end;"; CallableStatement timeSheetStmt = txn.createCallableStatement(MISSING_TIME_SHEET_CALL, 1); timeSheetStmt.registerOutParameter(1,Types.BOOLEAN);

  • Add Business intelligence and forms to existing 9iAS

    How do I add Business intelligence and forms to a existing installation of 9iAS (Portal and wireless). Vinodh R.

  • Configuring Multicast

    Hello, I want to configure a multicast network but I'm confused about creating a multicast group. I think that I have to assign a multicast address to a switch interface and then to connect a computer to this interface, isn't it? In the attachment th

  • Attr change run for huge PC!

    Hi, I have 30 infopackages which i had included in a new process chain and for all infoobjects i had created only one attr chnage run by including all the relevant info objects in the variant of aatr change run! there are actauuly some parellel proce