I have been working with SQL Server in most of my career, many consequences arise when we need to backup a large database, or merge two large database into a single database. The question here is not how it is done? but the question is what is the fastest way to do it?
To backup a whole database:
The slower way: you can use the 'backup database' wizard from SQL-Server
you can use the 'Copy database' wizard
The faster way: you can use the restore wizard, restore it as a new name. It will be done within a minutes for database up to 10GB.
To copy a table with a million rows and hundreds of columns
The slower way: you can select all from the table, copy it to excel and import it.
you can export the table as text and import it to the destination server.
you can use the 'Copy database' wizard
However, the above techniques can take hours to complete.
The fastest way:
use the query: SELECT * INTO DESTINATION_DATABASE_NAME.DES_TABLENAME FROM SOURCE_DATABASENAME.SOURCE_TABLENAME
This query works best for SQL SERVER 2005/2008.
To backup a whole database:
The slower way: you can use the 'backup database' wizard from SQL-Server
you can use the 'Copy database' wizard
The faster way: you can use the restore wizard, restore it as a new name. It will be done within a minutes for database up to 10GB.
To copy a table with a million rows and hundreds of columns
The slower way: you can select all from the table, copy it to excel and import it.
you can export the table as text and import it to the destination server.
you can use the 'Copy database' wizard
However, the above techniques can take hours to complete.
The fastest way:
use the query: SELECT * INTO DESTINATION_DATABASE_NAME.DES_TABLENAME FROM SOURCE_DATABASENAME.SOURCE_TABLENAME
This query works best for SQL SERVER 2005/2008.
No comments:
Post a Comment