备份
方法1,选择对应的数据库名-------》右键 任务---------》备份
默认备份类型 完整
文件后缀 .bak

方法2,选择对应的数据库名-------》右键 任务----------》生成脚本

选择要编写的数据库对象(表,视图,存储过程等)

选择对应的 服务器版脚本,数据库数据或架构

默认保存文件格式 .sql
还原
方法 1,默认选择 数据库 右键还原数据库

选择设备 找到你备份的数据库文件 .bak(注意必需同一台服务器)

方法2,附加数据库(.mdf)
默认服务器上数据库的mdf文件会保存在C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA 目录下
拷贝 .mdf 和 .ldf 2个文件
选择数据库------》右键 附加


添加对应的 .mdf文件就可以了(数据库名可以修改为你要的数据库名称 附加为)

常见错误

修改 文件权限 .mdf .ldf 右键 ------>属性 安全 在弹出的对话框中的"组或用户名"中选中"Authenticated Users"
在"Authenticated Users的权限"下,勾选"完全控制"

最后点击"确定"就可以了。修改权限完成后,你就可以成功的附加数据库了