如何将数据库复制并粘贴到同一服务器中 [英] How to copy and paste database into same server

查看:96
本文介绍了如何将数据库复制并粘贴到同一服务器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,

im使用vb.net作为前端,sqlserver 2008作为我的Windows应用程序的后端。

其中每年我想创建新的数据库与年份相同的名称

例如'dbname2013'现在明年我想用数据复制整个数据库并将此数据库重命名为'dbname2014'

有可能吗?

怎么办?

请帮帮我..

谢谢..

解决方案

您好,



您可以通过多种方式实现这一目标,提供一个简单的选项



1 。从您的.NET代码或任何代码运行当前DB 2013的Backup命令,然后SQL命令将备份数据库。

2.备份完成后,运行带有新名称DB2014的Restore命令。



除此之外,您可以使用SMO对象并使用数据库 http://technet.microsoft.com/en-us/library/ms162149.aspx [ ^ ]



我希望这个解决方案都可以帮到你。

Respected sir,
i m using vb.net as front end and sqlserver 2008 as backend for my windows application.
in which for every year i want to create new database with same name with year
for example 'dbname2013' now next year i want to copy whole database with data and rename this database to 'dbname2014'
Is it possible ?
how to do ?
Please help me..
Thank you..

解决方案

Hi,

You can achieve this by many ways giving one simple option

1. From Your .NET code or any code run Backup command for your current DB 2013 then SQL command will take backup of the database.
2. Once the backup is done run Restore command with new name DB2014.

Other than this you can use SMO object and play with the database http://technet.microsoft.com/en-us/library/ms162149.aspx[^]

I hope both the solution may help you.


这篇关于如何将数据库复制并粘贴到同一服务器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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