简体   繁体   English

任何用于备份 mssql 表的好示例 php 脚本?

[英]Any good example php scripts for backing up mssql table?

I am looking for a good php script that will create a backup of a few tables.我正在寻找一个好的 php 脚本,它将创建几个表的备份。

However the method I want to use is, to create txt files that contain delete, reseed and insert statements to re-insert the backed up data.然而,我想使用的方法是,创建包含删除、重新播种和插入语句的 txt 文件,以重新插入备份数据。

I already have seen how in SSMS, can generate scripts to do the same thing.我已经看到如何在 SSMS 中生成脚本来做同样的事情。

But want an example of one in php.但是想要一个 php 中的例子。

So i can run this as a cron/scheduled task, to create txt files full of sql i can use safely to rollback data...WHich I think is a far easier to manage solution, then the normal sql server backup process.所以我可以将其作为 cron/计划任务运行,创建充满 sql 的 txt 文件,我可以安全地使用它来回滚数据......我认为这是一个更容易管理的解决方案,然后是正常的 sql server 备份过程。

Thank you.谢谢你。

This link has a good solution for dumping the contents of a MSSQL system with PHP. 这个链接有一个很好的解决方案,可以使用PHP转储MSSQL系统的内容。

Good luck! 祝好运!

$disk = "E:\\TestBackup\\Test.bak";
$backupQuery = "USE [dbName]  \n  BACKUP DATABASE [dbName] TO DISK = '$disk' ";
$backupResult = sqlsrv_query($conn,$backupQuery) or die(print_r(sqlsrv_errors()));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM