现在有一个一天24小时运行的在线商品网站后台数据库,数据文件目前是5G不到,问题是我现在使用完整备份为什么总是备份不下来?每次就是在一开始生成一个0kb或者2kb的备份文件然后就掉在那里了。job activity monitor(任务活动监视)就显示这个备份任务一直在运行。在备份数据库前是否需要停止运行数据库吗?在同一个服务器上的开发库,大小是4G多一点,几分钟就备份好了。请教有经验的各位,这可能是什么原因?
服务器版本 windows 2003, SQL server 2005

解决方案 »

  1.   

    运行中的数据库是可以备份的。你试试用脚本看看:backup database 数据库名称 to disk='D:aa.bak' with init
      

  2.   

    可我每次做备份都被吊住了。同样的开发库就没有问题,百思不得其解。
    有什么步骤可以查一下?我写程序比较多,DBA做得很少。
      

  3.   

    http://wenku.baidu.com/view/7f7a9e275901020207409cba.html
      

  4.   


    -- 连线1执行
    select @@spid --> 记录此spid号backup database [数据库名] to disk='[备份文件]' with format,init --> 执行备份-- 连线2执行
    select * from sys.sysprocesses
    where spid=[连线1的spid] or blocked=[连线1的spid]
    --> 查看连线1执行状态及是否被阻塞
      

  5.   

    连线1的select都没显出出来就吊住了,不过我还是可以得到spid
    然后根据连线2的查询得到字段blocked的值是0,这是没阻塞吧?但那个备份一直在执行~
      

  6.   

    取消查询都不行,我只能重启sql server服务。不然那个进程就一直在那里。杀不掉。
      

  7.   

    用sql脚本 可以解决你的“吊住了”问题。
    BACKUP DATABASE [test] TO  DISK = N'D:\11.BAK' WITH NOFORMAT, NOINIT,  NAME = N'test-完整 数据库 备份', SKIP, NOREWIND, NOUNLOAD, COMPRESSION,  STATS = 10
    用 MSSQL自带的工具执行是,DB上G后就会出现你说的 “吊住了”问题。用脚本就不会了。我就是这样做的。但是没有发现原因。
      

  8.   

    请问和fulltext catalog这个东西有关吗?
      

  9.   


    这是我从log中看到的。查看其他英文资料好像和sql server full text search服务有关啊。要先挂起这个服务才能继续,问题是只要有查询这个服务就不会被挂起,那岂不是还是要在数据库几乎离线情况下才能备份?在线的商品数据库时时刻刻都会有人查询啊。这是英文原话:
    Generally, SQL Server performs these tasks during a BACKUP operation:
    1. Temporarily suspends Microsoft Full-Text Engine for SQL Server (MSFTESQL) service and flushes to disk all pending changes to the full-text catalog. Also, SQL Server stops all write activity on the catalog and queues all changes that have not yet been processed at the start of the backup in the notification log so that these changes could be committed to the full-text catalogs when the backup is complete.
    The catalog status is persisted on disk. At this point, you can still query the catalog.2. Backs up all table and full-text catalog data, change tracking log, and metadata.3. Backs up all data, in the transaction log, that has occurred since the backup process started.4. Resumes MSFTESQL service as well as the population of full-text indexes.