Can't perform a backup or restore operation within a transaction [duplicate]









up vote
-3
down vote

favorite













This question already has an answer here:



  • Cannot perform a backup or restore operation within a transaction

    2 answers



I am trying to restore a transaction log to the database with a Python script. But I get an error message




cannot perform a backup or restore operation within a transaction




How can I solve this problem?



query_ms=r"""
RESTORE LOG [miadmfggp_live] FROM
DISK =N'C:yardi_backupextract201811081130.bak0',
WITH STANDBY =N'C:Program FilesMicrosoft SQL ServerMSSQL12.YARDI_BACKUP_DEVMSSQLBackupstandby_log_file.bak' ;
"""
cursor_ms.execute(query_ms)
result=cursor_ms.fetchone()









share|improve this question















marked as duplicate by petezurich, Mitch Wheat sql
Users with the  sql badge can single-handedly close sql questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 8 at 22:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















    up vote
    -3
    down vote

    favorite













    This question already has an answer here:



    • Cannot perform a backup or restore operation within a transaction

      2 answers



    I am trying to restore a transaction log to the database with a Python script. But I get an error message




    cannot perform a backup or restore operation within a transaction




    How can I solve this problem?



    query_ms=r"""
    RESTORE LOG [miadmfggp_live] FROM
    DISK =N'C:yardi_backupextract201811081130.bak0',
    WITH STANDBY =N'C:Program FilesMicrosoft SQL ServerMSSQL12.YARDI_BACKUP_DEVMSSQLBackupstandby_log_file.bak' ;
    """
    cursor_ms.execute(query_ms)
    result=cursor_ms.fetchone()









    share|improve this question















    marked as duplicate by petezurich, Mitch Wheat sql
    Users with the  sql badge can single-handedly close sql questions as duplicates and reopen them as needed.

    StackExchange.ready(function()
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function()
    $hover.showInfoMessage('',
    messageElement: $msg.clone().show(),
    transient: false,
    position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
    dismissable: false,
    relativeToBody: true
    );
    ,
    function()
    StackExchange.helpers.removeMessages();

    );
    );
    );
    Nov 8 at 22:39


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















      up vote
      -3
      down vote

      favorite









      up vote
      -3
      down vote

      favorite












      This question already has an answer here:



      • Cannot perform a backup or restore operation within a transaction

        2 answers



      I am trying to restore a transaction log to the database with a Python script. But I get an error message




      cannot perform a backup or restore operation within a transaction




      How can I solve this problem?



      query_ms=r"""
      RESTORE LOG [miadmfggp_live] FROM
      DISK =N'C:yardi_backupextract201811081130.bak0',
      WITH STANDBY =N'C:Program FilesMicrosoft SQL ServerMSSQL12.YARDI_BACKUP_DEVMSSQLBackupstandby_log_file.bak' ;
      """
      cursor_ms.execute(query_ms)
      result=cursor_ms.fetchone()









      share|improve this question
















      This question already has an answer here:



      • Cannot perform a backup or restore operation within a transaction

        2 answers



      I am trying to restore a transaction log to the database with a Python script. But I get an error message




      cannot perform a backup or restore operation within a transaction




      How can I solve this problem?



      query_ms=r"""
      RESTORE LOG [miadmfggp_live] FROM
      DISK =N'C:yardi_backupextract201811081130.bak0',
      WITH STANDBY =N'C:Program FilesMicrosoft SQL ServerMSSQL12.YARDI_BACKUP_DEVMSSQLBackupstandby_log_file.bak' ;
      """
      cursor_ms.execute(query_ms)
      result=cursor_ms.fetchone()




      This question already has an answer here:



      • Cannot perform a backup or restore operation within a transaction

        2 answers







      python sql sql-server






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 22:23









      petezurich

      3,37881633




      3,37881633










      asked Nov 8 at 22:08









      Yang L

      223




      223




      marked as duplicate by petezurich, Mitch Wheat sql
      Users with the  sql badge can single-handedly close sql questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Nov 8 at 22:39


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by petezurich, Mitch Wheat sql
      Users with the  sql badge can single-handedly close sql questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Nov 8 at 22:39


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          cursor_ms.autocommit='true' could solve the problem






          share|improve this answer



























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            cursor_ms.autocommit='true' could solve the problem






            share|improve this answer
























              up vote
              0
              down vote













              cursor_ms.autocommit='true' could solve the problem






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                cursor_ms.autocommit='true' could solve the problem






                share|improve this answer












                cursor_ms.autocommit='true' could solve the problem







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 8 at 22:33









                Yang L

                223




                223













                    Popular posts from this blog

                    𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

                    Edmonton

                    Crossroads (UK TV series)