更新时间:2023-02-02 15:33:37
在Microsoft SQL Server Management Studio中,您可以右键单击要备份的数据库,然后单击任务->生成脚本".
In Microsoft SQL Server Management Studio you can right-click on the database you wish to backup and click Tasks -> Generate Scripts.
这会弹出一个向导,您可以在其中设置以下内容以对数据库进行不错的备份,甚至在远程服务器上:
This pops open a wizard where you can set the following in order to perform a decent backup of your database, even on a remote server:
完成操作后,您将准备好一个备份脚本.创建一个新的本地(或远程)数据库,并在脚本中更改第一个"USE"语句以使用您的新数据库.将脚本保存在安全的地方,然后继续对新的空数据库运行该脚本.这将为您创建一个(几乎)重复的本地数据库,然后您可以根据需要进行备份.
Once it's done its thing, you'll have a backup script ready in front of you. Create a new local (or remote) database, and change the first 'USE' statement in the script to use your new database. Save the script in a safe place, and go ahead and run it against your new empty database. This should create you a (nearly) duplicate local database you can then backup as you like.
如果您具有对远程数据库的完整访问权限,则可以选择在向导的第一个窗口中检查脚本所有对象",然后在下一个窗口中将脚本数据库"选项更改为True. .请注意,您需要执行完整的搜索和&将脚本中的数据库名称替换为新数据库,在这种情况下,您无需在运行脚本之前创建数据库.这样可以创建更准确的副本,但由于权限限制,有时无法使用.
If you have full access to the remote database, you can choose to check 'script all objects' in the wizard's first window and then change the 'Script Database' option to True on the next window. Watch out though, you'll need to perform a full search & replace of the database name in the script to a new database which in this case you won't have to create before running the script. This should create a more accurate duplicate but is sometimes not available due to permissions restrictions.