منو

پشتیبان گیری بی منت

پشتیبان گیری بی منت:پشتیبان گیری بی منت
پشتیبان گیری بی منت

sqlcmd -iD:\xand\commands\sqlbackup.sql

-

SQL::::::::::::::::::::::::::::

declare MyC cursor
    forward_only read_only for
    select name from sys.databases order by name

    declare @dbname nvarchar(100)

    open MyC

    fetch next from MyC into @dbname

    while @@fetch_status=0
        begin
            print @dbname
            if @dbname in (xand,search,mainDB)
                begin
                    declare @command nvarchar(4000)
                    set @command=backup database + @dbname + to disk=e:\xand\BackUp\sql\xand_sql_ +
                        convert(varchar(100),getdate(),112 ) + - + @dbname + .bak

                    select @command
                    exec (@command)
                end
            fetch next from MyC into @dbname
        end

    close MyC
    deallocate MyC
go

::::::::::::::::::::::::::::::::::::::::::::::::::

file backup

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("WinRAR a -m1 H:\xand\BackUp\xand_file_" & Year(now()) & "-" & Right("0" & Month(now()), 2) & "-" & Right("0" & Day(now()), 2) & " E:\xand\www")

::::::::::::::::::::::::::::::::::::::::::::::::::

file to rar and delete

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("WinRAR m -pxand.ir -m1 H:\xand\BackUp\xand_sql_" & Year(now()) & "-" & Right("0" & Month(now()), 2) & "-" & Right("0" & Day(now()), 2) & ".rar H:\xand\BackUp\sql\*.bak")

25 نظر

  • محمد زند / 10 صبح / 5 دی 1395, / جواب

    تست

    • محمد زند / 10 صبح / 5 دی 1395, / جواب

      تست

نظر بدهید

به صفحه اول خوش آمدید