Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Copy SQL Server 2012 database with SMSS

$
0
0
I want to copy a database within the same SQL Server 2012 Developer instance (e.g. from database1 to database1_new). Here are the steps I followed in SMSS
* Right click on database > Tasks > Copy database
* Click next twice as I am copying within the same instance (localhost)

* In the "Select the Transfer method" screen, leave "use the detach and attach method" option checked

It gave me an error (see below). I can manually detach the database, create a copy within Windows, and re-attach both databases. However, I can't do the same thing with the GUI. It's a small annoyance, but it would be good if I could do it with the GUI as I regularly create copies of a database to test out different scenarios.

It appears to be a permissions issue. I am using Windows 7. Perhaps the account that SQL Server Agent is using does not have administrative privileges?

Here's the result I got ------->

Action "Execute SQL Server Agent Job" shows Status as "Error".
Performing operation
- Add log for package (Success)
- Add task for transferring database objects (Success)
- Create package (Success)
- Start SQL Server Agent Job (Success)

- Execute SQL Server Agent Job (Error)

In the Event data ------>

Event iD 12550:

 OnError 
   NT Service\SQLSERVERAGENT 
   localhost_localhost_Transfer Objects Task 
....
   Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\database1_new.mdf' is denied. StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost) at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.CopyFile(String sourceFileName, String destinationFileName, Boolean overwriteOnExist) 

Object reference not set to an instance of an object. StackTrace: at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSpAttachDetach()

Reattaching the database database1 to source since error has occurred


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>