Backup of some DBs via script

  • Hi

    I'm searching for a HW migration a script to backup a list of Databases (120 of 400 DB's) that I need to migrate to a new environment.

    Can anyone help?

    Thanks and Kind Regards

    angelspawn

  • anything distinctive about the databases that would allow you to select their names out from master.sys.databases?

    ---------------------------------------------------------------------

  • Hi,

    I can create an excel sheet with the DB names but how should I create the script to read the dbname from the file?

    Regards

    angelspawn

  • use the import wizard to read the file into a database table, then loop through that table backing up the databases.

    ---------------------------------------------------------------------

  • You could create a table with the list of distinct database names and then run a query against that to provide a list of files for the backup. That's the easiest way. Another way, make it a text file and then use PowerShell to open the list and run backup commands on the databases from there. You have options. You could use either a table or a file in combination with SSIS to run the backups. Getting the list is the hard part, consuming it easy.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply