Showing posts with label wizard. Show all posts
Showing posts with label wizard. Show all posts

Tuesday, March 27, 2012

Copying Views

Is there an easy way to copy all views from one database to another? Using
the import/export wizard tries to copy the data in a View to a Table in the
destination table. I don't want to create new tables just copy the view
object over (the databases are equivalent, one production, one for testing).
I use Views for pre-defined queries often used in the production
applications to give the end-user views of the data that makes more sense.
Am I using Views wrong?
By the way I have found a work around by right clicking on the view and go
to Script As -> CREATE TO -> New Query. Then change the first line from:
USE [SourceDatabaseName]
to
USE [DestinationDatabaseName]
This process is unyieldy though because I have to repeat the multi-step
process for every view I want to copy.
Thanks,
RyanRyan
You can use SQLDMO object library to script out all views and then run it on
destination server
Sub ScriptDB(strLogin As String, strPwd As String, _
strDataBase As String, StrFilePath As String)
Dim sql As Object
Dim db As Object
Dim objTrigger As Object
Dim intOptions As Long
Dim genObj
Set sql = CreateObject("SQLDMO.SQLServer")
Set db = CreateObject("SQLDMO.Database")
Set objTrigger = CreateObject("SQLDMO.Trigger")
Const sDrops As Integer = 1
Const sIncludeHeaders As Long = 131072
Const sDefault As Integer = 4
Const sAppendToFile As Integer = 256
Const sBindings As Integer = 128
Const SQLDMOScript2_NoCollation As Long = 8388608
' Set scripting options. Because you need to specify multiple behaviors
' for the ScriptType argument, you use "Or" to combine these.
intOptions = sDrops Or sIncludeHeaders Or _
sDefault Or sAppendToFile Or sBindings Or SQLDMOScript2_NoCollation
' Connect to local server
sql.Connect "(local)", strLogin, strPwd
Set db = sql.Databases(strDataBase, "dbo")
' Script Views, ignoring system views and informational schemas
For Each genObj In db.Views
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
MsgBox "Finished generating SQL scripts."
End Sub
--usage
Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
"Ryan" <Tyveil@.newsgroups.nospam> wrote in message
news:uulTfxXOHHA.4100@.TK2MSFTNGP04.phx.gbl...
> Is there an easy way to copy all views from one database to another?
> Using the import/export wizard tries to copy the data in a View to a Table
> in the destination table. I don't want to create new tables just copy the
> view object over (the databases are equivalent, one production, one for
> testing). I use Views for pre-defined queries often used in the production
> applications to give the end-user views of the data that makes more sense.
> Am I using Views wrong?
> By the way I have found a work around by right clicking on the view and go
> to Script As -> CREATE TO -> New Query. Then change the first line from:
> USE [SourceDatabaseName]
> to
> USE [DestinationDatabaseName]
> This process is unyieldy though because I have to repeat the multi-step
> process for every view I want to copy.
> Thanks,
> Ryan
>|||Ryan wrote:
> Is there an easy way to copy all views from one database to another? Usin
g
> the import/export wizard tries to copy the data in a View to a Table in th
e
> destination table. I don't want to create new tables just copy the view
> object over (the databases are equivalent, one production, one for testing
).
> I use Views for pre-defined queries often used in the production
> applications to give the end-user views of the data that makes more sense.
> Am I using Views wrong?
> By the way I have found a work around by right clicking on the view and go
> to Script As -> CREATE TO -> New Query. Then change the first line from:
> USE [SourceDatabaseName]
> to
> USE [DestinationDatabaseName]
> This process is unyieldy though because I have to repeat the multi-step
> process for every view I want to copy.
> Thanks,
> Ryan
>
I wouldn't say you're "using" them wrong, I'd say you're "creating" them
wrong. The scripting method that you discovered is not a workaround,
it's the accepted method of working with database objects. You should
be creating your views with a script, and archiving that script in a
version control system, like Visual SourceSafe or Perforce. This allows
you to track the revision history of your objects, gives you a
"rollback" method for undo-ing changes, AND it makes your objects more
portable. To "copy" and object to a new location, you simply run the
CREATE script again, in the new location.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks!
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23zxv31XOHHA.2468@.TK2MSFTNGP06.phx.gbl...
> Ryan
> You can use SQLDMO object library to script out all views and then run it
> on destination server
>
> Sub ScriptDB(strLogin As String, strPwd As String, _
> strDataBase As String, StrFilePath As String)
> Dim sql As Object
> Dim db As Object
> Dim objTrigger As Object
> Dim intOptions As Long
> Dim genObj
> Set sql = CreateObject("SQLDMO.SQLServer")
> Set db = CreateObject("SQLDMO.Database")
> Set objTrigger = CreateObject("SQLDMO.Trigger")
> Const sDrops As Integer = 1
> Const sIncludeHeaders As Long = 131072
> Const sDefault As Integer = 4
> Const sAppendToFile As Integer = 256
> Const sBindings As Integer = 128
> Const SQLDMOScript2_NoCollation As Long = 8388608
> ' Set scripting options. Because you need to specify multiple behaviors
> ' for the ScriptType argument, you use "Or" to combine these.
> intOptions = sDrops Or sIncludeHeaders Or _
> sDefault Or sAppendToFile Or sBindings Or SQLDMOScript2_NoCollation
> ' Connect to local server
> sql.Connect "(local)", strLogin, strPwd
> Set db = sql.Databases(strDataBase, "dbo")
>
> ' Script Views, ignoring system views and informational schemas
> For Each genObj In db.Views
> If genObj.SystemObject = False Then
> genObj.Script intOptions, StrFilePath
> End If
> Next
> MsgBox "Finished generating SQL scripts."
> End Sub
> --usage
> Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
>
> "Ryan" <Tyveil@.newsgroups.nospam> wrote in message
> news:uulTfxXOHHA.4100@.TK2MSFTNGP04.phx.gbl...
>|||Sure, that makes sense. The thing is this isn't a usual process. I am
needing to create a non-production (test) database off of the production
database so I thought there would be a way to simply copy the entire
database (including objects such as views, stored procedures, etc) in one
fell swoop. I guess another option would be to detach the production
database and make a copy of the db files before reattaching it. The only
downside to this is downtime on the production side. Thanks for the info.
Ryan
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45ACE89E.2020400@.realsqlguy.com...
> Ryan wrote:
> I wouldn't say you're "using" them wrong, I'd say you're "creating" them
> wrong. The scripting method that you discovered is not a workaround, it's
> the accepted method of working with database objects. You should be
> creating your views with a script, and archiving that script in a version
> control system, like Visual SourceSafe or Perforce. This allows you to
> track the revision history of your objects, gives you a "rollback" method
> for undo-ing changes, AND it makes your objects more portable. To "copy"
> and object to a new location, you simply run the CREATE script again, in
> the new location.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Ryan wrote:
> Sure, that makes sense. The thing is this isn't a usual process. I am
> needing to create a non-production (test) database off of the production
> database so I thought there would be a way to simply copy the entire
> database (including objects such as views, stored procedures, etc) in one
> fell swoop. I guess another option would be to detach the production
> database and make a copy of the db files before reattaching it. The only
> downside to this is downtime on the production side. Thanks for the info.
>
Why not just do a backup of the production DB, and restore that onto
your Dev server?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Because the database structure doesn't exist on the Dev server. To do a
restore doesn't the database structure have to already exist? At least I
couldn't find a way to do it otherwise. I just did a detach, copy file,
reattach to both the dev and production server. This seems to be the
easiest solution.
Ryan
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45AD3AEC.3080907@.realsqlguy.com...
> Ryan wrote:
> Why not just do a backup of the production DB, and restore that onto your
> Dev server?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Ryan wrote:
> Because the database structure doesn't exist on the Dev server. To do a
> restore doesn't the database structure have to already exist? At least I
> couldn't find a way to do it otherwise. I just did a detach, copy file,
> reattach to both the dev and production server. This seems to be the
> easiest solution.
>
Nope, definately not true. You can restore a backup, give it a new
database name, and it will create the database "on the fly".
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Ah.. ok thanks for the info. I will definitely use this for future
solutions.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45AE2D47.8030504@.realsqlguy.com...
> Ryan wrote:
> Nope, definately not true. You can restore a backup, give it a new
> database name, and it will create the database "on the fly".
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Sunday, March 25, 2012

