如何从数据库进行备份? [英] how could I make backup from database?

查看:72
本文介绍了如何从数据库进行备份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了此存储过程,用于从数据库进行备份,但是它不起作用.有谁知道我该如何纠正?

I wrote this stored procedure for making a back up from database but it doesn''t work. Is there anyone who knows how I could correct it?

ALTER PROCEDURE [dbo].[makebackup]
    -- Add the parameters for the stored procedure here
    @path nvarchar(50)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    backup database[elm]to disk _@path with init
END

推荐答案

BEGIN  
  BACKUP 
      DATABASE [YOUR_DB] 
  TO 
      DISK = @Path
  WITH 
      NOFORMAT, INIT, NAME=@BackUpName 
END


阅读文章 ^ ].


感谢您的回答.
我测试了您的建议,但是会出现以下错误:

thank you for your answer.
I tested your suggestion but it take this error:

SELECT *
INTO elm_backup IN 'backup.mdb'
FROM elm.mdf




消息156,级别15,状态1,过程测试备份,第16行
关键字"IN"附近的语法不正确.

看到我想给它一个路径,以保存到我的路径中.




Msg 156, Level 15, State 1, Procedure testbackup, Line 16
Incorrect syntax near the keyword ''IN''.

see I want to give it a path to save back up in my path.


这篇关于如何从数据库进行备份?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