I am upgrading / modifying my existing SQL Server 2005 database.
I would like to rename tables, change relationships in the schema and eventually migrate the data from the old tables to the new ones.
I was thinking of writing a script to :
change the constraints, table names
create the new tables
3 migrate the data from the old tables to the new ones
4 delete the old tables.
Are there any third-party tools I can use to migrate or can I do this with SQL Server DTS ? What is the best approach?
Related
I am able to migrate automatically selected tables (actually 132 - we don't want to migrate all 1890, because most of them are useless for us) from a specific schema from DB2 to SQL Server 2019 database using SSMA console.
I need to get the primary keys as well. Unfortunatelly the PKs are in the QSYS and/or SYSIBM schema (I can found it thanks these links - IBM i DB2 catalog tables / search for UNIQUE Keys from Physical Files and/or AS400 index configuration table or https://www.ibm.com/docs/en/i/7.3?topic=views-sqlspecialcolumns).
Is there any possibility how to migrate this PKs together with the tables using SSMA console?
If not - which preferences should I set and which values of these preferences should I set in the xml configuration file for SSMA console so that it doesn't refresh the structure of the migrated tables in SQL everytime?
(probably some of the following:
<sql-server><synchronization sync-query-timeout="5" attempt-count="10" db-object-changed-decision="refresh" local-object-changed-decision="commit" both-objects-changed-decision="commit" phantom-object-decision="refresh" /></sql-server>
)
I can set PKs in SQL, but the tables in SQL are refreshed when I run the SSMA console migration because the PKs on tables in SQL make the DB2 tables difference. Nevertheless I need to check the structure of the tables everytime, because some new columns are added to some tables sometimes and we need the new columns too (with PKs again).
I have an old ERP, which handled many organizations in a single db with a suffix on the tables. Lets say the db name is ORG and the tables look like CLIENTS01, CLIENTS02, CLIENTS03.
The new ERP connects to one database per organization.
The sad thing is I need to use both ERPs, so I need to replicate SAME DB WITH MULTIPLE NAMES: ORG01, ORG02, ORG03.
I was thinking for mirroring but this will increase database workload.
I looked for aliases but didn't find the way to make it work on the same instance.
I tried to create new database and then attach same file MDF file without success.
What would be the simplest way to just create 3 new databases connecting to the same database (1 database, multiple names)?
I have two IBM DB2 databases A and B with different database schemas. Database A schema is older, and database B schema is newer. I would neet to create SQL alter scripts that can update A schema to match that of B schema. This can ofcourse be done manually, but is there a tool that could analyse the two databases and do this for me?
I am using the free IBM Data Studio client for querying the database. Can the above operation be done using this tool?
Redgate sql compare is one of tge bests.
I have a 5 database with same schema, i want to copy all data in one database with same schema
or how can i copy data from *.mdf files in database.
i am using sql server 2005
Copy Database with T-SQL:
sqlauthority
http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/
Copy Database with Wizard:
kodyaz
http://www.kodyaz.com/sql-server-tools/sql-server-copy-database-wizard.aspx
I'd suggest taking a look at Red Gate SQL Data Compare. That will enable you to merge the data between the two databases and directly control which one wins in any given situation.
As mentioned above you need to deal with the Primary Keys as well...
One way to deal with this to add a "Database ID" to all the tables in the single central version. The central PKs become the PK from the source table, plus the "Database ID". This way you have unique PKs in the central version AND you can tell which database the row came from. This is what sql-hub does - there is a free licence which will let you do this as a one-off task - or you could do the inserts for each database and table in SQL.
I would like to know which one is the best approach for migrating existing DB data to another new DB with entirely different structure. I want to copy the data from my old DB and need to insert the data in new DB. For me the table names and column names of new DB is entirely different. I am using SQL Server 2008.
You should treat this as an ETL problem, not a migration, as the two schemas are entirely different. The proper tool for this is SSIS. SSIS allows you to create dataflows that map columns from one table to another, add derived sources, perform splits, merges, etc. If possible you should create source queries that return results close to the schema of the target database so you need fewer transformations.
In this you have to migrate most of the parts manually by running scripts. AFAIK automatically it will not synchronize. But using SSMS you Map tables of two different db's. hope that will help.