Copying Views

Is there an easy way to copy all views from one database to another? Using
the import/export wizard tries to copy the data in a View to a Table in the
destination table. I don't want to create new tables just copy the view
object over (the databases are equivalent, one production, one for testing).
I use Views for pre-defined queries often used in the production
applications to give the end-user views of the data that makes more sense.
Am I using Views wrong?
By the way I have found a work around by right clicking on the view and go
to Script As -> CREATE TO -> New Query. Then change the first line from:
USE [SourceDatabaseName]
to
USE [DestinationDatabaseName]
This process is unyieldy though because I have to repeat the multi-step
process for every view I want to copy.
Thanks,
RyanRyan
You can use SQLDMO object library to script out all views and then run it on
destination server
Sub ScriptDB(strLogin As String, strPwd As String, _
strDataBase As String, StrFilePath As String)
Dim sql As Object
Dim db As Object
Dim objTrigger As Object
Dim intOptions As Long
Dim genObj
Set sql = CreateObject("SQLDMO.SQLServer")
Set db = CreateObject("SQLDMO.Database")
Set objTrigger = CreateObject("SQLDMO.Trigger")
Const sDrops As Integer = 1
Const sIncludeHeaders As Long = 131072
Const sDefault As Integer = 4
Const sAppendToFile As Integer = 256
Const sBindings As Integer = 128
Const SQLDMOScript2_NoCollation As Long = 8388608
' Set scripting options. Because you need to specify multiple behaviors
' for the ScriptType argument, you use "Or" to combine these.
intOptions = sDrops Or sIncludeHeaders Or _
sDefault Or sAppendToFile Or sBindings Or SQLDMOScript2_NoCollation
' Connect to local server
sql.Connect "(local)", strLogin, strPwd
Set db = sql.Databases(strDataBase, "dbo")
' Script Views, ignoring system views and informational schemas
For Each genObj In db.Views
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
MsgBox "Finished generating SQL scripts."
End Sub
--usage
Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
"Ryan" <Tyveil@.newsgroups.nospam> wrote in message
news:uulTfxXOHHA.4100@.TK2MSFTNGP04.phx.gbl...
> Is there an easy way to copy all views from one database to another?
> Using the import/export wizard tries to copy the data in a View to a Table
> in the destination table. I don't want to create new tables just copy the
> view object over (the databases are equivalent, one production, one for
> testing). I use Views for pre-defined queries often used in the production
> applications to give the end-user views of the data that makes more sense.
> Am I using Views wrong?
> By the way I have found a work around by right clicking on the view and go
> to Script As -> CREATE TO -> New Query. Then change the first line from:
> USE [SourceDatabaseName]
> to
> USE [DestinationDatabaseName]
> This process is unyieldy though because I have to repeat the multi-step
> process for every view I want to copy.
> Thanks,
> Ryan
>|||Ryan wrote:
> Is there an easy way to copy all views from one database to another? Using
> the import/export wizard tries to copy the data in a View to a Table in the
> destination table. I don't want to create new tables just copy the view
> object over (the databases are equivalent, one production, one for testing).
> I use Views for pre-defined queries often used in the production
> applications to give the end-user views of the data that makes more sense.
> Am I using Views wrong?
> By the way I have found a work around by right clicking on the view and go
> to Script As -> CREATE TO -> New Query. Then change the first line from:
> USE [SourceDatabaseName]
> to
> USE [DestinationDatabaseName]
> This process is unyieldy though because I have to repeat the multi-step
> process for every view I want to copy.
> Thanks,
> Ryan
>
I wouldn't say you're "using" them wrong, I'd say you're "creating" them
wrong. The scripting method that you discovered is not a workaround,
it's the accepted method of working with database objects. You should
be creating your views with a script, and archiving that script in a
version control system, like Visual SourceSafe or Perforce. This allows
you to track the revision history of your objects, gives you a
"rollback" method for undo-ing changes, AND it makes your objects more
portable. To "copy" and object to a new location, you simply run the
CREATE script again, in the new location.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks!
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23zxv31XOHHA.2468@.TK2MSFTNGP06.phx.gbl...
> Ryan
> You can use SQLDMO object library to script out all views and then run it
> on destination server
>
> Sub ScriptDB(strLogin As String, strPwd As String, _
> strDataBase As String, StrFilePath As String)
> Dim sql As Object
> Dim db As Object
> Dim objTrigger As Object
> Dim intOptions As Long
> Dim genObj
> Set sql = CreateObject("SQLDMO.SQLServer")
> Set db = CreateObject("SQLDMO.Database")
> Set objTrigger = CreateObject("SQLDMO.Trigger")
> Const sDrops As Integer = 1
> Const sIncludeHeaders As Long = 131072
> Const sDefault As Integer = 4
> Const sAppendToFile As Integer = 256
> Const sBindings As Integer = 128
> Const SQLDMOScript2_NoCollation As Long = 8388608
> ' Set scripting options. Because you need to specify multiple behaviors
> ' for the ScriptType argument, you use "Or" to combine these.
> intOptions = sDrops Or sIncludeHeaders Or _
> sDefault Or sAppendToFile Or sBindings Or SQLDMOScript2_NoCollation
> ' Connect to local server
> sql.Connect "(local)", strLogin, strPwd
> Set db = sql.Databases(strDataBase, "dbo")
>
> ' Script Views, ignoring system views and informational schemas
> For Each genObj In db.Views
> If genObj.SystemObject = False Then
> genObj.Script intOptions, StrFilePath
> End If
> Next
> MsgBox "Finished generating SQL scripts."
> End Sub
> --usage
> Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
>
> "Ryan" <Tyveil@.newsgroups.nospam> wrote in message
> news:uulTfxXOHHA.4100@.TK2MSFTNGP04.phx.gbl...
>> Is there an easy way to copy all views from one database to another?
>> Using the import/export wizard tries to copy the data in a View to a
>> Table in the destination table. I don't want to create new tables just
>> copy the view object over (the databases are equivalent, one production,
>> one for testing). I use Views for pre-defined queries often used in the
>> production applications to give the end-user views of the data that makes
>> more sense. Am I using Views wrong?
>> By the way I have found a work around by right clicking on the view and
>> go to Script As -> CREATE TO -> New Query. Then change the first line
>> from:
>> USE [SourceDatabaseName]
>> to
>> USE [DestinationDatabaseName]
>> This process is unyieldy though because I have to repeat the multi-step
>> process for every view I want to copy.
>> Thanks,
>> Ryan
>|||Sure, that makes sense. The thing is this isn't a usual process. I am
needing to create a non-production (test) database off of the production
database so I thought there would be a way to simply copy the entire
database (including objects such as views, stored procedures, etc) in one
fell swoop. I guess another option would be to detach the production
database and make a copy of the db files before reattaching it. The only
downside to this is downtime on the production side. Thanks for the info.
Ryan
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45ACE89E.2020400@.realsqlguy.com...
> Ryan wrote:
>> Is there an easy way to copy all views from one database to another?
>> Using the import/export wizard tries to copy the data in a View to a
>> Table in the destination table. I don't want to create new tables just
>> copy the view object over (the databases are equivalent, one production,
>> one for testing). I use Views for pre-defined queries often used in the
>> production applications to give the end-user views of the data that makes
>> more sense. Am I using Views wrong?
>> By the way I have found a work around by right clicking on the view and
>> go to Script As -> CREATE TO -> New Query. Then change the first line
>> from:
>> USE [SourceDatabaseName]
>> to
>> USE [DestinationDatabaseName]
>> This process is unyieldy though because I have to repeat the multi-step
>> process for every view I want to copy.
>> Thanks,
>> Ryan
> I wouldn't say you're "using" them wrong, I'd say you're "creating" them
> wrong. The scripting method that you discovered is not a workaround, it's
> the accepted method of working with database objects. You should be
> creating your views with a script, and archiving that script in a version
> control system, like Visual SourceSafe or Perforce. This allows you to
> track the revision history of your objects, gives you a "rollback" method
> for undo-ing changes, AND it makes your objects more portable. To "copy"
> and object to a new location, you simply run the CREATE script again, in
> the new location.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Ryan wrote:
> Sure, that makes sense. The thing is this isn't a usual process. I am
> needing to create a non-production (test) database off of the production
> database so I thought there would be a way to simply copy the entire
> database (including objects such as views, stored procedures, etc) in one
> fell swoop. I guess another option would be to detach the production
> database and make a copy of the db files before reattaching it. The only
> downside to this is downtime on the production side. Thanks for the info.
>
Why not just do a backup of the production DB, and restore that onto
your Dev server?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Because the database structure doesn't exist on the Dev server. To do a
restore doesn't the database structure have to already exist? At least I
couldn't find a way to do it otherwise. I just did a detach, copy file,
reattach to both the dev and production server. This seems to be the
easiest solution.
Ryan
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45AD3AEC.3080907@.realsqlguy.com...
> Ryan wrote:
>> Sure, that makes sense. The thing is this isn't a usual process. I am
>> needing to create a non-production (test) database off of the production
>> database so I thought there would be a way to simply copy the entire
>> database (including objects such as views, stored procedures, etc) in one
>> fell swoop. I guess another option would be to detach the production
>> database and make a copy of the db files before reattaching it. The only
>> downside to this is downtime on the production side. Thanks for the
>> info.
> Why not just do a backup of the production DB, and restore that onto your
> Dev server?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Ryan wrote:
> Because the database structure doesn't exist on the Dev server. To do a
> restore doesn't the database structure have to already exist? At least I
> couldn't find a way to do it otherwise. I just did a detach, copy file,
> reattach to both the dev and production server. This seems to be the
> easiest solution.
>
Nope, definately not true. You can restore a backup, give it a new
database name, and it will create the database "on the fly".
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Ah.. ok thanks for the info. I will definitely use this for future
solutions.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45AE2D47.8030504@.realsqlguy.com...
> Ryan wrote:
>> Because the database structure doesn't exist on the Dev server. To do a
>> restore doesn't the database structure have to already exist? At least I
>> couldn't find a way to do it otherwise. I just did a detach, copy file,
>> reattach to both the dev and production server. This seems to be the
>> easiest solution.
> Nope, definately not true. You can restore a backup, give it a new
> database name, and it will create the database "on the fly".
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Monday, March 19, 2012

