How to import oracle databse into postgres with dbLink - oracle

I have postgres database on server A & oracle database on server B.
I would like to import the data of oracle to postgres using dbLink.
I have achieved this for Postgres to Postgres database, but now I would like to do this with oracle.
So
I have achived postgres to postgres migration with following command.
SELECT realestate.address, realestate.parcel, s.sale_year, s.sale_amount,
FROM realestate INNER JOIN
dblink('dbname=dbdelv port=5432 host=someserver
user=user password=pwd',
'SELECT parcel_id, sale_year,
sale_amount FROM parcel_sales')
AS s(parcel_id char(10),sale_year int, sale_amount int)
ON realestate.parcel_id = s.parcel_id;
How can I do the same for oracle? and what will be db Link?

dblink is for PostgreSQL only, it won't be able to connect to Oracle.
But you can use something that is even simpler, oracle_fdw, which is a foreign data wrapper for Oracle.
Download the code and follow the README to compile and install oracle_fdw.
Once you have created a foreign server and a user mapping, you can create a foreign table that will look and feel just like a normal PostgreSQL table, but the data reside in Oracle. You can use it in queries with joins like the one you showed in your question.

Related

How to remove database name from the user/schema name in oracle after migration from SQL Server to Oracle?

We are migrating our database from SQL Server to Oracle using the SQL developer tool. While migration, the schema name in SQL Server is "schmdw". This schema is used in our datawarehouse or OLAP database AdvworksDW. After migration we were expecting the schema/user name in oracle will be schmdw. But it is coming as schmdw_AdvworksDW i.e. schemaname_databasename. How can we get rid of this and get the schema/user name in Oracle as schmdw only? Can anyone help me in this regard?
In Oracle, there's no supported way to rename a schema/user. The best solution for you is to create another user, SCHMDW in your case, and give it grants on all objects of the SCHMDW_ADVWORKSDW plus synonyms. Have a look at the second comment on this post, it gives a pl/sql script to automate that.

How to migrate(convert) database(or just tables) from PostgreSQL to Oracle using only Oracle tools?

Data was sent to our company with PostgreSQL, but we are prohibited to use the tools of PostgreSQL , permitted the use of only Oracle.
How to migrate data from PostgreSQL to Oracle without using a third party application(they are also prohibited)? You can only use the tools of Oracle.
I found this article https://support.oracle.com/knowledge/Oracle%20Database%20Products/2220826_1.html but we don't have Support Identifier
We have one .sql file. It weighs 8 Gigabytes.
It looks like you have so many impediments in your company. Regarding Oracle's SQL Developer Migration Workbench, unfortunately it does not support the migration of PostgreSQL databases. However, the following 3rd-party software tools are available and may assist in migration, but I am afraid you cannot use them as you said that those products are forbidden:
http://www.easyfrom.net/download/?gclid=CNPntY36vsQCFUoqjgodHnsA0w#.VRBHKGPVuRQ
http://www.sqlines.com/postgresql-to-oracle
Other options will only move the data from your Postgresql database to Oracle database, it means that you must have the DDLs of the tables before to run the import:
To move data only, you can generate a flat file of the the
PostgreSQL data and use Oracle SQL*Loader.
Another option to migrate data only is to use Oracle Database
Gateway for ODBC which requires an ODBC driver to connect to the
PostreSQL database, and copy each table over the network using
sqlplus "COPY" or "CREATE TABLE AS SELECT" commands via oracle
database link.
Also, Oracle has discussion forum for migrating non-oracle databases to Oracle.
http://www.oracle.com/technetwork/database/migration/third-party-093040.html
But, if you have only a sql file, you should look at it to see whether you have both DDLs ( create tables and indexes, etc ) and the data itself as insert statements. If so, you need to split it and treat the DDLs to convert the original data types to Oracle datatypes.

How to query tables and pull data into an Oracle APEX application from another schema?

I am working in an Oracle APEX application and am trying to query tables in another schema (that another Oracle APEX application sits on) to pull in data to my application.
The applications are hosted within the same APEX workspace and on the same Oracle 11g instance. Our application have tables that are structurally the same as the tables we're trying to query in the other schema.
Using the schema prefix (SELECT * FROM "SCHEMA2".TABLE1;) when querying is throwing an error that the tables do not exist (ORA-00942: table or view does not exist)
The second thing I tried is creating a database link between the two schemas, but when trying to establish the connection I'm getting the following error: ORA-01031: insufficient privileges
Can someone identify where I'm going wrong here / help me figure out how to query the other schema?
Database link is used when there are different databases involved; your schemas reside in the same database which means that the first attempt was correct: prefixing table name with its owner, e.g.
SELECT * FROM SCHEMA2.TABLE1
However, first connect as schema2 user and issue
grant select on table1 to schema1;
Otherwise, schema1 can't see the table. If schema1 is supposed to do something else with that table, you'll have to grant additional privileges, such as insert, update, delete, ....

Creating SQL compact database from Oracle database

We have Oracle database and need to create client with SQL compact, we will need synchronize data between them in future. How can we create SQL compact database from Oracle database(maybe somehow exporting schema etc.) ?
You could use the SQL Server Migration assistant to move to SQL Server, and then use Export2sqlce to create schema (or schema and data) - http://exportsqlce.codeplex.com

Oracle vocabulary, what is the mysql/SQL Server equivalent of a database

I need some help with vocabulary, I don't use Oracle that often but I am familiar with MySQL and SQL Server.
I have an application I need to upgrade and migrate, and part of the procedure to do that involves exporting to an XML file, allowing the installer to create new database tables, then import to the new database tables from the XML file.
In Oracle, my database connection specifies a username, password, and an SID.
Let's call the SID, "COMPANY-APPS". This SID contains tables belonging to several applications, each of which connects with a different user ( "WIKIUSER", "BUGUSER", "TIMETRACKERUSER" ).
My question is:
Can I re-use the same user to create the new tables ( with the same names ).
In MySQL or SQL Server, I would create a new database and grant my user privileges to create tables in it.
OR, do I need to create a new database user for my upgraded tables?
The word you are looking for is Schema in Oracle. When you create a user they have a schema associated with them, so if I created the user 'Tim' and a table called 'data' then it can be found globally (in that database) as Tim.data

Resources