Oracle: Extract Graphical Database Representation - database

How can I extract (reverse engineering) a graphical (schema) representation of an Oracle database (tables and their relationships; with colums and datatypes....). Are there (free) tools, which can do this?
I think the Oracle SQL Developer has no such feature...

There is a related Oracle tool, SQL Developer Data Modeler which does reverse engineering and it is free. Find out more.

Sql Developer does this (check the SQL Modeller option) and lots lots more. An amazingly good tool !

For a free tool I recommend schema spy, http://schemaspy.sourceforge.net/.
It needs Java Runtime.
Look to http://schemaspy.sourceforge.net/sample/relationships.html to see diagrams it generate.
This tool is also more suitable to automatic build scripts.
simple usage with oracle hr template is given below.
SET JDBC_ORACLE_JAR=C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.jar
SET CONNECTION_USERNAME=hr
SET CONNECTION_PASSWORD=hr
SET TNS_DATABASE_NAME=orcl
SET SCHEMA_NAME=HR
SET TABLE_NAME='EMP'
SET OUTPUT_NAME=HR_EMP
java -jar schemaSpy_5.0.0.jar -dp %JDBC_ORACLE_JAR% -db %TNS_DATABASE_NAME% -o schemaOutput%OUTPUT_NAME% -u %CONNECTION_USERNAME% -p %CONNECTION_PASSWORD% -i %TABLE_NAME%.* -schemas %SCHEMA_NAME% -hq -noviews -loglevel severe
java -jar schemaSpy_5.0.0.jar -dp %JDBC_ORACLE_JAR% -db %TNS_DATABASE_NAME% -o schemaOutput%OUTPUT_NAME% -u %CONNECTION_USERNAME% -p %CONNECTION_PASSWORD% -schemas %SCHEMA_NAME% -hq -noviews -loglevel severe
First one will give you diagram with tables starting with EMP .
Second one will give you diagram with all tables in hr schema .

Adminer is an awesome PHP single file that should be able to do what you request. I tried only with MySQL, but Oracle it's supported as well.

I'm not aware of any free tools:
MS Visio can reverse engineer (professional/Premium)
TOAD an expensive tool but well worth it IMO

Related

Tool to Generate ER diagrams from Views in SQL Server

Is there any third party tool (free or paid) which could be useful in generating Entity Relationship Diagram from the views in SQL Server 2005/2008 or higher version?
For example,I have a view in my database and I wish to generate ER Diagram based on all the tables that are being referred in the view.
Let me know for any doubts
Thanks!
you can use a Java-based free tool named SchemaSpy. It basically works with any RDBMS as long as it has a JDBC connector.
I have discovered this while scratching my own itch, and also created a detailed post on it. Can be found here: http://blog.kmonsoor.com/generate-er-diagram-from-sql-database/
Summary:
First of all, your system should have Java runtime properly
installed. SchemaSpy is a .jar file. Get it:
http://sourceforge.net/projects/schemaspy/files/
JDBC connector to
you DB. Make sure to match your DBMS version.
Also, SchemaSpy
depends on GarphViz to generate the ER-diagrams, so you need to be
installed it on your system. http://www.graphviz.org/Download..php
target DB instance must be up & running
Now, this command will do the magic:
$ java -jar ./schemaSpy_5.0.0.jar -t pgsql -host 127.0.0.1:5432 -db your_database_name \
-u your_DB_user_name -p your_password -s public \
-dp ./database_specific.jdbc3.jar \
-o output_folder
There are a couple ways to do this, many outlined below. The easiest approach would be to use SQL Server's own diagrammer (described on the link below).
http://msdn.microsoft.com/en-us/library/aa224825(v=sql.80).aspx
Just do it in SQL Server Management Studio:
Connect your DB, open Object Explorer and right click your view and select "Design". This gives you the graphical view designer, which is a pretty good ER diagram of your view.
use mysql workbench. There are tools already provided to generate ER diagram directly from database.

