How do I import an 11g dump into Oracle 12c - oracle12c

We use to run this command to import a DB in 11g:
impdp system directory=DATA_PUMP_DIR dumpfile=ourdb.dmp full=n
password: ourpassword
Now I am trying to run this in 12c:
impdp system/Oracle_1 directory=DATA_PUMP_DIR dumpfile=ourdb.dmp nologfile=Y
But it is saying the User doesn't exist so everything is failing.
In 11g it would just create the USER from the schema it was importing.
What's going on in 12c?
I read you have to make sure you are connected to the pdb.
So if I connect to the pdb:
sqlplus sys/Oracle_1 as sysdba;
I am now at an SQL Prompt.
Now if I run:
impdp system/Oracle_1 directory=DATA_PUMP_DIR dumpfile=ourdb.dmp nologfile=Y
It says, this is not an sqlplus command. You have to run it from a regular command line.
So if I go back to a regular command line I am not connected as I am no in SQLPus. I don't get this.
Can anyone tell me the steps here?
I can't find a good doc to guide me through this.

The issue is with the connect string supplied to impdp. In a regular DB like Oracle 11g the connect string is straight forward.
For example:
impdp system/manager ...
But in case of Oracle 12c, which is a multi-tenant database. We need to supply the container in the connect string.
For example:
impdp system/manager#pdb1 ...
Also, note that impdp is an external Oracle tool. Its not a SQL*Plus command.

Related

How do I launch postgresql on terminal without using homebrew? (SQL state: 42501, trying to import CSV to pgAdmin4 with COPY)

I am unable to import a CSV with postgres(v12) into pgAdmin4 using the copy command.
COPY revenue
FROM "../Desktop/Home/revenue.csv"
DELIMITER ','
CSV HEADER;
The result I get is:
ERROR: could not open file "../Desktop/Home/revenue.csv" for reading: Permission denied
HINT: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.
SQL state: 42501
I found article
How to import a CSV file into PostgreSQL using Mac
but it was unsolved and I already tried ging the user 'postgres' 'read and write' permissions. Maybe I did it wrong, I right clicked on the CSV file and I also tried giving it permission in pgAdmin4 (properties, default privileges)
I found the solution below suggesting I launch postgres from my command line
Postgres ERROR: could not open file for reading: Permission denied
However everything I read on launching postgres on a mac via command line includes homebrew. I didn't install postgresql with homebrew.
-Can I launch postgres on a mac without using homebrew?
If I install homebrew, will it work to launch postgresql even if I didn't use it to install postgres initially?
-Is there another way to use the copy command via pgadmin ? (I tried using dbeaver but it wouldn't connect to my database)
I am super lost.
Thank you!

run \dt in oracle sqldeveloper for PostgreSQL

I configured PostgreSQL for Oracle SQL developer.
I just tried to run the command \dt; from the worksheet and received below error
Error starting at line : 1 in command -
\dt
Error report -
SQL Error: ERROR: syntax error at or near "\"
Position: 1
Could you please advise how to run the commonly used psql commands from worksheet in Oracle SQL developer.
Edit1:
Are there any alternative equivalent for such psql command for oracle sql developer please. Thanks.
Doesn't SQL Developer offer a GUI view that provides the same info as \dt does? That is its job, afterall, and the point of using a GUI.
You can start psql with the -E option, then it will show you the SQL it executes to get the data behind the various backslash commands. You can then capture and run those queries in something else, like (presumably, I haven't tried it) SQL Developer.
You cannot do that.
psql commands are only available in psql.
Consider using psql, it is superior.

Oracle 12c Does Not Check Password While Connecting Sys

I downloaded Oracle 12c from website and installed it. In gave Sys password as "admin", all the setup was done successfully.
now, on the command prompt, i issue the following commands..
SQLPlus /nolog
I get the SQL>
i then say "connect sys/nimda#orcl as sysdba and it gets connected successfully.
I try to connect to 12c will all sorts of invalid passwords and it still works.
Funny, isn't it?
When you log on to the database server and that user is member of the operating system's DBA group, then - when connecting to that (local) database - you're authenticated at the operating system level and you can connect just as you tried it - with an invalid password.
You could also try, for example, sqlplus littlefoot/mukesh as sysdba, and it should work.

How to connect to heroku pg from local machine?

This document says to set DATABASE_URL=postgres://$(whoami) this to maintain parity between local and pro dbs. But what should I replace "whoami" with?
I have installed PostGreSql on my machine. How to I perform CRUD operations?
That whoami will return username of the current user when invoked. As the documentation said, you just need to type the below in command prompt (no need to replace whoami), depends on your OS:
Linux / Mac:
export DATABASE_URL=postgres://$(whoami)
Windows:
set DATABASE_URL=postgres://$(whoami)
After set up Postgres, you can use psql client to access the database. As you asked in comment regarding how to run .sql file, here's the steps:
In command prompt, type "psql". You are now connected to your database.
Inside psql, type "\i your_sql_file.sql". This execute the your_sql_file.sql file.

How recover sybase database (unknown db version)

I have a database file (*.db) that need to be recovered.
The bad is, the end-user have null idea of the version of the database. Not know the password. The original developer is lost. The computer where was installed was formatted. We have not experience in this database software. Yeah, nightmare.
My guess is a old database. I'm trying to open it in Sybase 11, dev edition.
I follow this steps: http://dcx.sybase.com/1101en/sachanges_en11/unloading-reloading-upgrading-newjasper.html
I try to use the UNLOAD utility from command line & from the Sybase central utility. From command line I do:
./dbinfo -c "DBF=/Users/mamcx/Downloads/CEMDE_ENDOCRINO_S.A.DB;UID=DBA;PWD=sql"
SQL Anywhere Information Utility Version 11.0.1.2045
Unable to start specified database: '/Users/mamcx/Downloads/CEMDE_ENDOCRINO_S.A.DB' was created by a different version of the software
Ok, I try to unload:
./dbunload -c "DBF=/Users/mamcx/Downloads/CEMDE_ENDOCRINO_S.A.DB;UID=DBA;PWD=sql" -n /Users/mamcx/Desktop/
SQL Anywhere Unload Utility Version 11.0.1.2045
Connecting and initializing
***** SQL error: Unable to start database server
Ok, from the server admin tool:
dbunload -v -c "UID=dba;PWD=***;DBF=/Users/mamcx/Downloads/CEMDE_ENDOCRINO_S.A.DB" -an "/Users/mamcx/Desktop/baba.db" -ap 4096 -ea None -ii -sa -so _sc866192545
Connecting and initializing
***** SQL error: Unable to start database server
An error occurred while attempting to unload the database '/Users/mamcx/Downloads/CEMDE_ENDOCRINO_S.A.DB'.
Exist a way to know the version of the database server used to create this? Is possible to recover this file?
I don't know how to get the version out of the Database File if you are not able to start it.
You could get a hint from the hopefully existing Client PC's. Check the ODBC Driver Version they have installed.
I had good success with the support of Sybase. If you or your client has a support contract you can get them involved.
HTH
Try to simply start a server with that database and capture the output with -z -o server.out. The server.out file should contain a more specific error telling you why it can't start the database. This error can occur if you are trying to start something that is not a SQL Anywhere database.
You may also want to post this question over at http://sqlanywhere-forum.sap.com/.