如何将源数据库复制或移动到目标数据库并通过脚本或创建作业从源数据库中删除所有事务? [英] How can I copy or move source database to destination database and delete all transactions from source database through script or creating a job ?

查看:123
本文介绍了如何将源数据库复制或移动到目标数据库并通过脚本或创建作业从源数据库中删除所有事务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为source的集中式数据库,其中每天会插入十万条记录,这导致我的网络应用程序很慢从中获取数据。



因此,为了减少数据库的负载,我想为它创建一个作业/脚本,它每天晚上大约凌晨1点运行,它将源数据库复制到同一服务器上的目标数据库,并从源数据库中删除最后一个日期的所有事务记录。



我不是一个好的SQL人..请指导或建议..



非常感谢提前。



我尝试过:



我查了一下线上!但无法获得正确的解决方案,因为许多是手动操作。



我想要一个合理的解决方案。

解决方案

< blockquote>有一个选项,您需要使用脚本任务创建一个ssis包(Sql Server集成服务),将文件从源移动到目标,之后您可以编写删除命令。



此外,您可以在特定时间段安排您的包裹。


I have a centralized database named source in which on daily basis lakhs of records get inserted which in result making my web application slow to fetching data from it.

So to reduce the load from database i want to creating a job/Script for it which runs daily at night approx 1:00 AM which copy the source database to destination database on same server and delete all transaction records from source database for the last date.

I am not a good SQL person.. Please guide or suggest..

Many thanks in advance.

What I have tried:

I have checked online! but unable to get the right solution as many are manual operations.

I want a logical solution.

解决方案

There is one option where you need to create one ssis package (Sql Server integration services) using script task that move files from source to destination and after that you can write your delete command.

Further you can schedule your package at certain time period.


这篇关于如何将源数据库复制或移动到目标数据库并通过脚本或创建作业从源数据库中删除所有事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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