Upload Postgres db on an Amazon VM [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've been given a database which I can't handle with my pc, because of little available storage and memory.
The person who gave me this db gave me the following details:
The compressed file is about 15GB, and uncompressed it's around
85-90GB. It'll take a similar amount of space once restored, so make
sure the machine that you restore it on has at least 220GB free to be
safe. Ideally, use a machine with at least 8GB RAM - although even our
modest 16GB RAM server can struggle with large queries on the tweet
table.
You'll need PostgreSQL 8.4 or later, and you'll need to create a
database to restore into with UTF8 encoding (use -E UTF8 when creating
it from the command-line). If this is a fresh PostgreSQL install, I
highly recommend you tweak the default postgresql.conf settings - use
the pgtune utility (search GitHub) to get some sane defaults for your
hardware. The defaults are extremely conservative, and you'll see
terrible query performance if you don't change them.
When I told him that my pc sort of sucks, he suggested me to use an Amazon EC2 instance.
My two issues are:
How do I upload the db to an Amazon VM?
How do I use it after that?
I'm completely ignorant regarding cloud services and databases as you can see. Any relevant tutorial will be highly appreciated.
If you're new to cloud hosting, rather than using EC2 directly consider using EnterpriseDB's cloud options. Details here.
If you want to use EC2 directly, sign up and create an instance.
Choose your preferred Linux distro image. I'm assuming you'll use Linux on EC2; if you want to use Windows that's because you probably already know how. Let the new VM provision and boot up, then SSH into it as per the documentation available on Amazon for EC2 and for that particular VM image. Perform any recommended setup for that VM image as per its documentation.
Once you've done the recommended setup for that instance, you can install PostgreSQL:
For Ubuntu, apt-get install postgresql
For Fedora, yum install postgresql
For CentOS, use the PGDG yum repository, not the outdated version of PostgreSQL provided.
You can now connect to Pg as the default postgres superuser:
sudo -u postgres psql
and are able to generally use PostgreSQL much the same way you do on any other computer. You'll probably want to make yourself a user ID and a new database to restore into:
echo "CREATE USER $USER;" | sudo -u postgres psql
echo "CREATE DATABASE thedatabase WITH OWNER $USER" | sudo -u postgres psql
Change "thedatabase" to whatever you want to call your db, of course.
The exact procedure for restoring the dump to your new DB depends on the dump format.
For pg_dump -Fc or PgAdmin-III custom-format dumps:
sudo -u postgres pg_restore --dbname thedatabase thebackupfile
See "man pg_restore" and the online documentation for details on pg_restore.
For plain SQL format dumps you will want to stream the dump through a decompression program then to psql. Since you haven't said anything about the dump file name or format it's hard to know what to do. I'll assume it's gzip'ed (".gz" file extension), in which case you'd do something like:
gzip -d thedumpfile.gz | sudo -u postgres psql thedatabase
If its file extension is ".bz2" change gzip to bzip2. If it's a .zip you'll want to unzip it then run psql on it using sudo -u postgres psql -f thedumpfilename.
Once restored you can connect to the db with psql thedatabase.

Oracle public server

I want to learn about oracle, to try some queries and other SQL features of oracle data base, but don't want to install and mess with all realted issues. So my question is - is there any publicly available oracle server, to which I can connect through terminal and play with it?
I mean a service where I can register and some space would be allocated to my profile
Take a look at: http://apex.oracle.com/
The only thing I can think of is SQLFiddle: http://sqlfiddle.com/
But it won't let you have a "private" space. You need to re-create your schema each time (but you can bookmark your script which might be enough for you).
You could also try one of the pre-built virtual appliances - see
http://www.oracle.com/technetwork/community/developer-vm/index.html
If you need direct database access, you can run it in a Docker instance:
docker run -d -p 1521:1521 -p 8080:8080 alexeiled/docker-oracle-xe-11g
Then connect to it with sqlplus
sqlplus system/oracle#localhost:1521/xe
See here for more passwords, info on apex, etc.
Just came across this: Oracle Live SQL. It is browser based so nothing to install locally. But, you need to have an Oracle account.
Browser based SQL worksheet access to an Oracle database schema

How to convert a JET database to SQLite?

I'm a Linux user so an open-source, Linux-friendly solution would be preferable.
MDB Tools is a set of open source libraries and utilities to facilitate exporting data from MS Access databases (mdb files) without using the Microsoft DLLs. Thus non Windows OSs can read the data. Or, to put it another way, they are reverse engineering the layout of the MDB file.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.
ACCESSdb is a JavaScript library used to dynamically connect to and query locally available Microsoft Access database files within Internet Explorer.
Both Jackcess and ACCESSdb are much newer than MDB tools, are more active and has write support.
This is probably not the answer you want but the safest way to do this would be to get Visual Studio Express and read in the database using ODBC connector and then writing out the data using the ADO.NET Sqlite connector. I have found generally third party tools to talk to JET databases... JET waas aweful and never easily reverse engineered.
To complement Tony's answer with examples:
This is how I just did a conversion with MDB Tools to sqlite, in Ubuntu 16.04:
sudo apt install mdbtools
# define variables for easier copy/paste of the rest
in="my-jet4-file"
schema="$in-schema.sql"
out="$in.sqlite"
mdb-schema "$in" sqlite > "$schema"
sqlite3 "$out" < "$schema"
mdb-tables -1 "$in" \
| while read table; do \
mdb-export -I sqlite "$in" "$table" | sqlite3 "$out"; \
done
This uses Insert statements and is quite slow.
A faster alternative would be to export/import .csv files. I had used that sucessfully with Postgres:
#...
out="my_pg_db"
createdb "$out"
mdb-schema "$in" postgres > "$schema"
psql -U postgres -d "$out" -f "$schema"
mdb-tables -1 "$in" \
| while read table; do \
mdb-export -d'|' "$in" "$table" > "$table.csv"; \
psql -d "$out" -c "COPY \"$table\" FROM '$table.csv' DELIMITER '|' CSV HEADER"
done
Finally, there is also mdb-sqlite, which uses Jackcess and Java. After installing Java and ant:
cd mdb-sqlite-1.0.2
ant dist
java -jar dist/mdb-sqlite.jar "$in" "$out"

Generating DDLs for Sybase tables and indexes

I'm looking for a command line tool to generate DDL for both tables and indexes (nothing more complicated is needed) for some Sybase tables in databases that I take care of. I have access to GUI tools for viewing the individual DDLs, and I could cut and paste them, but I would like something that will go through all the tables in a database and generate some nice text files that I can get checked into CVS.
I tried using a tool called ddlgen, which was provided by Sybase, but it just threw exceptions like this:
bash-3.00# ./ddlgen -SdatabaseServer:4100 -Uusername -PsecretPassword -TDB -NdatabaseName
U64: null: databaseName.dbo.firstTable
U64: null: databaseName.dbo.firstTable
at com.sybase.ddlgen.container.UserTableContainer.getDependentDDL(UserTableContainer.java:1065)
at com.sybase.ddlgen.container.UserTableContainer.open(UserTableContainer.java:1364)
at com.sybase.ddlgen.container.UserTableMetaContainer.open(UserTableMetaContainer.java:94)
at com.sybase.ddlgen.container.DDLBaseContainer.load(DDLBaseContainer.java:76)
at com.sybase.ddlgen.container.DatabaseContainer.addChildren(DatabaseContainer.java:552)
at com.sybase.ddlgen.container.DatabaseContainer.open(DatabaseContainer.java:104)
at com.sybase.ddlgen.container.DatabaseMetaContainer.open(DatabaseMetaContainer.java:114)
at com.sybase.ddlgen.DDLThread.run(DDLThread.java:89)
which wasn't very helpful. I keep thinking that there must be a nice Perlish way to do this, but I don't know what that would be.
You can also use the Perl-based dbschema.pl
http://www.isug.com/Sybase_FAQ/ASE/section9.html#9.3.2
use below command to get deffination
defncopy -P tester1 -S sqppdb2 -U pmestr -D ppdb2 -o tab4 ppdb2..tab4
Thanks
Download an evaluation version of Embarcadero DBArtisan and use its extract feature to get the DDL out.
You can turn Logging on in DBArtisan (Logfile ->Log SQL) and then see what SQL it's sending to Sybase to get the table DDL. Copy and paste the SQL in the logfile to a script that you run from the command line and that might work.
Apologies in advance if you are not using Windows...DBArtisan is Windows-only.
Another way of doing this is MyGeneration a code generator (like CodeSmith but open source) which uses templates to create code. That code could be anything you like - Sql, C# etc. I use Sql Server and I've used some of the freely available templates to create DDL as you specify, and automagically create NHibernate Mapping files too - brilliant.
ddlgen will give you what you require and works very well. You seem to be having an enviroment issue with Java. Try again and post the error that you have in it's entirety.

Resources