Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog


Channel Description:

Product Support and Discussion

older | 1 | 2 | 3 | (Page 4) | 5 | 6 | .... | 36 | newer

    0 0

    Hello,

    Yes it is possible to copy a backup to more than one location. You will need to edit the backup script, as this option is not available in the Back Up or Schedule Backup Jobs wizards. You can copy the script from the last step of the wizard, then edit and run it from SQL Server Management Studio.

    To copy a backup to another location, add COPYTO = '\\location\backups' to the WITH clause of the BACKUP command. You can include multiple COPYTO options to a BACKUP command. For example:

    Code:
    execute master..sqlbackup '-sql "BACKUP DATABASE ''AdventureWorks'' TO DISK = ''c:\Backups\<AUTO>.sqb'' WITH COPYTO = ''\\servername\dbbackups'', COPYTO = ''\\otherservername\dbbackups'' " '


    The SQL Backup Agent service must have permission to write to the COPYTO locations.

    More information on the COPYTO option is available here: http://www.red-gate.com/supportcenter/Content/SQL_Backup/help/7.2/SBU_BACKUP_cmd

    I hope that helps.

    Cheers,

    Marianne

    0 0

    Hi, thank you for your forum post.

    It is most definitely possible for SQL Backup to use multiple COPYTO parameters.

    However you cannot configure this using the wizards available through the SQL Backup GUI.

    If using the backup wizard you will need to script out the backup task to a new query window and manually add the second COPYTO comand. You can obtain the backup script in the last step of the Backup wizard via the script tab.

    Or if you wish to modify a scheduled backup job, open SSMS ->SQL Agent ->Jobs ->locate the job SQL backup created ->Right Click and select properties ->Steps->Edit the job step and manually add the second COPYTO command.

    Below, I have included Backup job syntax with two COPYTO parameters for reference, my example uses the code from a scheduled backup job:

    Code:

    DECLARE @exitcode int
    DECLARE @sqlerrorcode int
    EXECUTE master..sqlbackup '-SQL "BACKUP DATABASE [AdventureWorks] TO DISK = ''E:\Backups\<AUTO>.sqb'' WITH FILEOPTIONS = 5, ERASEFILES = 2b, ERASEFILES_REMOTE = 5b, CHECKSUM, DISKRETRYINTERVAL = 30, DISKRETRYCOUNT = 10, COMPRESSION = 4, COPYTO = ''\\server1\CopyToFolder1'', COPYTO = ''\\Server2\CopyToFolder2'', INIT, THREADCOUNT = 3, VERIFY"', @exitcode OUT, @sqlerrorcode OUT
    IF (@exitcode >= 500) OR (@sqlerrorcode <> 0)
    BEGIN
    RAISERROR ('SQL Backup failed with exit code: %d  SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
    END


    I hope the above answers your question.

    Many Thanks
    Eddie

    0 0

    I can't do a restore that includes full/diff/logs. I get sql error 3136 This differential cannot be restored because the database has not been restored to the correct earlier state. This happened after updating to 7.2.0.286 I'm really in a pickle here.

    0 0

    Seems to be related to Differential restores. A full with logs will restore.

    0 0

    Hi, I am trying make a copy our Production DB from a backup & running into issues described below

    Basically I am trying to

    1. Restore the MyDB as the MyDB2 with NORECOVERY & also move/replace the data/log logical files

    2. Restore the Log Files (backed up hourly) with NORECOVERY

    3. Restore the MyDB2 with RECOVERY & finalize it



    The issue we are running is that

    1. We can restore the DB ONLY with REPLACE option, but that means we cannot restore the Logs incrementally as the db is allready recovered

    2. Unable to restore the DB using the NORECOVERY option and get "The tail of the log for the database "PT" has not been backed up." error (not sure is there is something wrong with the backup OR its because we're trying to restore to a new DB (other than the one it was backed up))




    Command to restore the db & restore the mdf/ldf files + move an extra file -

    EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE [MyDB2] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\FULL_(local)_MyDB_20130110_000102.sqb' WITH NORECOVERY, MOVE N'MyDB_Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.QA\MSSQL\Data\MyDB2.mdf', MOVE N'MyDB_Log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.QA\MSSQL\Data\MyDB2.ldf' "'

    SQL error 3013: SQL error 3013: RESTORE DATABASE is terminating abnormally.
    SQL error 3159: SQL error 3159: The tail of the log for the database "MyDB2" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the
    RESTORE statement to just overwrite the contents of the log.


    On trying to restore the logs, I am getting

    EXECUTE master..sqlbackup '-SQL "RESTORE LOG MyDB2 FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\LOG_(local)_MyDB_20130109_180201.sqb' WITH NORECOVERY" '

    SQL error 3013: SQL error 3013: RESTORE LOG is terminating abnormally.
    SQL error 3117: SQL error 3117: The log or differential backup cannot be restored because no files are ready to rollforward.

    Any ideas?

    (Disclaimer : I am not a DBA & have limited database knowledge)

    0 0

    Try replacing the MyDB2 rather than just restoring to it. As it exists there could be a taillog that would need to be offloaded first.

    The other option is to take a log backup of MyDB2 before you try and replace it.

    HTH

    Chris

    0 0

    Chris, Thank for your tip.

    I had tried replacing the db earlier, using

    Code:
    EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE [MyDB2] FROM DISK = N'... ' WITH REPLACE, MOVE N'MyDB_Data' TO N'...', MOVE N'MyDB_Log' TO N'...' "'

    and although that ran fine, when I try to restore log files
    Code:

    RESTORE LOG MyDB2 FROM DISK = '...' WITH NORECOVERY

    I get
    Code:
    The media family on device 'C:\....sqb' is incorrectly formed. SQL Server cannot process this media family.

    I am not sure the issue is related so as I am trying to restore the log to a different DB (than original) OR cos the db is already closed/recovered as I used the REPLACE option

    Any thoughts?

    0 0

    Try running a log backup on MyDB2 before you try the restore.

    Chris

    0 0

    @#$% didnt work Sad

    -SQL "BACKUP LOGS [MyDB2] TO DISK = N'C:\Temp\Log\<AUTO>' " [SQLSTATE 01000]

    -SQL "RESTORE DATABASE [MyDB2] FROM DISK = N'....sqb' WITH MOVE N'MyDB_Data' TO N'...MyDB2.mdf', MOVE N'MyDB_Log' TO N'..MyDB2.ldf', , NORECOVERY " [SQLSTATE 01000]

    RESTORE LOG MyDB2 FROM DISK = '....sqb' WITH NORECOVERY [SQLSTATE 01000]
    Msg 3241, Sev 16, State 1, Line 1 : The media family on device '...sqb' is incorrectly formed. SQL Server cannot process this media family. [SQLSTATE 42000]
    Msg 3013, Sev 16, State 1, Line 1 : RESTORE LOG is terminating abnormally. [SQLSTATE 42000]

    0 0

    I hope that wasn't a typo but it should be BACKUP LOG not BACKUP LOGS.

    Chris

    0 0

    hmm I did use LOGS as thats what the documentation said Wink

    Code:
    L. Back up transaction logs for multiple databases

    This example creates transaction log backups for databases northwind and pubs in the default location.

    SQLBackupC.exe -I {instance name} -SQL "BACKUP LOGS [northwind, pubs] TO DISK = '<AUTO>' "

    EXECUTE master..sqlbackup '-SQL "BACKUP LOGS [northwind, pubs] TO DISK = ''<AUTO>'' " '


    http://www.red-gate.com/supportcenter/Content/SQL_Backup/help/7.2/SBU_Toolkit_syntax_egs#o15223

    will try with LOG now & see

    Thanks for your help

    0 0

    That was for two databases in one execution.

    Chris

    0 0

    No change, same error....

    -SQL "BACKUP LOG [MyDB2] TO DISK = N'C:\Temp\Log\DB2_FULL.log' " [SQLSTATE 01000]

    0 0

    Just a thought.

    If MyDB2 seems recovered then run DBCC CHECKDB with PHYSICAL_ONLY then try using the GUI to take a LOG backup to see that you have the permissions correct.

    Chris

    0 0

    DBCC ran fine and was able to backup the log..

    0 0

    Now try the restore again using the GUI.

    These should all be running with the account that runs SQLBackup so it doesn't look like a permissions issue.

    I am leaving now so I look forward to reading this thread on Monday.

    Chris

    0 0

    Well figured it out, was trying to restore the .sqb file with a Restore function Wink

    Ran it with "EXECUTE master..sqlbackup" & it works. Still had to backup the log before I tried to restore the db.

    Chris thanks for your help.

    0 0

    I suggest you restore all settings,and use by default.

    0 0

    Glad you managed to get it to work. Since SQL2005 if you have either Full or Bulk-Logged recovery model you need to run a Tail-log backup unless you use SQLBackup to force over an existing database.

    Chris

    0 0

    Is it possible that the differential backup requires a different full backup, and not the one you restored?

older | 1 | 2 | 3 | (Page 4) | 5 | 6 | .... | 36 | newer