copying DBs w/out Copy Wizard

Is it a bad thing to do a manual copy of all my databases
from one server to another in Win Exp? Will it hurt
anything? I detached the DB, copied it over, and then
reattached on the new server. ?Detach/attach is the way the copy database wizard does it as well, so that
is fine.
The other option is to do a backup, copy the backup and then do a restore on
the new server.
--
Jacco Schalkwijk
SQL Server MVP
"kb" <anonymous@.discussions.microsoft.com> wrote in message
news:001b01c393f8$661599d0$a301280a@.phx.gbl...
> Is it a bad thing to do a manual copy of all my databases
> from one server to another in Win Exp? Will it hurt
> anything? I detached the DB, copied it over, and then
> reattached on the new server. ?|||If you're concerned run DBCC CHECKDB after you have successfully attached
the db. If the file is very large > 40Gb I generally use robocopy
--
HTH
Ryan Waight, MCDBA, MCSE
"kb" <anonymous@.discussions.microsoft.com> wrote in message
news:001b01c393f8$661599d0$a301280a@.phx.gbl...
> Is it a bad thing to do a manual copy of all my databases
> from one server to another in Win Exp? Will it hurt
> anything? I detached the DB, copied it over, and then
> reattached on the new server. ?|||See if these help:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
http://www.support.microsoft.com/?id=307775 Disaster Recovery Articles
for SQL Server
http://www.support.microsoft.com/?id=274463 Copy DB
Wizard issues
Andrew J. Kelly
SQL Server MVP
"kb" <anonymous@.discussions.microsoft.com> wrote in message
news:001b01c393f8$661599d0$a301280a@.phx.gbl...
> Is it a bad thing to do a manual copy of all my databases
> from one server to another in Win Exp? Will it hurt
> anything? I detached the DB, copied it over, and then
> reattached on the new server. ?

Copying DB in SQL 2005

I used the Copy Database Wizard in SQL 2005 and I selected SQL Management
Object method to copy one DB onto a new one on the same server, it looks like
it worked but the Identity Seed and Identity increment properties are missing
on some of the columns on the new DB. Has anyone else experienced this
behavior?
Same here... It also occurs with the Transfer Object task in SSIS, the
Identity attribute is dropped from tables. Currently I am using Dump/Restore
to copy DBs. My preference is to use Transfer Object to transfer only tables
between DBs, but the droppped Identity prevents that solution.
"Garios" wrote:

> I used the Copy Database Wizard in SQL 2005 and I selected SQL Management
> Object method to copy one DB onto a new one on the same server, it looks like
> it worked but the Identity Seed and Identity increment properties are missing
> on some of the columns on the new DB. Has anyone else experienced this
> behavior?

Copying DB in SQL 2005

I used the Copy Database Wizard in SQL 2005 and I selected SQL Management
Object method to copy one DB onto a new one on the same server, it looks like
it worked but the Identity Seed and Identity increment properties are missing
on some of the columns on the new DB. Has anyone else experienced this
behavior?Same here... It also occurs with the Transfer Object task in SSIS, the
Identity attribute is dropped from tables. Currently I am using Dump/Restore
to copy DBs. My preference is to use Transfer Object to transfer only tables
between DBs, but the droppped Identity prevents that solution.
"Garios" wrote:
> I used the Copy Database Wizard in SQL 2005 and I selected SQL Management
> Object method to copy one DB onto a new one on the same server, it looks like
> it worked but the Identity Seed and Identity increment properties are missing
> on some of the columns on the new DB. Has anyone else experienced this
> behavior?

Copying DB in SQL 2005

I used the Copy Database Wizard in SQL 2005 and I selected SQL Management
Object method to copy one DB onto a new one on the same server, it looks lik
e
it worked but the Identity Seed and Identity increment properties are missin
g
on some of the columns on the new DB. Has anyone else experienced this
behavior?Same here... It also occurs with the Transfer Object task in SSIS, the
Identity attribute is dropped from tables. Currently I am using Dump/Restor
e
to copy DBs. My preference is to use Transfer Object to transfer only table
s
between DBs, but the droppped Identity prevents that solution.
"Garios" wrote:

> I used the Copy Database Wizard in SQL 2005 and I selected SQL Management
> Object method to copy one DB onto a new one on the same server, it looks l
ike
> it worked but the Identity Seed and Identity increment properties are miss
ing
> on some of the columns on the new DB. Has anyone else experienced this
> behavior?

Sunday, March 11, 2012

Copying Database without data

Hi,
Does anyone know, with either the Apr or Jun CTP, how to copy an entire database without the data? I know to use the SSIS wizard to copy tables with data, but there seem to be no option to not copy the data.

Thanks.In the June CTP you can use the Transfer Objects Task. It has an option for transferring data that you may set to false.|||BTW, There are some issues with this task in the June CTP that have recently been fixed and will not be available until the next CTP. This solution will probably not work for you until you can get the version with the fixes.Sad|||Hi Kirk,
Thanks for the update. I was actually hoping for a checkbox option inside the SSIS Import and Export wizard. :) I'll wait till it is fixed then.|||

you can

1. left click source database ->Script database ->create to

1.1. change database and filenames on the script created

1.2 execute script to create new database

2. left click source database -> tasks -> generate scripts

2.1 add at the to the following lines

use newdatabasename

go

2.2. run the script

you can save the scripts and use them at SSIS for automation

Copying Database without data

Hi,
Does anyone know, with either the Apr or Jun CTP, how to copy an entire database without the data? I know to use the SSIS wizard to copy tables with data, but there seem to be no option to not copy the data.

