How To Use Transfer SQL Object To Copy An Entire Database Including Logins And Users
Dec 14, 2007
I have read the previous threads on the bugs with this task mainly: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1438968&SiteID=1 . These are great posts that helpmed me avoid wasting time. I haven't seen one yet that addresses copying an entire database including the sql server logins.
I would like to import the ENTIRE database from one (2005) server to another(2005) using the SSIS Transfer SQL Object task (not just sprocs,tables,views and functions). I have figured out how to pull the tables,views,sprocs and functions ... by using an execute sql task to drop these objects. But I cannot get this to work for users since the user dbo cannot be dropped and guest can only be disabled. I am creating a new database (this is the database where the sql objects will be copied to) via management studio to test this. There has to ba a way to get this working ... Microsoft must have published some sort of KB article on this task or a Script Task using SMO object calls. If need be I can drop the entire database on the target machine and have SSIS recreate it.
The only reason I'm willing to take a risk with SSIS rather than backup and restore is because of time constraints (I assume the SSIS task is faster) and backup storage administration.
declare @name varchar(200)
declare @object varchar(200)
DECLARE object_cursor CURSOR READ_ONLY FORWARD_ONLY FOR
select table_name,table_type from INFORMATION_SCHEMA.TABLES
union
Select name,'SPROC' table_type from sys.procedures Where [type] = 'P' and is_ms_shipped = 0 and [name] not like 'sp[_]%diagram%'
union
select name,'FN' from sys.objects where type_desc like '%FUNCTION'
OPEN object_cursor
FETCH NEXT FROM object_cursor INTO @name,@object
IF @@FETCH_STATUS <> 0
PRINT ' <<None>>'
WHILE @@FETCH_STATUS = 0
BEGIN
if @object = 'BASE TABLE'
begin
exec ('drop table ' + @name)
end
else if @object = 'VIEW'
begin
exec ('drop view ' + @name)
end
else if @object = 'SPROC'
begin
exec ('drop procedure ' + @name)
end
else if @object = 'FN'
begin
exec ('drop function ' + @name)
end
FETCH NEXT FROM object_cursor INTO @name,@object
END
CLOSE object_cursor
DEALLOCATE object_cursor
View 4 Replies
ADVERTISEMENT
Jan 26, 2007
Hello all,I am looking for the script, which I believe exists already.I need tobe able to populate the script for security of one database andapply it to another database, even if it is located on another server:1. All logins which not exist have to be created and which existsignored including the NT accounts2. Users same as the old database + the existing ones stay in database3. Passwords for the new logins.4. All permissions/grants on all objects for the users that exists(usually it's the case) and ignore those that don't.I have script which does some of it, but it's not perfect, so everytime there are some errors.Please let me know, if you need me to email script that I have. It'spretty long so I cannot just post it in here.Thank you in advance.
View 3 Replies
View Related
May 4, 2007
I'm using a Business Intelligence project to copy stored procedures and tables from one database to another across servers. I'm having trouble copying tables or stored procedures using the Management.SMO.Transfer class.
I tried copying stored procedure with the property transfer.CopyAllStoredProcedures = true. This didn't work. As a workaround, I used the StringCollection property and executed every string as sql.
Now I'm having trouble copying tables. I don't want to copy all the tables in the database. How do I go about selecting what tables to copy. I tried using ObjectList property and provided the names of the tables in an ArrayList. I get the error
"Transfer cannot process System.String. You need to pass an instance class object."
How can I pass an "instance class object" for something that's in the database? The ScriptTransfer method fails so I can't even see the script that is being generated. There is virtually no documentation for this class.
Any help will be appreciated.
Transfer transfer = new Transfer();
transfer.Database = sourceDB;
transfer.DestinationDatabase = DestinationDatabase;
transfer.DestinationServer = DestinationServer;
transfer.DropDestinationObjectsFirst = false;
transfer.CopyData = true;
transfer.CopySchema = true;
transfer.CopyAllObjects = false;
transfer.CopyAllTables = false;
transfer.CopyAllStoredProcedures = false;
transfer.Options.WithDependencies = false;
GetTablesToBeCopied();
transfer.ObjectList = tablesList;
transfer.Options.FileName = "C:\TransferScriptTables.sql";
StringCollection coll = transfer.ScriptTransfer();
View 3 Replies
View Related
Mar 20, 2006
Hi
I can't figure out what the purpose of having seperate users is as I can't actually login to the database using one.
Here is my scenario.
I have a single login called LoginA and I have a database which I want to carve up using schema's. At the database level I need to create a user, associate a login with this user and can set a default schema and specifiy what schemas this USER can access. The login created can access multiple schemas.
So..
I created a database login called loginA.
I created a user for the database called UserA set it's login name to LoginA and
I then created 3 schemas called SchemaA, SchemaB and SchemaC and set their schema owner name to UserA.
I went back to UserA and set their default Schema to SchemaA
How can I login using the new user created as it has no password associated with it. If I login using LoginA then I have no default Schema set becuase the schema is associated with a USER not a LOGIN.
I can understand why you can only have one login account assicated with one user account for each database but I can;t understand why you can specify a user name if you can't use it to login.
Has anyone got any ideas?
Thanks
View 1 Replies
View Related
Apr 25, 2008
I've had issues where backup up and restoring data from sqlserver2005 does not reattach the data to the correct users. Any tips on how to best accomplish full database moves where data is owned by different security users?
thanks,
View 2 Replies
View Related
Feb 2, 2007
Our company has 2 Database Roles (DBE and DBA). The DBE creates
database schema, performs SQL Server Administration, and manages server
security. The DBA writes data access, ETL, and manages database
security. In 2005, we're struggling with how to allow the DBA to see
all of the logins on the server in order to add them as users of their
database. What permissions does the DBA need to select from any of the
logins on the server to add them to their database?
Michelle
View 1 Replies
View Related
Jul 6, 2007
Hi All,
I have just migrated couple of test databases
from SQL Server 2000 to 2005 (side by side).
I also migrated the server level logins using SSIS transfer logins task, available on SSIS 'Transfer logins', I selected all the databases that I have migrated so that I have all database users account in server logins (to avoid orphaned users); but I don't have all the database users in server logins, also the sys.sysusers doesn't have the database users, that I have moved to SQL 2005. Can anybody help?
Also do I need to back up the SQL Server 2000 database and restore it on SQL 2005? What impact this operation can have?
Thanks for your time..
Bidyut
View 5 Replies
View Related
May 14, 2014
how to copy one database tables, columns, store-procedures. to another database without any error
View 2 Replies
View Related
Jul 28, 2000
Hi
All,
I am using Databaseobject transfer wizard to transfer objects and data
between two sql server 6.5 servers on schedule basis.unfortunately i specified non existing log directory for transfering these objects.Is there a way to change this this directory in 6.5 or to modify existing object transfer package..
I created several object transfers packages it will take lot of time for deleting and recreate them..
Thanks For your Help,
Kris
View 1 Replies
View Related
Sep 24, 1999
SQL 7.0 seems to be missing Database/Object Transfer tool, which allows to transfer single objects or whole database from one to another.
Also I couldn't find Backup/Restore one single object option eigther.
Could anyone can comment this, pls?
Michael Gladshteyn
View 1 Replies
View Related
May 28, 1999
When I am trying to transfer a database from one server to another everything comes over fine except the Stored Procedures and views. What am I doing wrong?
I'v tried just transfering the SP and views and I am still having the problem.
Thanks
View 1 Replies
View Related
Jul 28, 2000
Hi
All,
I am using Databaseobject transfer wizard to transfer objects and data
between two sql server 6.5 servers on schedule basis.unfortunately i specified non existing log directory for transfering these objects.Is there a way to change this this directory in 6.5 or to modify existing object transfer package..
I created several object transfers packages it will take lot of time for deleting and recreate them..
Thanks For your Help,
Kris
View 2 Replies
View Related
Jun 18, 2015
I am working on a Login migration issue. I have the Master database from the original database, that I have attached as a User Database, call it OriginalMaster. I also renamed the mdf and ldf files, before attaching, just in case.
I want to select the logins from the OriginalMaster, and using sp_help_revlogin script all the Logins out. I know there were many logins in that database. But what I am seeing, are all the Logins from the Current Master database. Which are only 7 Logins.
How can I select the logins, or script out the Logins from the OriginalMaster database?
View 1 Replies
View Related
Oct 18, 1999
Hi Folks,
I have a problem when trying to schedule a Database /Object Transfer.
The transfer between two similiar databases located on differernt servers is consistantly failing even though it will be successful if I choose the
Start Transfer Option. The error message that appears is 'Process Exit Code 1. Cannot connect to source server'. This is even with the other server
regestered on both servers !
I have tried different levels of security (sa and trusted), re-regestering the servers, WINS settings in TCP/IP but all to no avail.
The servers are configured in the same way.
If you have come across the same problem, please share the solution. Any suggestions greatly appreciated.
Thanks in advance
Alan Shinnors
View 1 Replies
View Related
Mar 5, 1999
Does anyone know of a reported bug in the security scripting option of the database/object transfer GUI utility in 6.5? I created a mirror database on the same server and transfered all object including logins and permissions. There was a warning the the passwords were set to null on the destination database, but they were also set to null on the source database. Any experience with this?
View 1 Replies
View Related
Nov 26, 2001
Hi all...
Sorry if this is a real simple question, but I just had a SQL 6.5 server dropped in my lap. I need to transfer all the data to a new box, which I did using the Tools mneu (Database/Object Transfer) in Enterprise Manager. I checked the databases after the transfer and all the data seems to be there, including the logins. However, if I try to connect the database, all logins fail.
Connection failed.
SQL State '28000'
SQL Server Error 4002
[Microsoft][ODBC SQL Server Driver][SQL Server] Login failed
Does any body know how to fix this easily without resetting every single user id?
Any help
would be greatly appreciated.
Thanks
Greg
View 1 Replies
View Related
Sep 13, 2007
Hi everyone
Can any one help me I am using Tranfer databse object task when I am trying to run it its throwing exception can not send null value in login name????
View 7 Replies
View Related
Aug 14, 2007
We are currently running sql 2000 and are moving our database onto sql 2005 running on a different box.
We have managed to move the entire database, with users however the users permissions on specific tables/views/stored procedures have not been transferred, does anyone know a way of transferring user permissions rather then doing them all by hand?
The system is a large (over 500 table/views/stored procedures) and a very active one and therefore downtime is not optional.
any suggestions would be appreciated
Regards
Chris V
View 2 Replies
View Related
May 8, 2006
Hi all,
I have created a package to copy 10 tables from a database to another one. I have created a datasource with SQL Authentication mode. And it couldn't run until I changed the datasource connection to Windows Authentication mode. How could it be like that, it's just the authentication mode?
Is there anyone have the right answer for this situation?
View 3 Replies
View Related
Dec 2, 2006
Hi,
I would like to know if there will every be a clean way to transfer a database from a remote server to a local server (and back again). I've tried several different approaches, but they all currently have bugs/problems.
I've looked into database publishing wizard - but this creates a huge script that takes 10x longer to run than the old DTS transfer.
I've tried copying data, and objects separate, but this requires multiple steps, using DTS this was all done in one step.
I've tried using SSIS Transfer SQL Objects, but the defaults are not created, using DTS, the ENTIRE database was transfered, which is what I want.
I've tried using SSIS Transfer Database, but even when I select "Online" mode, I get an error asking me to select at least one source file, but there is nothing to select (no files appear in the pop up window).
I've tried copy database or backup database, but I do not have suffient permission on the remote server for these.
So many different ways to do it, but all fail!
PLEASE - make a simple way to transfer a database from a remote host and back again. I want to be able to select a database source and destination and have the database copied. PLEASE - at least restore the old way until other options are working first.
View 15 Replies
View Related
Feb 11, 2004
How can I copy the entire database (all the objects from one database to another database)?
thanks in advance.
View 2 Replies
View Related
Mar 5, 2006
Hello,
I am new user of SQL Server. I have some problems with these words. I want to make my database works in my specified permissions. I will specify permissions with schemas and these schema wants an owner. I want this owner should be my user. When creating a user it needs a valid login. I am selecting my login and it occurs and error says this login has an different user. I am specifying permissions with roles. But i can't make association all of them. I hope i told my problem to you as well. If you explain these words to me and tell me how can i do my database's works with my own schemas, users and roles i'll be grateful. Thanks for advices.
Happy coding...
View 4 Replies
View Related
Nov 2, 2007
Hi
I'm trying to copy a s2k db to s2005 64 bit db.
I setup the copy db as a schedule but it keeps failing which invalid object name which i think would suggest that the import table is not there?? even thought it is there I have checked the structure of the table which looks fine.
Does anyone have any ideas to get around this?? Or can I do some other checks?
Many Thanks
Robert
OnError,SEA-SRV-00009,NT AUTHORITYSYSTEM,sea-srv-00008_SEA-SRV-00009_Transfer Objects Task,{524DBB9C-783A-4989-8239-7825B10BF060},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,0,0x,ERROR : errorCode=-1073548784 description=Executing the query "
CREATE view [dbo].[vw_tf_stock_take_scanned] as
select dbo.i_st_stakedt.inputref, dbo.i_st_stakedt.whse, dbo.i_st_stakedt.stockcode, dbo.i_st_stakedt.ticketref,
dbo.i_st_stakedt.bin, dbo.i_st_stakedt.checkqty, dbo.i_st_stakedt.updated, dbo.i_st_stakedt.status,
dbo.i_st_stakedt.createdon, dbo.i_st_stakedt.createdat, dbo.i_st_stakedt.filler
from dbo.i_st_stakedt inner join
dbo.i_st_stakehd on dbo.i_st_stakedt.inputref = dbo.i_st_stakehd.inputref
where dbo.i_st_stakehd.status not in ('X','P')
" failed with the following error: "Invalid object name 'dbo.i_st_stakedt'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: at Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
OnError,SEA-SRV-00009,NT AUTHORITYSYSTEM,SAS_mig,{40DA50FD-2E47-4B84-99D8-6FFDB0A4DD8D},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,0,0x,ERROR : errorCode=-1073548784 description=Executing the query "
CREATE view [dbo].[vw_tf_stock_take_scanned] as
select dbo.i_st_stakedt.inputref, dbo.i_st_stakedt.whse, dbo.i_st_stakedt.stockcode, dbo.i_st_stakedt.ticketref,
dbo.i_st_stakedt.bin, dbo.i_st_stakedt.checkqty, dbo.i_st_stakedt.updated, dbo.i_st_stakedt.status,
dbo.i_st_stakedt.createdon, dbo.i_st_stakedt.createdat, dbo.i_st_stakedt.filler
from dbo.i_st_stakedt inner join
dbo.i_st_stakehd on dbo.i_st_stakedt.inputref = dbo.i_st_stakehd.inputref
where dbo.i_st_stakehd.status not in ('X','P')
" failed with the following error: "Invalid object name 'dbo.i_st_stakedt'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: at Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
OnProgress,SEA-SRV-00009,NT AUTHORITYSYSTEM,sea-srv-00008_SEA-SRV-00009_Transfer Objects Task,{524DBB9C-783A-4989-8239-7825B10BF060},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,0,0x,Database transfer failed for 1 database(s).
OnProgress,SEA-SRV-00009,NT AUTHORITYSYSTEM,sea-srv-00008_SEA-SRV-00009_Transfer Objects Task,{524DBB9C-783A-4989-8239-7825B10BF060},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,100,0x,Transfer objects finished execution.
OnTaskFailed,SEA-SRV-00009,NT AUTHORITYSYSTEM,sea-srv-00008_SEA-SRV-00009_Transfer Objects Task,{524DBB9C-783A-4989-8239-7825B10BF060},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,0,0x,(null)
OnPostExecute,SEA-SRV-00009,NT AUTHORITYSYSTEM,sea-srv-00008_SEA-SRV-00009_Transfer Objects Task,{524DBB9C-783A-4989-8239-7825B10BF060},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,0,0x,(null)
OnWarning,SEA-SRV-00009,NT AUTHORITYSYSTEM,SAS_mig,{40DA50FD-2E47-4B84-99D8-6FFDB0A4DD8D},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,-2147381246,0x,SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
OnPostExecute,SEA-SRV-00009,NT AUTHORITYSYSTEM,SAS_mig,{40DA50FD-2E47-4B84-99D8-6FFDB0A4DD8D},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,0,0x,(null)
PackageEnd,SEA-SRV-00009,NT AUTHORITYSYSTEM,SAS_mig,{40DA50FD-2E47-4B84-99D8-6FFDB0A4DD8D},{91AA3955-85BF-4DA1-B2BC-0A14787BE06D},11/2/2007 11:02:24 PM,11/2/2007 11:02:24 PM,1,0x,End of package execution.
View 10 Replies
View Related
Apr 11, 2007
I'm getting the below error when attempting to copy a database. The view works just fine but the package keeps giving me the below error:
07 3:26:37 PM,4/11/2007 3:26:37 PM,0,0x,ERROR : errorCode=-1073548784 description=Executing the query "
CREATE VIEW [app].[vwbaseTransfer]
AS
Select a.app_id, a.app_year, u.first_name, u.middle_name, u.last_name, app_phoneAM, email, CONVERT(varchar(10), app_dob, 101) as app_dob, app_citizen,
CASE WHEN app_untilDate > GetDate() Then app_addr1 ELSE app_pAddr1 END AS app_addr1,
CASE WHEN app_untilDate > GetDate() Then app_addr2 ELSE app_pAddr2 END AS app_addr2,
CASE WHEN app_untilDate > GetDate() Then app_addr3 ELSE app_pAddr3 END AS app_addr3,
CASE WHEN app_untilDate > GetDate() Then app_addr3 ELSE app_pAddr3 END AS app_addr4,
CASE WHEN app_untilDate > GetDate() Then app_city ELSE app_pcity END AS app_city,
CASE WHEN app_untilDate > GetDate() Then app_state ELSE app_pstate END AS app_state,
CASE WHEN app_untilDate > GetDate() Then app_zipcode ELSE app_pzipcode END AS app_zipcode,
app_sex, app_racecode, app_accept_letter, app_acceptDate, app_orientation_date, app_ssn
FROM applicant a inner join uop_user u on u.id = a.app_id
where app_accept_letter is not null and app_acceptDate is not null
" failed with the following error: "Invalid object name 'applicant'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: at Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
View 11 Replies
View Related
Jun 3, 2004
Hi All,
Could anybody tell me how to make a copy of an entire database on the same server? The copy wizard won't allow the a copy to be made on the same server.
And I believe I won't be able to detach the database and re-attach it to a newly created database with a different name.
Thanks in advance!
View 1 Replies
View Related
Jul 20, 2005
I'm a newbie to script writing. I'm trying to write a script to copy alldata from a table to the same table in a 2nd database. Both databases areon the same server and are identical in design. I can do this with DTS butwanted a script I could email to a user to run in Query Analyzer.Example:Copy entire table called 'Customers' in the 'Data01' database totable 'Customers' in the 'Data02' databaseI want to overwrite all data in the destination table.Thanks
View 1 Replies
View Related
Mar 5, 2008
I have table in my SQL database, I want to copy(or insert) one record(one entire row using primary key, which is auto)
I am thinking something like this
Insert Into Table1 (a, b, c,d,e) values(select a,b,c,d,e from Table1 where Primarykey=1 or any number)
telll me how do I do that
maxs
View 4 Replies
View Related
May 22, 2008
Hello everyone,
This is a new level of complexity for me..
The Boss wants..
1. To control an SSIS package , start, check status, and emergency stop + rollback a package from a web page. Does anyone know of an example or good articles to start with.
2. I have one of the iterations of the data invoke and use a COM object (third party) It will value the items and change a field.
I can always do #2 as a second step but I need all the help I can get on #1.
Thank you,
View 1 Replies
View Related
Jul 12, 2000
HI,
If i transfer logins from one server to another server using dts, I am getting all the logins and permissions... How will i get passwords too..
-thank u.
--Siva
View 2 Replies
View Related
Sep 18, 2000
Does anyone have a sample SQL DMO script to transfer SQL Server logins from one server to another including the passwords ? any pointers will be greatly appreciated
View 1 Replies
View Related
Nov 15, 1999
I would like to know how I can transfer all Login and password and access records from one SQL Server to another, without transferring the databases. I know I can do this via DTS, but I can not figure out the right combination for bringing over the login names. passwords, and roles, with out transferring the databases. The databases have been transfered already via a backup and restore process. Now I need all of the login infomation from the old server to come across. In DTS I go through the Wizard saying to transfer the Master Database from one server to the other, and transfer objects and Data between SQL Server databases. Under the selcet options to transfer page, I uncheck the "Use Default Options" , and on the options page I select all of the "Security options" and deselect all of the "Table options" (Indexes, triggers, keys, etc). The process runs for a short time before bombing out with a failure. I can not find a log file under the Log folder to tell me where it has failed. Can anyone one lend me a hand with this?
TIA
Ken Merrigan
View 2 Replies
View Related
Apr 12, 2006
Hi all
In the process of migration of a database from one SQL 2000 server to another, I am transfering the logins using the microsoft documented script
http://support.microsoft.com/kb/246133/
When i am executing the script on the source server, I am getting the following error.
Server: Msg 195, Level 15, State 10, Procedure sp_help_revlogin, Line 52
'LOGINPROPERTY' is not a recognized function name.
In all the past migrations , I have used this without any issues, but not sure what have changed.
Or am i doing something really stupid.
Can you guys pls execute this in your server and see whether you are able to create the sp_help_revlogin stored procedure.
Thanks in advance
Sreenath
View 3 Replies
View Related
Feb 27, 2006
Could anybody tell me whetherTransfer logins task transfers passwords for logins or not?
View 1 Replies
View Related