I am using Toad. Frequently i need to compare tables in two different test environments.
the tables present in them are same but the data differs.
i just need to know what are the differences in the same tables which are in two different data bases.Are there any tools which can be installed on windows and use it to compare.
Take a look at SQL Compare and SQL Data Compare
There's a compare tool built into TOAD. Tools | Compare Data.
Open Source DiffKit will do this:
www.diffkit.org
I would definitely go with AdeptSQL if you're using MSSQL. It's the least good looking but the most talented db compare tool amongst the ones I've tried. It can compare both the structure and the data. It tells you which tables exist on one db but does not exist on the other, compares the structure and data of the common ones and it can produce the script to synchronize the two. It's not free but has a 30 day trial (as far as I can remember)
Try dbForge Data Compare for SQL Server. It can compare and sync any databases, even very large ones. Quick, easy, always delivers a correct result.
Try it on your database and comment upon the product.
If you want to do it online, there is a free tool DB Matcher where you upload 2 .SQL files and it gives you the differences
https://dbmatcher.com
Related
I have two databases, which are basically identical running on the same machine.
I would like to compare the records in a table on database A vs the same table in database B
I would like to know which records exist in the table on database A that do not exist in the same table on database B.
Database A = "RICSTOREV341"
Database B = "RICHOSTV341"
The table is "Price_Tab"
The columns I would like to pull are F01, F26, F27, F19, F38
Can this be accomplished?
Yes, this can be done.
You could use something like a three part identifier to identify the tables in different database. Kinda like this :
RICSTOREV341.dbo.Price_Tab
Then you can perform a join on the primary key and fetch the result.
Besides the solutions above - I can also suggest using some 3rd party tools for performing data comparison, and most of them have a fully functional free trial (like SQL data comparison tools from ApexSQL or Redgate).
These tools can help you save lots of time, as they can do data comparison and synchronization in just a couple of clicks.
Hope I helped.
I am using Oracle 11g. My requirement is to compare the data of two different db's. There are around 350 tables in each db and out of these 350 tables, approx 40 tables have more than 1 million records. For data comparison, I wrote one perl script to compare using hash and tested with few files. Also, tried with unix awk command to check the performance and asked this forum on unix solution and got excellent help.
Now my problem is to find out the best way to extract data from Tables to files.
Both db's have same number of tables and each table will have same number of columns in both db i.e. the layout in both the db's is exactly the same.
options which i think and searched are
1) using sqlloader - I think performance will be bad in this case
2) using data pump - Not sure if i can extract few set of columns via sql by using data pump and load into text file
3) using bulk collect -- same as above. Is it possible to extract each table and from each table set of columns. if yes, how can it be done. Also what would be the performance.
4) sqlplus or anything else. I cannot download any software for this on my machine.
Basic sql for selecting set of columns from each table for both the db's can be done easily. I am looking at the best approach to export data into flat files.
Please suggest
You can do it in the database using DBMS_COMPARISON.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_comparison.htm#CHDHEFFJ
The fundamental approach that is the least expensive (to the developer for sure) is to compare sets of things rather than string evaluations of files. Nothing can compare sets of things faster (and in less code) than the database itself. The use of database links and a wise use of the MINUS and INTERSECT operators is very powerful means towards this end.
Try using the below SQL this should be the fastest approach as you will be working inside the database. Access the table over the DB link in other database.
select *
from
(
( select * from Table_In_Schema1
minus
select * from Table_In_Schema2)
union all
( select * from Table_In_Schema2
minus
select * from Table_In_Schema1)
)
In SQL server 2008 I have some huge tables (200-300+ cols). Every day we run a batch job generating a new table with timestamp appended to the name of the table.
The the tables have no PK.
I would like a generic way to compare 2 rows from two tables. Showing which cols having different values is sufficient, but showing the values would be perfect.
Thanks a lot
Thanks for the answers. I ended up writing my own C# tool to do the job - as I'm not allowed to install 3rd party software in my company.
There are several tools that do this for you.
My favorite is Red Gate SQL Compare.
If you don't have the money use the open source solutions. There are several
DB Compare
OpenDBDiff
You could create RPT files from SELECT queries then use Beyond Compare to see the differences.
Also, red-gate has some tools to compare database tables, but I think they're expensive.
When you need to compare two tables to see what the differences are, are there any tools or shortcuts you use, or do you handcode the SQL to compare the two tables?
Basically the core features of a product like Red Gate SQL Data Compare (schemas for my tables typically always match).
Background: In my SQL Server environment, I created a stored procedure which inspects the metadata of the two tables/views, creates a query (as dynamic sql) which joins the two tables on the specified key columns, and compares data in the compare columns, reporting key differences and data differences. The query can either be printed and modified/copied or just excecuted as is. We are not allowed to create stored procedures in our Teradata environment, unfortunately.
Sounds like a data profiling tool such as Talend's Open Profiler would make the most sense at that point.
You could write a BTEQ statement that builds the query similar to your SQL Server stored procedure and then export the dynamically built SQL. You can then in turn run that inside of your BTEQ. It might get cumbersome, but with enough determination you could probably mock something up.
I dont know if this is the right answer you are searching for.
sel * from database_name1.table_name1
minus
sel * from database_name2.table_name2;
you can do the same by selecting specific columns. This will basically give the non existent rows from table2 which are in table1.
If you were not looking for this type of answer, please ignore this and continue.
Also you can select like below.
select
table1.keycol1,
table2.keycol2,
(table1.factcol1 - table2.factcol2) as diff
from table1
inner join
table2
on table1.keycol1 = table2.keycol1
and table1.keycol2 = table2.keycol2
where diff <> 0
This was just an analysis which can give an idea. Please ignore any syntactical and programmatical errors.
Hope this helps.
Given two sqlite databases A and B, is there a tool that can generate SQL commands that will convert A to B (or vice versa)? This must included insertions, deletions, and updates - and maybe also table alterations (though that's not important to me).
Possibly this tool is not even sqlite-specific.
Could this be what you are looking for?
SQLite Compare
Not sure what you mean by
Possibly this tool is not even
sqlite-specific.
But a Sql Server specific one is available too.
SQL Data Compare
CompareData will let you visually compare two sqlite databases and/or sync them or generate a sql sync script. Free for comparing the data, requires license after 30-day evaluation period expires for sync/generate sql sync script
try this SQLite-Compare-Utility