SQL server 2008数据库的备份与还原

本文详细介绍了如何在Microsoft SQL Server 2008中进行学籍数据库'Dsideal_school_db'的备份与还原操作,并提供了针对还原过程中可能出现的问题及解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、SQL数据库的备份

1、依次打开 开始菜单 → 程序 → Microsoft SQL Server 2008 → SQL Server Management Studio → 数据库:Dsideal_school_db既是我们需要备份的学籍数据库

id="iframe_0.16647199948130575" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/2012042901580430430.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.16647199948130575',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(1)

2、选择要备份的数据库“Dsideal_school_db”,点击鼠标右键 → 任务 → 备份,如图(2):

id="iframe_0.6456361060312039" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429015826212621.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6456361060312039',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(2)

3、在打开的“备份数据库 —Dsideal_school_db”对话框中,先点击删除,然后点击“添加”,如图(3):

id="iframe_0.3355340597736636" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429015941694169.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.3355340597736636',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(3)

4、在弹出的“选择备份目标”对话框中,如图(4)

id="iframe_0.70860779557318" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/2012042901590133133.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.70860779557318',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(4)

5、选择好备份的路径(如D盘的江西-学籍-数据库备份文件夹中),文件类型选择“所有文件”,“文件名”那个位置填写上您要备份的数据库的名字(最好在您备份的数据库的名字后面加上日期,以方便以后查找),之后连续点击“确定”按钮即可完成数据库的备份操作,如图(5):

id="iframe_0.10292092140438025" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429015940624062.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.10292092140438025',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(5

二、SQL数据库的还原

1、选择您要还原的数据库“Dsideal_school_db”,点击鼠标右键 → 任务 → 还原 → 数据库,如图(6):

id="iframe_0.5125936445340471" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020045324532.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5125936445340471',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(6)

2、在出现的“还原数据库 — school_web_db”对话框中选择“源设备”,然后点击后面的“…”按钮,如图(7):

id="iframe_0.7626211488172248" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020038083808.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7626211488172248',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(7)

3、在出现的“指定备份”对话框中,点击“添加”按钮,如图(8):

id="iframe_0.7290453298369013" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020023782378.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7290453298369013',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(8)

4、找到数据库备份的路径,选择您所要还原的数据库“Dsideal_school_db”(注意:文件类型选择所有文件),然后连续“两次”点击“确定”按钮,如图(9):

id="iframe_0.9833078357284857" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020074427442.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.9833078357284857',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(9)

5、在出现的“还原数据库 — Dsideal_school_db”对话框中,勾选上“选择用户还原的备份集”下的数据库前的复选框,如图(10)

id="iframe_0.44592104143726896" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020067056705.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.44592104143726896',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(10)

6、然后选择“选项”,勾选上“覆盖现有数据库”,如图(11):

id="iframe_0.7852315628181605" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020024472447.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7852315628181605',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

图(11)

三、还原数据库问题解决方案

id="iframe_0.047829353721601464" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/2012042902010333333.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.047829353721601464',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

在还原数据库“Dsideal_school_db”时,有时会遇见上图中的问题“因为数据库正在使用,所以无法获得对数据库的独占访问权”,此时我们可以按照以下步骤解决此问题

1、右键数据库“Dsideal_school_db”,然后选择“属性”,如下图

id="iframe_0.5795988508669452" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020199189918.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5795988508669452',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

2、在出现的“数据库属性 — Dsideal_school_db ”对话框中,选择“选项”,在“其他选项”下的“状态”中找到“限制访问”。选择“SINGLE_USER”,点击“确定”按钮,如下图:

id="iframe_0.8449439038724091" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://tech.huweishen.com/picture/20124/20120429020195299529.jpg?_=2576382%22%20style=%22border:none;max-width:1509px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.8449439038724091',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 1509px;">

3、按照正常还原数据库的步骤,还原数据库。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值