Thanks.In the June CTP you can use the Transfer Objects Task. It has an option for transferring data that you may set to false.|||BTW, There are some issues with this task in the June CTP that have recently been fixed and will not be available until the next CTP. This solution will probably not work for you until you can get the version with the fixes.Sad|||Hi Kirk,
Thanks for the update. I was actually hoping for a checkbox option inside the SSIS Import and Export wizard. :) I'll wait till it is fixed then.|||

you can

1. left click source database ->Script database ->create to

1.1. change database and filenames on the script created

1.2 execute script to create new database

2. left click source database -> tasks -> generate scripts

2.1 add at the to the following lines

use newdatabasename

go

2.2. run the script

you can save the scripts and use them at SSIS for automation

Copying database using "Copy Database" - still failing after SP2

I am struggling with the "Copy Database Wizard" in SQL Server 2005. I am used to working with DTS to copy data from one server to another, but with the new tools, I am having serious problems (in fact, it's unusable)

1. When copying a database using the "SQL Management Object" method, I always get errors concerning logins. If I select not to copy logins, I get errors "sp_grantdbaccess failed". If I do select to copy logins, the logins can't be created because the machine names are different (one the source machine, the login is called MACHINE1/mylogin, but on the destination machine, such a login cannot be created)

2. For small databases, I ALWAYS get the error "CREATE DATABASE failed. Primary file must be at least 3 MB to accommodate a copy of the model database". There is no way to specify a larger size for the database in the wizard.

Note: copying databases using detach/attach is not an option (the servers cannot see eachother's shares)

I must say that in general I hate the new management tools. Enterprise Manager had its flaws too, but the quality of the "SQL Server Management Studio" seems very low IMHO.

Regards,
Philippe Leybaert

I can get the copy to work but it will not copy any of my stored procedures or functions.|||did you ever get a resolution on this. I am having the same issue.|||Yeah - this sucks. Has anyone seen where SP's can be copied? Sure we can script them and run in teh new DB - but it's a pain in the butt, especially if you can see shared drivespace.|||

Blake05 wrote:

I can get the copy to work but it will not copy any of my stored procedures or functions.

This is actually very simple, but the error messages are of no help. The problem is that there is a bug in at least one stored procedure or function. Go through them all until you find the ones that you can't save/update, and repair or delete (if obsolete) them. Once they are all functioning, the copy will work without a hitch.

|||I notice that no one from Microsoft has answered this problem.

It seems to me the Copy Database Wizard is completely ignoring the fact that I am always trying to deselect the logins. It just happily tries to copy them even though it's going to a development machine that will only see 4 of the 100 logins on the production server.

I struggled with this problem for days and was crossing my fingers that it would be solved in SP1, sadly it's not.

Detaching is not an option for production databases!!!

Fix this Microsoft!!!|||

We are aware of many issues in the Copy Database Wizard. We're doing a lot of work on the wizard in SP2 to address these.

If you have a specific scenario you would like to see addressed, please file a defect report here: http://lab.msdn.microsoft.com/productfeedback/Default.aspx. Defects reports entered at the feedback center are used to prioritize work for future versions and service packs.

Thanks,
Steve

|||

Hi Philippe,

You can now install the latest version of the Copy Database Wizard from the following location:

http://www.microsoft.com/sql/ctp.mspx

This CTP version includes many improvements and hopefully they should address most of your current issues.

Thanks,
Oscar.

|||

Hello Oscar

I have a problem with Copy Database Wizard to.

Have agent account as sysadmin in both source and target database

Target server has CTP Dec 2006 installed. Bat I can’t install it to the source “production” system

Managed to transfer five databases fixing the error found at the error log file

At the sixth database I have an error that I can not understand

The error appears when trying to create a view at the target system.

errorCode=-1073548784 description=Executing the query "create view [dbo].[VShift_Cost]

as

select sf.ShiftID, SFD.UnitID, sum(sfd.charge) as Shift_Charge

from shiftcostdetail sfd inner join shiftcost sf on sfd.shiftcostid = sf.shiftcostid

group by sf.shiftid, SFD.unitID

" failed with the following error: "Invalid object name 'shiftcostdetail'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The shiftcostdetail is an existing table and the view works fine at the source system.

Can you help?

Thanks

|||

Hi Panzin,

Could you please tell me where are you launching CDW from? You should launch CDW from the target machine is this machine is the one that has the latest version installed. From here, you can select the source the database and perform the copy. Could you please confirm that this is what you are doing? You could also select the "Save Transfer Logs" option before clicking "Finish" and send me the corresponding TransferDump*.sql files generated in :

C:\Documents and Settings\<user-name>\Local Settings\Application Data\Microsoft\SQL Server\Smo

It would be useful too to select "Write log to a file" before performing the copy and check for any other errors.

I will investigate the error that you described above, but it seems that it could be a dependency issue. I will get back to you once I find more information.

Thanks,
Oscar.

|||

Hi Oscar

Thank you for your reply

The CDW is running from the target system.

The target system is the one with the CTP installed

The posted error is from the log file

I can't find the "Save Transfer Logs" option

Thank's again

|||

Hi Panzin,

Are you using the SMO Transfer method to copy the database or Detach/Attach? I believe you are using the SMO Transfer method...

The "Save transfer logs?" checkbox is in the "Configure the Package" page of the wizard.

By the way, are you also copying any extra objects apart from the database? If so, which ones? Are you referencing any objects that are outside this view that might require the selection of some particular extra objects?

Cheers,
Oscar.

|||

Hello Oscar

Thank you for your help

I'm using the SMO transfer method and the related objects that i'm copying are the "logins"

At the configure the Pacage page I'm using

Logging options "Text File" and the posted error is from the text file ...

also show that

1. db created at target server is at compatibility level 90 (source level=80)

2. when I changed the view script and add "dbo." in front of table names the error move to next view creation.

!!! this does not work for all views

Cheers

Nick

|||

Hi Nick,

I would really need to see the full log files (i.e. TransferDump*.sql and SMO Tranfer log) in order to be able to help more. You could send them directly to me at oscar.naim@.microsoft.com.

By the way, are you defining extended properties for this particular database?

Thanks,
Oscar.

|||

Hello oscar

I do not have any extended properties at my database.

I realy can;t find any files named TransferDump*.* in my disk

I found a directory SMO but it is empty

the directory is created under the SQLAgent acount documents and settings...

I monitor the directory as the CDW is executed and a file was created

but when the execution stops with or with out an error the file is deleted

so I can;t postit to you

Thank you

Copying database using "Copy Database"

I am struggling with the "Copy Database Wizard" in SQL Server 2005. I am used to working with DTS to copy data from one server to another, but with the new tools, I am having serious problems (in fact, it's unusable)

1. When copying a database using the "SQL Management Object" method, I always get errors concerning logins. If I select not to copy logins, I get errors "sp_grantdbaccess failed". If I do select to copy logins, the logins can't be created because the machine names are different (one the source machine, the login is called MACHINE1/mylogin, but on the destination machine, such a login cannot be created)

2. For small databases, I ALWAYS get the error "CREATE DATABASE failed. Primary file must be at least 3 MB to accommodate a copy of the model database". There is no way to specify a larger size for the database in the wizard.

Note: copying databases using detach/attach is not an option (the servers cannot see eachother's shares)

I must say that in general I hate the new management tools. Enterprise Manager had its flaws too, but the quality of the "SQL Server Management Studio" seems very low IMHO.

Regards,
Philippe Leybaert

I can get the copy to work but it will not copy any of my stored procedures or functions.|||did you ever get a resolution on this. I am having the same issue.|||Yeah - this sucks. Has anyone seen where SP's can be copied? Sure we can script them and run in teh new DB - but it's a pain in the butt, especially if you can see shared drivespace.|||

Blake05 wrote:

I can get the copy to work but it will not copy any of my stored procedures or functions.

This is actually very simple, but the error messages are of no help. The problem is that there is a bug in at least one stored procedure or function. Go through them all until you find the ones that you can't save/update, and repair or delete (if obsolete) them. Once they are all functioning, the copy will work without a hitch.

|||I notice that no one from Microsoft has answered this problem.

It seems to me the Copy Database Wizard is completely ignoring the fact that I am always trying to deselect the logins. It just happily tries to copy them even though it's going to a development machine that will only see 4 of the 100 logins on the production server.

I struggled with this problem for days and was crossing my fingers that it would be solved in SP1, sadly it's not.

Detaching is not an option for production databases!!!

Fix this Microsoft!!!|||

We are aware of many issues in the Copy Database Wizard. We're doing a lot of work on the wizard in SP2 to address these.

If you have a specific scenario you would like to see addressed, please file a defect report here: http://lab.msdn.microsoft.com/productfeedback/Default.aspx. Defects reports entered at the feedback center are used to prioritize work for future versions and service packs.

Thanks,
Steve

|||

Hi Philippe,

You can now install the latest version of the Copy Database Wizard from the following location:

http://www.microsoft.com/sql/ctp.mspx

This CTP version includes many improvements and hopefully they should address most of your current issues.

Thanks,
Oscar.

|||

Hello Oscar

I have a problem with Copy Database Wizard to.

Have agent account as sysadmin in both source and target database

Target server has CTP Dec 2006 installed. Bat I can’t install it to the source “production” system

Managed to transfer five databases fixing the error found at the error log file

At the sixth database I have an error that I can not understand

The error appears when trying to create a view at the target system.

errorCode=-1073548784 description=Executing the query "create view [dbo].[VShift_Cost]

as

select sf.ShiftID, SFD.UnitID, sum(sfd.charge) as Shift_Charge

from shiftcostdetail sfd inner join shiftcost sf on sfd.shiftcostid = sf.shiftcostid

group by sf.shiftid, SFD.unitID

" failed with the following error: "Invalid object name 'shiftcostdetail'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The shiftcostdetail is an existing table and the view works fine at the source system.

Can you help?

Thanks

|||

Hi Panzin,

Could you please tell me where are you launching CDW from? You should launch CDW from the target machine is this machine is the one that has the latest version installed. From here, you can select the source the database and perform the copy. Could you please confirm that this is what you are doing? You could also select the "Save Transfer Logs" option before clicking "Finish" and send me the corresponding TransferDump*.sql files generated in :

C:\Documents and Settings\<user-name>\Local Settings\Application Data\Microsoft\SQL Server\Smo

It would be useful too to select "Write log to a file" before performing the copy and check for any other errors.

I will investigate the error that you described above, but it seems that it could be a dependency issue. I will get back to you once I find more information.

Thanks,
Oscar.

|||

Hi Oscar

Thank you for your reply

The CDW is running from the target system.

The target system is the one with the CTP installed

The posted error is from the log file

I can't find the "Save Transfer Logs" option

Thank's again

|||

Hi Panzin,

Are you using the SMO Transfer method to copy the database or Detach/Attach? I believe you are using the SMO Transfer method...

The "Save transfer logs?" checkbox is in the "Configure the Package" page of the wizard.

By the way, are you also copying any extra objects apart from the database? If so, which ones? Are you referencing any objects that are outside this view that might require the selection of some particular extra objects?

Cheers,
Oscar.

|||

Hello Oscar

Thank you for your help

I'm using the SMO transfer method and the related objects that i'm copying are the "logins"

At the configure the Pacage page I'm using

Logging options "Text File" and the posted error is from the text file ...

also show that

1. db created at target server is at compatibility level 90 (source level=80)

2. when I changed the view script and add "dbo." in front of table names the error move to next view creation.

!!! this does not work for all views

Cheers

Nick

|||

Hi Nick,

I would really need to see the full log files (i.e. TransferDump*.sql and SMO Tranfer log) in order to be able to help more. You could send them directly to me at oscar.naim@.microsoft.com.

By the way, are you defining extended properties for this particular database?

Thanks,
Oscar.

|||

Hello oscar

I do not have any extended properties at my database.

I realy can;t find any files named TransferDump*.* in my disk

I found a directory SMO but it is empty

the directory is created under the SQLAgent acount documents and settings...

I monitor the directory as the CDW is executed and a file was created

but when the execution stops with or with out an error the file is deleted

so I can;t postit to you

Thank you

Copying database using "Copy Database"

I am struggling with the "Copy Database Wizard" in SQL Server 2005. I am used to working with DTS to copy data from one server to another, but with the new tools, I am having serious problems (in fact, it's unusable)

1. When copying a database using the "SQL Management Object" method, I always get errors concerning logins. If I select not to copy logins, I get errors "sp_grantdbaccess failed". If I do select to copy logins, the logins can't be created because the machine names are different (one the source machine, the login is called MACHINE1/mylogin, but on the destination machine, such a login cannot be created)

2. For small databases, I ALWAYS get the error "CREATE DATABASE failed. Primary file must be at least 3 MB to accommodate a copy of the model database". There is no way to specify a larger size for the database in the wizard.

Note: copying databases using detach/attach is not an option (the servers cannot see eachother's shares)

I must say that in general I hate the new management tools. Enterprise Manager had its flaws too, but the quality of the "SQL Server Management Studio" seems very low IMHO.

Regards,
Philippe Leybaert

I can get the copy to work but it will not copy any of my stored procedures or functions.|||did you ever get a resolution on this. I am having the same issue.|||Yeah - this sucks. Has anyone seen where SP's can be copied? Sure we can script them and run in teh new DB - but it's a pain in the butt, especially if you can see shared drivespace.|||

Blake05 wrote:

I can get the copy to work but it will not copy any of my stored procedures or functions.

This is actually very simple, but the error messages are of no help. The problem is that there is a bug in at least one stored procedure or function. Go through them all until you find the ones that you can't save/update, and repair or delete (if obsolete) them. Once they are all functioning, the copy will work without a hitch.

|||I notice that no one from Microsoft has answered this problem.

It seems to me the Copy Database Wizard is completely ignoring the fact that I am always trying to deselect the logins. It just happily tries to copy them even though it's going to a development machine that will only see 4 of the 100 logins on the production server.

I struggled with this problem for days and was crossing my fingers that it would be solved in SP1, sadly it's not.

Detaching is not an option for production databases!!!

Fix this Microsoft!!!
|||

We are aware of many issues in the Copy Database Wizard. We're doing a lot of work on the wizard in SP2 to address these.

If you have a specific scenario you would like to see addressed, please file a defect report here: http://lab.msdn.microsoft.com/productfeedback/Default.aspx. Defects reports entered at the feedback center are used to prioritize work for future versions and service packs.

Thanks,
Steve

|||

Hi Philippe,

You can now install the latest version of the Copy Database Wizard from the following location:

http://www.microsoft.com/sql/ctp.mspx

This CTP version includes many improvements and hopefully they should address most of your current issues.

Thanks,
Oscar.

|||

Hello Oscar

I have a problem with Copy Database Wizard to.

Have agent account as sysadmin in both source and target database

Target server has CTP Dec 2006 installed. Bat I can’t install it to the source “production” system

Managed to transfer five databases fixing the error found at the error log file

At the sixth database I have an error that I can not understand

The error appears when trying to create a view at the target system.

errorCode=-1073548784 description=Executing the query "create view [dbo].[VShift_Cost]

as

select sf.ShiftID, SFD.UnitID, sum(sfd.charge) as Shift_Charge

from shiftcostdetail sfd inner join shiftcost sf on sfd.shiftcostid = sf.shiftcostid

group by sf.shiftid, SFD.unitID

" failed with the following error: "Invalid object name 'shiftcostdetail'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The shiftcostdetail is an existing table and the view works fine at the source system.

Can you help?

Thanks

|||

Hi Panzin,

Could you please tell me where are you launching CDW from? You should launch CDW from the target machine is this machine is the one that has the latest version installed. From here, you can select the source the database and perform the copy. Could you please confirm that this is what you are doing? You could also select the "Save Transfer Logs" option before clicking "Finish" and send me the corresponding TransferDump*.sql files generated in :

C:\Documents and Settings\<user-name>\Local Settings\Application Data\Microsoft\SQL Server\Smo

It would be useful too to select "Write log to a file" before performing the copy and check for any other errors.

I will investigate the error that you described above, but it seems that it could be a dependency issue. I will get back to you once I find more information.

Thanks,
Oscar.

|||

Hi Oscar

Thank you for your reply

The CDW is running from the target system.

The target system is the one with the CTP installed

The posted error is from the log file

I can't find the "Save Transfer Logs" option

Thank's again

|||

Hi Panzin,

Are you using the SMO Transfer method to copy the database or Detach/Attach? I believe you are using the SMO Transfer method...

The "Save transfer logs?" checkbox is in the "Configure the Package" page of the wizard.

By the way, are you also copying any extra objects apart from the database? If so, which ones? Are you referencing any objects that are outside this view that might require the selection of some particular extra objects?

Cheers,
Oscar.

|||

Hello Oscar

Thank you for your help

I'm using the SMO transfer method and the related objects that i'm copying are the "logins"

At the configure the Pacage page I'm using

Logging options "Text File" and the posted error is from the text file ...

also show that

1. db created at target server is at compatibility level 90 (source level=80)

2. when I changed the view script and add "dbo." in front of table names the error move to next view creation.

!!! this does not work for all views

Cheers

Nick

|||

Hi Nick,

I would really need to see the full log files (i.e. TransferDump*.sql and SMO Tranfer log) in order to be able to help more. You could send them directly to me at oscar.naim@.microsoft.com.

By the way, are you defining extended properties for this particular database?

Thanks,
Oscar.

|||

Hello oscar

I do not have any extended properties at my database.

I realy can;t find any files named TransferDump*.* in my disk

I found a directory SMO but it is empty

the directory is created under the SQLAgent acount documents and settings...

I monitor the directory as the CDW is executed and a file was created

but when the execution stops with or with out an error the file is deleted

so I can;t postit to you

Thank you

Copying database using "Copy Database"

I am struggling with the "Copy Database Wizard" in SQL Server 2005. I am used to working with DTS to copy data from one server to another, but with the new tools, I am having serious problems (in fact, it's unusable)

1. When copying a database using the "SQL Management Object" method, I always get errors concerning logins. If I select not to copy logins, I get errors "sp_grantdbaccess failed". If I do select to copy logins, the logins can't be created because the machine names are different (one the source machine, the login is called MACHINE1/mylogin, but on the destination machine, such a login cannot be created)

2. For small databases, I ALWAYS get the error "CREATE DATABASE failed. Primary file must be at least 3 MB to accommodate a copy of the model database". There is no way to specify a larger size for the database in the wizard.

Note: copying databases using detach/attach is not an option (the servers cannot see eachother's shares)

I must say that in general I hate the new management tools. Enterprise Manager had its flaws too, but the quality of the "SQL Server Management Studio" seems very low IMHO.

Regards,
Philippe Leybaert

I can get the copy to work but it will not copy any of my stored procedures or functions.|||did you ever get a resolution on this. I am having the same issue.|||Yeah - this sucks. Has anyone seen where SP's can be copied? Sure we can script them and run in teh new DB - but it's a pain in the butt, especially if you can see shared drivespace.|||

Blake05 wrote:

I can get the copy to work but it will not copy any of my stored procedures or functions.

This is actually very simple, but the error messages are of no help. The problem is that there is a bug in at least one stored procedure or function. Go through them all until you find the ones that you can't save/update, and repair or delete (if obsolete) them. Once they are all functioning, the copy will work without a hitch.

|||I notice that no one from Microsoft has answered this problem.

It seems to me the Copy Database Wizard is completely ignoring the fact that I am always trying to deselect the logins. It just happily tries to copy them even though it's going to a development machine that will only see 4 of the 100 logins on the production server.

I struggled with this problem for days and was crossing my fingers that it would be solved in SP1, sadly it's not.

Detaching is not an option for production databases!!!

Fix this Microsoft!!!
|||

We are aware of many issues in the Copy Database Wizard. We're doing a lot of work on the wizard in SP2 to address these.

If you have a specific scenario you would like to see addressed, please file a defect report here: http://lab.msdn.microsoft.com/productfeedback/Default.aspx. Defects reports entered at the feedback center are used to prioritize work for future versions and service packs.

Thanks,
Steve

|||

Hi Philippe,

You can now install the latest version of the Copy Database Wizard from the following location:

http://www.microsoft.com/sql/ctp.mspx

This CTP version includes many improvements and hopefully they should address most of your current issues.

Thanks,
Oscar.

|||

Hello Oscar

I have a problem with Copy Database Wizard to.

Have agent account as sysadmin in both source and target database

Target server has CTP Dec 2006 installed. Bat I can’t install it to the source “production” system

Managed to transfer five databases fixing the error found at the error log file

At the sixth database I have an error that I can not understand

The error appears when trying to create a view at the target system.

errorCode=-1073548784 description=Executing the query "create view [dbo].[VShift_Cost]

as

select sf.ShiftID, SFD.UnitID, sum(sfd.charge) as Shift_Charge

from shiftcostdetail sfd inner join shiftcost sf on sfd.shiftcostid = sf.shiftcostid

group by sf.shiftid, SFD.unitID

" failed with the following error: "Invalid object name 'shiftcostdetail'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The shiftcostdetail is an existing table and the view works fine at the source system.

Can you help?

Thanks

|||

Hi Panzin,

Could you please tell me where are you launching CDW from? You should launch CDW from the target machine is this machine is the one that has the latest version installed. From here, you can select the source the database and perform the copy. Could you please confirm that this is what you are doing? You could also select the "Save Transfer Logs" option before clicking "Finish" and send me the corresponding TransferDump*.sql files generated in :

C:\Documents and Settings\<user-name>\Local Settings\Application Data\Microsoft\SQL Server\Smo

It would be useful too to select "Write log to a file" before performing the copy and check for any other errors.

I will investigate the error that you described above, but it seems that it could be a dependency issue. I will get back to you once I find more information.

Thanks,
Oscar.

|||

Hi Oscar

Thank you for your reply

The CDW is running from the target system.

The target system is the one with the CTP installed

The posted error is from the log file

I can't find the "Save Transfer Logs" option

Thank's again

|||

Hi Panzin,

Are you using the SMO Transfer method to copy the database or Detach/Attach? I believe you are using the SMO Transfer method...

The "Save transfer logs?" checkbox is in the "Configure the Package" page of the wizard.

By the way, are you also copying any extra objects apart from the database? If so, which ones? Are you referencing any objects that are outside this view that might require the selection of some particular extra objects?

Cheers,
Oscar.

|||

Hello Oscar

Thank you for your help

I'm using the SMO transfer method and the related objects that i'm copying are the "logins"

At the configure the Pacage page I'm using

Logging options "Text File" and the posted error is from the text file ...

also show that

1. db created at target server is at compatibility level 90 (source level=80)

2. when I changed the view script and add "dbo." in front of table names the error move to next view creation.

!!! this does not work for all views

Cheers

Nick

|||

Hi Nick,

I would really need to see the full log files (i.e. TransferDump*.sql and SMO Tranfer log) in order to be able to help more. You could send them directly to me at oscar.naim@.microsoft.com.

By the way, are you defining extended properties for this particular database?

Thanks,
Oscar.

|||

Hello oscar

I do not have any extended properties at my database.

I realy can;t find any files named TransferDump*.* in my disk

I found a directory SMO but it is empty

the directory is created under the SQLAgent acount documents and settings...

I monitor the directory as the CDW is executed and a file was created

but when the execution stops with or with out an error the file is deleted

so I can;t postit to you

Thank you

Copying database using "Copy Database"

I am struggling with the "Copy Database Wizard" in SQL Server 2005. I am used to working with DTS to copy data from one server to another, but with the new tools, I am having serious problems (in fact, it's unusable)

1. When copying a database using the "SQL Management Object" method, I always get errors concerning logins. If I select not to copy logins, I get errors "sp_grantdbaccess failed". If I do select to copy logins, the logins can't be created because the machine names are different (one the source machine, the login is called MACHINE1/mylogin, but on the destination machine, such a login cannot be created)

2. For small databases, I ALWAYS get the error "CREATE DATABASE failed. Primary file must be at least 3 MB to accommodate a copy of the model database". There is no way to specify a larger size for the database in the wizard.

Note: copying databases using detach/attach is not an option (the servers cannot see eachother's shares)

I must say that in general I hate the new management tools. Enterprise Manager had its flaws too, but the quality of the "SQL Server Management Studio" seems very low IMHO.

Regards,
Philippe Leybaert

I can get the copy to work but it will not copy any of my stored procedures or functions.|||did you ever get a resolution on this. I am having the same issue.|||Yeah - this sucks. Has anyone seen where SP's can be copied? Sure we can script them and run in teh new DB - but it's a pain in the butt, especially if you can see shared drivespace.|||

Blake05 wrote:

I can get the copy to work but it will not copy any of my stored procedures or functions.

This is actually very simple, but the error messages are of no help. The problem is that there is a bug in at least one stored procedure or function. Go through them all until you find the ones that you can't save/update, and repair or delete (if obsolete) them. Once they are all functioning, the copy will work without a hitch.

|||I notice that no one from Microsoft has answered this problem.

It seems to me the Copy Database Wizard is completely ignoring the fact that I am always trying to deselect the logins. It just happily tries to copy them even though it's going to a development machine that will only see 4 of the 100 logins on the production server.

I struggled with this problem for days and was crossing my fingers that it would be solved in SP1, sadly it's not.

Detaching is not an option for production databases!!!

Fix this Microsoft!!!
|||

We are aware of many issues in the Copy Database Wizard. We're doing a lot of work on the wizard in SP2 to address these.

If you have a specific scenario you would like to see addressed, please file a defect report here: http://lab.msdn.microsoft.com/productfeedback/Default.aspx. Defects reports entered at the feedback center are used to prioritize work for future versions and service packs.

Thanks,
Steve

|||

Hi Philippe,

You can now install the latest version of the Copy Database Wizard from the following location:

http://www.microsoft.com/sql/ctp.mspx

This CTP version includes many improvements and hopefully they should address most of your current issues.

Thanks,
Oscar.

|||

Hello Oscar

I have a problem with Copy Database Wizard to.

Have agent account as sysadmin in both source and target database

Target server has CTP Dec 2006 installed. Bat I can’t install it to the source “production” system

Managed to transfer five databases fixing the error found at the error log file

At the sixth database I have an error that I can not understand

The error appears when trying to create a view at the target system.

errorCode=-1073548784 description=Executing the query "create view [dbo].[VShift_Cost]

as

select sf.ShiftID, SFD.UnitID, sum(sfd.charge) as Shift_Charge

from shiftcostdetail sfd inner join shiftcost sf on sfd.shiftcostid = sf.shiftcostid

group by sf.shiftid, SFD.unitID

" failed with the following error: "Invalid object name 'shiftcostdetail'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The shiftcostdetail is an existing table and the view works fine at the source system.

Can you help?

Thanks

|||

Hi Panzin,

Could you please tell me where are you launching CDW from? You should launch CDW from the target machine is this machine is the one that has the latest version installed. From here, you can select the source the database and perform the copy. Could you please confirm that this is what you are doing? You could also select the "Save Transfer Logs" option before clicking "Finish" and send me the corresponding TransferDump*.sql files generated in :

C:\Documents and Settings\<user-name>\Local Settings\Application Data\Microsoft\SQL Server\Smo

It would be useful too to select "Write log to a file" before performing the copy and check for any other errors.

I will investigate the error that you described above, but it seems that it could be a dependency issue. I will get back to you once I find more information.

Thanks,
Oscar.

|||

Hi Oscar

Thank you for your reply

The CDW is running from the target system.

The target system is the one with the CTP installed

The posted error is from the log file

I can't find the "Save Transfer Logs" option

Thank's again

|||

Hi Panzin,

Are you using the SMO Transfer method to copy the database or Detach/Attach? I believe you are using the SMO Transfer method...

The "Save transfer logs?" checkbox is in the "Configure the Package" page of the wizard.

By the way, are you also copying any extra objects apart from the database? If so, which ones? Are you referencing any objects that are outside this view that might require the selection of some particular extra objects?

Cheers,
Oscar.

|||

Hello Oscar

Thank you for your help

I'm using the SMO transfer method and the related objects that i'm copying are the "logins"

At the configure the Pacage page I'm using

Logging options "Text File" and the posted error is from the text file ...

also show that

1. db created at target server is at compatibility level 90 (source level=80)

2. when I changed the view script and add "dbo." in front of table names the error move to next view creation.

!!! this does not work for all views

Cheers

Nick

|||

Hi Nick,

I would really need to see the full log files (i.e. TransferDump*.sql and SMO Tranfer log) in order to be able to help more. You could send them directly to me at oscar.naim@.microsoft.com.

By the way, are you defining extended properties for this particular database?

Thanks,
Oscar.

|||

Hello oscar

I do not have any extended properties at my database.

I realy can;t find any files named TransferDump*.* in my disk

I found a directory SMO but it is empty

the directory is created under the SQLAgent acount documents and settings...

I monitor the directory as the CDW is executed and a file was created

but when the execution stops with or with out an error the file is deleted

so I can;t postit to you

Thank you

Wednesday, March 7, 2012

copying a table from one database to another "last" doesnt appear the same

In enterprise manager I am copying a table from one database to
another. I am using the dts wizard to import the data. After I
successfully import the data, I open both tables to compare the
records to make sure they are the same. I right click on a field and
click "last" for both tables. However, the record is different for
both. If I do a query the record is still there but they do not show
up in the same order. Why does'nt the import wizard import the
records in the same order? Any help would be greatly appreciated.Rows in a table are not ordered. The Wizard does an INSERT... SELECT from
one table to another and unless there's a clustered index on the table
there's a good chance that the rows will be physically stored in a different
order.

Don't worry about the physical order - just use SELECT... ORDER BY if you
want to see the rows ordered.

--
David Portas
----
Please reply only to the newsgroup
--|||Great! Thank you very much for your help! After submitting this
question I noticed that microsoft mentions this on their site:

"Because SQL Server can use parallel scans to retrieve data, the data
bulk copied from an instance of SQL Server is not guaranteed to be in
any specific order unless you bulk copy from a query and specify an
ORDER BY clause."

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||But note that even if you manage to insert the rows in a specific order
there is no guarantee that they will be sorted in that order when you view
the data. If you require a specific order then you need to use ORDER BY
every time you want to view the data.

--
David Portas
----
Please reply only to the newsgroup
--

Friday, February 24, 2012

Copy/Move database

I am trying to move a database from a dev machine to my server. I've tried the copy wizard but get an error saying the I cannot connect to the server after selecting it from the dropdown list in the wizard.
I have also tried doing a backup and restore, but run into the problem created by wanting to change the name of the db, if possible.
I am using Windows Auth and have access to the server.
Any suggestions would be greatly appreciated.

Thank you for your help.Hi,

- Create a backup of the database at your dev machine.

- Create a new database with the new name at the server and set the database and the log-file location to the desired path. Record the location of the datafile and the transaction log.

- Copy the backup-file to the new server in a temp-path.

- From the new database select the backup-file to restore and set the following options BEFORE you start the restore: Change the locations to the recorded values. Check Force restore over existing database.

- Start restore

Your database will now be restored at the new server.

Succes.

copy wizard gives error creating share

When I run the database copy wizard I'm getting an error creating shared omwwize.
The source server is 7.0. The destination server is 2000. I'm invoking the wizard from the 2000 machine.
Anybody know what this error means?
Thanks
SharonIf the destination SQL Server is started under a domain account that does not have local administrator privileges on the source computer then the following error message may be generated by the wizard:

Step Error Source: Microsoft Data Transformation Services (DTS) Package
Step Error Description:Unspecified error

Step Error code: 80004005
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:1100
Clicking on the "MORE INFO >>>" button, you will find that permissions to create the remote share are not present.

Failed to create the share OMWWIZD

Copy Wizard Failure when coping a database on the same machine

I am trying to copy the a database on the same machine (source and destination are the same). The wizard fails using the SMO method. I have attemped to turn on the "Save Transfer logs", but it does not appear to save a file: I have looked in C:\Documents and Settings\<user-name>\Local Settings\Application Data\Microsoft\SQL Server\SMO for all the users on the server. None of them have the SMO directory in the that path nor can I find a SMO directory on the server.

The SQL Server agent account is set to Local System.

I have made the Local Administrator a Sysadmin in SQL server.

Job History after failure:

Date 6/15/2007 8:25:10 PM
Log Job History (CDW_YOUR-BQEHG1XTVQ_YOUR-BQEHG1XTVQ_9)

Step ID 1
Server YOUR-BQEHG1XTVQ
Job Name CDW_YOUR-BQEHG1XTVQ_YOUR-BQEHG1XTVQ_9
Step Name CDW_YOUR-BQEHG1XTVQ_YOUR-BQEHG1XTVQ_9_Step
Duration 00:00:48
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0

Message
Executed as user: YOUR-BQEHG1XTVQ\SYSTEM. ...GUE SQL USE [Tango_QA] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[strpcd_firewall_lan_objects_to_add]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[strpcd_firewall_lan_objects_to_add] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[stpcd_call_view_your_account_firewall_policies]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[stpcd_call_view_your_account_firewall_policies] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[stpcd_call_view_your_account_firewall_objects]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[stpcd_call_view_your_account_firewall_objects] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[stpcd_GetSIPNetworkLocation]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[stpcd_GetSIPNetworkLocation] GO IF EXISTS (SELECT * FROM sys.objects WHERE obje... The package execution fa... The step failed.

Stumped as what what to try next or what the issue is?

What is the level of service pack on SQL Server?

BOL refers:
The destination server must be running SQL Server 2005 Service Pack 2 or a later version. The computer on which the Copy Database Wizard runs may be the source or destination server, or a separate computer. This computer must also be running SQL Server 2005 Service Pack 2 or a later version to use all the features of the wizard.

To use the Copy Database Wizard, you must be a member of the sysadmin fixed server role on the source and destination servers. To transfer databases by using the detach-and-attach method, you must have file system access to the file-system share that contains the source database files.

|||The source and the destination server are one and the same. It is running SQL 2005 SP2. I am using SA to make a copy of the database. The wizard starts to copy the database but then fails before coping all of the tables.|||Ensure SA login is not disabled, you might try using SQL SErver service account in this case.

Copy Wizard failed?

I tried to use Copy Database wizard but it keeps returning this error:
Step Error Source: Microsoft Data Transformation Services (DTS) Package
Step Error Description:Unspecified error
Step Error code: 80004005
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:1100
How do I resolve this?
Both the source database and destination database have valid
authentications.It's likely related to permissions. For permissions
requirements, service account requirements, refer to the
following article:
INF: Understanding and Troubleshooting the Copy Database
Wizard in SQL Server 2000
http://support.microsoft.com/?id=274463
-Sue
On Wed, 3 Dec 2003 18:21:41 -0500, "Ed"
<eddiemarino@.hotmail.com> wrote:
>I tried to use Copy Database wizard but it keeps returning this error:
>Step Error Source: Microsoft Data Transformation Services (DTS) Package
>Step Error Description:Unspecified error
>Step Error code: 80004005
>Step Error Help File:sqldts80.hlp
>Step Error Help Context ID:1100
>
>How do I resolve this?
>Both the source database and destination database have valid
>authentications.
>|||Thanks, Sue.
Could a database be copied without using this wizard?
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:ii01tvo98f6qoe1rspo94u3i2lrm3mssne@.4ax.com...
> It's likely related to permissions. For permissions
> requirements, service account requirements, refer to the
> following article:
> INF: Understanding and Troubleshooting the Copy Database
> Wizard in SQL Server 2000
> http://support.microsoft.com/?id=274463
> -Sue
> On Wed, 3 Dec 2003 18:21:41 -0500, "Ed"
> <eddiemarino@.hotmail.com> wrote:
> >I tried to use Copy Database wizard but it keeps returning this error:
> >
> >Step Error Source: Microsoft Data Transformation Services (DTS) Package
> >Step Error Description:Unspecified error
> >
> >Step Error code: 80004005
> >Step Error Help File:sqldts80.hlp
> >Step Error Help Context ID:1100
> >
> >
> >How do I resolve this?
> >
> >Both the source database and destination database have valid
> >authentications.
> >
>|||Hi
It is not clear why you want to use this but maybe the way around it is to
use a different method to copy the database:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q314546
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b224071
John
"Ed" <eddiemarino@.hotmail.com> wrote in message
news:%23weAzjnuDHA.1060@.TK2MSFTNGP12.phx.gbl...
> I tried to use Copy Database wizard but it keeps returning this error:
> Step Error Source: Microsoft Data Transformation Services (DTS) Package
> Step Error Description:Unspecified error
> Step Error code: 80004005
> Step Error Help File:sqldts80.hlp
> Step Error Help Context ID:1100
>
> How do I resolve this?
> Both the source database and destination database have valid
> authentications.
>|||Yes...you can copy a backup file to the destination server
and restore the backup. You can use sp_detach_db and
sp_attach_db.
-Sue
On Fri, 5 Dec 2003 11:00:32 -0500, "Ed"
<eddiemarino@.hotmail.com> wrote:
>Thanks, Sue.
>Could a database be copied without using this wizard?
>"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
>news:ii01tvo98f6qoe1rspo94u3i2lrm3mssne@.4ax.com...
>> It's likely related to permissions. For permissions
>> requirements, service account requirements, refer to the
>> following article:
>> INF: Understanding and Troubleshooting the Copy Database
>> Wizard in SQL Server 2000
>> http://support.microsoft.com/?id=274463
>> -Sue
>> On Wed, 3 Dec 2003 18:21:41 -0500, "Ed"
>> <eddiemarino@.hotmail.com> wrote:
>> >I tried to use Copy Database wizard but it keeps returning this error:
>> >
>> >Step Error Source: Microsoft Data Transformation Services (DTS) Package
>> >Step Error Description:Unspecified error
>> >
>> >Step Error code: 80004005
>> >Step Error Help File:sqldts80.hlp
>> >Step Error Help Context ID:1100
>> >
>> >
>> >How do I resolve this?
>> >
>> >Both the source database and destination database have valid
>> >authentications.
>> >
>

Friday, February 17, 2012

Copy Table + data from database A to database B

Hi:
I'm really new to this DBA stuff and I need an explanation for what just hap
pened.
I just used the copy wizard to copy Table A from database A to database B.
All the data and the table structure were successfully created in database B
with one exception: the first column had
the IDENTITY (1,1) attribute set in database A. But after the copy to datab
ase B the IDENTITY attribute was missing!!!
Fortunately, I'm one of those inveterate "testers" so I discovered the probl
em before it made it into Production.
Eventually, I had to generate a script for the table to create that table in
database B with the IDENTITY in place and
then import the data.
Anyone have any idea what the problem is and how to solve it' I don't like
the idea of having to generate a script for
each table that I need to move and then import the data!!!! The copy wizar
d is a gem if it works as advertised!
Using SQL Server 7.0.
cathyThe copy table option only copies the data. If you want to copy all the
attributes you should use the Copy objects and data between SQL Server
databases.
The copy table option was designe to allow data transfers between
heterogenous data sources.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Copy Table + data from database A to database B

Hi:
I'm really new to this DBA stuff and I need an explanation for what just happened.
I just used the copy wizard to copy Table A from database A to database B.
All the data and the table structure were successfully created in database B with one exception: the first column had
the IDENTITY (1,1) attribute set in database A. But after the copy to database B the IDENTITY attribute was missing!!!
Fortunately, I'm one of those inveterate "testers" so I discovered the problem before it made it into Production.
Eventually, I had to generate a script for the table to create that table in database B with the IDENTITY in place and
then import the data.
Anyone have any idea what the problem is and how to solve it' I don't like the idea of having to generate a script for
each table that I need to move and then import the data!!!! The copy wizard is a gem if it works as advertised!
Using SQL Server 7.0.
cathyThe copy table option only copies the data. If you want to copy all the
attributes you should use the Copy objects and data between SQL Server
databases.
The copy table option was designe to allow data transfers between
heterogenous data sources.
Rand
This posting is provided "as is" with no warranties and confers no rights.