![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Normally a backup or the production database and restore to test works best. In SQL Server 2005 I would do a copy-only backup. Here is the syntax for copy-only full backup: BACKUP DATABASE production_db_name TO <backup_device> . WITH COPY_ONLY . Note that SSMS does not support copy-only backup, you have to run a script. |
#4
| |||
| |||
|
|
On May 16, 2:22 pm, "Plamen Ratchev" <Pla... (AT) SQLStudio (DOT) com> wrote: Normally a backup or the production database and restore to test works best. In SQL Server 2005 I would do a copy-only backup. Here is the syntax for copy-only full backup: BACKUP DATABASE production_db_name TO <backup_device> . WITH COPY_ONLY . Note that SSMS does not support copy-only backup, you have to run a script. Why is it called a copy only backup? |
|
Is there an option for non-admins? |
|
My test database has a different name ( but identical schema ), once copy-only backed up, and restored would my admin just then change the name ( after dropping the old test database? ). |
#5
| |||
| |||
|
|
An alternative option is to use the Copy Database Wizard in SSMS (right click a database, select Tasks, Copy Database...). You can use it to transfer, move, or copy a database from an SQL Server 2000 or SQL Server 2005 instance to an instance of SQL Server 2005. Just make sure to select the SMO method (not detach-and-attach) to keep your source database online. |
|
You can restore over the existing database, that way keeping the name (or drop first the test database and then restore under the same name). Based on your security model, your administrator may need to map the database user and SQL Server login accounts (using the system stored procedure sp_change_users_login). |
#6
| |||
| |||
|
|
Plamen Ratchev (Plamen (AT) SQLStudio (DOT) com) writes: Beware however that the SMO method is very unreliable. I don't know how many bug reports I have submitted for it during the beta programme of SQL 2005 and also after release. They have fixed quite a few bugs, but when I tested what's in SP2, I had reason to file a couple of new bugs, even if they were for less serious issues. There are quite a few features that does not work with the SMO method. If you have a CLR user-defined type, the transfer fails. Certificates are not copied. To name a few. Since Steve had problem recreating the issue from the production database in his test environment, I don't think it is a good idea to use a method that is known to distort the source. BACKUP/RESTORE is definitely the way to go. |
![]() |
| Thread Tools | |
| Display Modes | |
| |