Automatización de la tarea de exportación de datos

I have a database on one server that I need to copy to another server. I can do this manually using the Export Data task, which is fine for a one time export, but I would like to speed this up as it is going to be repeated.

The database will always contain the same set of tables, I just need to get a copy of this database with it's tables and their data from one server to another.

I'd like to create some sort of reusable tool that allows you to specify the source and target database servers and then copies this specific database from one to another. Is this possible?

preguntado el 08 de noviembre de 11 a las 10:11

1 Respuestas

The Export Data task in SQL 2005 and later uses SQL Server Integration Services (SSIS) under the hood. You can save the package you're already using and run it on a schedule or on demand. You can also edit it (once it is saved) using the Business Intelligence Development Studio (BIDS).

At the end of the Export wizard (on the "Save and Run Package" screen), you can tick the "Save SSIS Package" check-box to store the package either within SQL server or on the file system. The file system is probably simpler.

Once you have the package you can execute it from the command line using the dtexec tool, or from a SQL Agent job using an Execute SSIS tarea.

SSIS is too big a subject to cover in full here - there are decent tutorials within SQL server books online if you need more details - alternatively, as another SO question if you get stuck.

respondido 08 nov., 11:18

I have attempted to do this, saved the SSIS package tot he file system. No matter what security settings I choose when saving this file, when I add it to an SQL Agent job and start the job I get an error: - shaun.breach

Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted. End Error Error: Code: 0xC0011002 Source: Description: Failed to open package file "thefile.dtsx" due to error 0x80070005 "Access is denied.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format. End Error The step failed. - shaun.breach

@shaun.breach - it sounds like the SQL Agent service account doesn't have permissions to access the location where you've saved the file. - check the account the SQL Agent is running under, then try moving the file to a location the agent can definitely access - possibly create a new folder and grant it specific permissions - Ed Harper

I managed to get the SSIS package to run from Integration Services on my machine. Thanks for your help. - shaun.breach

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.