Wednesday, March 28, 2012

how do i make a copy of a database on the same server

how do i make a copy the same server, but give the new
copy a different name? I have 8.0.You have many options:
- Backup the old database, create a new database with a different name and
restore into it
- Detach the old database, copy the files to a new location, and attach both
sets of files
- Use DTS to transfer the data
You can look up all of these options in Books Online. The first two options
are probably better than the third.
<anonymous@.discussions.microsoft.com> wrote in message
news:860a01c4321c$fcedc310$a301280a@.phx.gbl...
> how do i make a copy the same server, but give the new
> copy a different name? I have 8.0.|||Hi,
Mention the new name when you do RESTORE.
In Query analyzer :
RESTORE DATABASE <newname>
.....
In enterprise manager, right click on database node| all tasks|restore
database, feed in the new name and point to the backup location.
Make sure to mention the new path for mdf and ldf files.
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
<anonymous@.discussions.microsoft.com> wrote in message
news:860a01c4321c$fcedc310$a301280a@.phx.gbl...
> how do i make a copy the same server, but give the new
> copy a different name? I have 8.0.|||This will run in query analyzer - this example takes a DB called FUNDS and
restores it as FUNDS_COPY.
BACKUP DATABASE Funds
TO DISK = 'c:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_Copy.bak'
RESTORE FILELISTONLY
FROM DISK = 'd:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_Copy.bak'
RESTORE DATABASE Funds_Copy
FROM DISK = 'd:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_Copy.bak'
WITH MOVE 'Funds_data' TO 'd:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_Copy.mdf',
MOVE 'Funds_log' TO 'd:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_Copy.ldf'
GO
<anonymous@.discussions.microsoft.com> wrote in message
news:860a01c4321c$fcedc310$a301280a@.phx.gbl...
> how do i make a copy the same server, but give the new
> copy a different name? I have 8.0.

No comments:

Post a Comment