ora2pg fails to connect but sqlplus works - oracle

I am using the setup from https://oracle-base.com/articles/19c/minimum-viable-oracle-database-19c-installation-on-ol8#download-software that does this:
sqlplus / as sysdba <<EOF
alter session set container=ORCLPDB1;
create user testuser1 identified by testuser1 quota unlimited on users;
grant connect, resource to testuser1;
exit;
EOF
Login to the DB is successful with:
sqlplus testuser1/testuser1#//localhost:1521/ORCLPDB1
But with an ora2pg.conf file set up thusly:
ORACLE_DSN dbi:Oracle:host=localhost;service_name=ORCLCDB;port=1521
ORACLE_USER testuser1
ORACLE_PWD testuser1
...I fail to login. I have tried
Changing the DSN and it properly says it cannot find the database at all; good
Changing the service_name and it says no such service exists; good
Trying both service_name=ORCLCDB (as it appears in tnsnames.ora) and service_name=ORCLCDB1 in the ORACLE_DSN. ORCLCDB waits for a bit then fails; ORCLCDB1 fails fast with:
FATAL: 12514 ... ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBD ERROR: OCIServerAttach)
The ora2pg.conf is a copy from the dist version with just DNS, USER, and PWD changed.
Any ideas?

Service name of your pluggable database is ORCLPDB1, so use it instead of CDB service name(ORCLCDB):
ORACLE_DSN dbi:Oracle:host=localhost;service_name=ORCLPDB1;port=1521
ORACLE_USER testuser1
ORACLE_PWD testuser1

Related

ORA-12514 TNS:listener does not currently know of service requested in connect descriptor in oracle 11g

Already read all the question related to this error, but couldnt resolve the issue.
As of yesterday, the oracle SMALLWORLD service has stopped working and the error is
ORA-12514 TNS:listener does not currently know of service requested in connect descriptor
the following are the system information to better understand the situation:
LISTENER.ORA content :Listener.ora
TNSNAMES.ORA content :TNSNAMES.ORA
SQLNET.ORA content :SQLNET.ORA CONTENT
the following is the result of
LSNRCTL SERVICES
command.
LSNRCTL.SERVICES result
as you can see the service name ATTACHMENTDB is recognisable, but service SMALLWORLD is not.
while trying to logon with sysdba, the result is
ORA-01017 invalid user name/password; logon denied
while trying to logon with SYSTEM user, the result is
ORA-01034 : ORACLE not available
and
ORA-27101 : shared memory realm does not exist
below image, is the result of SQLPLUS /NOLOG command
SQLPLUS /NOLOG
i already tried stopping and starting the ORACLE services and the Listener in the SERVICES.MSC, but nothing worked.
i don't understand why ATTACHMENTDB service works but not the SMALLWORLD service.
any hint appreciated.
I have this problem in windows 10 and Oracle19C.
You should try the following ways and one of them may work for you.
Way-1: In windows: use this video: restart services OracleOraDB19Home1TNSListener then OracleServiceORCL.
Way-2: connect with system user password to sql plus as shown as:
Enter user-name: system/ as sysdba
Enter password: your_password
SQL> shutdown
SQL> startup nomount
SQL> alter system set db_recovery_file_dest_size=4G scope=both;
SQL> alter database mount;
SQL> alter database open;
And now check your problem fixed? If no set below code then check again.
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=127.0.0.1) (PORT=1521)))';
This work for me.

DB2 Express in MAC SQL0805N issue

I have db2 express on mac, db2start works, and db2 connect works.
However when I do anything on the database it gives me an error (eg. db2 list tables):
SQL0805N Package "NULLID.SQLC2J23 0X4141414141564962" was not found.
SQLSTATE=51002
I try doing this:
/Users/myuser/sqllib/bnd> db2 bind #db2ubind.lst blocking all grant public
And get these errors:
LINE MESSAGES FOR db2ubind.lst
------ --------------------------------------------------------------------
SQL0061W The binder is in progress.
LINE MESSAGES FOR db2ajgrt.bnd
------ --------------------------------------------------------------------
SQL0551N "TESTDB" does not have the required authorization or
privilege to perform operation "BIND" on object
"NULLID.SQLABJ02". SQLSTATE=42501
LINE MESSAGES FOR db2ueiwi.bnd
------ --------------------------------------------------------------------
SQL0551N "TESTDB" does not have the required authorization or
privilege to perform operation "BIND" on object
"NULLID.SQLUAJ19". SQLSTATE=42501
I also already did this (which seems to not help):
sudo chown root /Users/$(whoami)/sqllib/security/db2ckpw
sudo chmod u+rxs /Users/$(whoami)/sqllib/security/db2ckpw
sudo chmod o+rx /Users/$(whoami)/sqllib/security/db2ckpw
Did I miss something?
#client
> db2level
DB21085I Instance "blahblah" uses "64" bits and DB2 code release "SQL10010"
with level identifier "0201010E".
Informational tokens are "DB2 v10.1.0.0", "s120905", "DARWIN64101", and Fix
Pack "0".
Product is installed at "/Users/username/sqllib".
#server
Instance server = DB2/AIX64 10.5.5
Is it not possible to connect from a 10.1 client to 10.5.x server?
The meesage says that you do not have the BIND right in the database.
So ask your DBA to grant you the bind right and redo the bind command.
The DBA has to issue
grant bindadd on database to user testdb
grant bind on database to user testdb
Alternatively the right could be granted to a group or role or the DBA has to run the bind under his authority.

How to connect to oracle with sys and sysdba correctly?

I want to connect to oracle as sys user with sysdba privil..
How can I do it using easy connection
I am doing so:
sqlplus sys/password#server:1521/orcl as sysdba
and getting error:
ORA-01017: invalid username/password; logon denied
Is it correct syntax?
Thanks.
You are trying to connect remotely as sysdba (port 1521 in your case). Connecting as sysdba from a remote location (over tcp or tcps) requires some extra steps:
Set the database parameter REMOTE_LOGIN_PASSWORDFILE = { shared | exclusive | none }.It should be set tp shared/exclusive.
Check your password file under $ORACLE_HOME/dbs/, which is being used for authentication when users login to the database as a sysdba. If the password file does not exist then create a new one (using orapwd) and set the password.

Error while restoring oracle 10g .dmp file in oracle database 12c

I've got a .dmp file created with Oracle 10g containing the database of one of my clients. I can't for the life of me get it set up with my 12c installation. I can connect to my db using https://localhost:5500/em
I've created a user 'BOB' in my desired PDB and granted import, read and write permissions. Next I try to import using the following command:
impdp BOB/password#//localhost:1521/pdbname full=y directory=dpdump_dir dumpfile=BOB.dmp
However this gives me the following errors:
UDI-12541: operation generated ORACLE error 12541
ORA-12541: TNS:listener does not currently know of service requested in connect descriptor
In the listener.ora and tnsnames.ora i have EZCONNECTOR and ports 1521. Does anyone know how to get this to work?
Many thanks in advance,
Bob
First ensure that you can do tnsping for pdbname to ensure db connect :- $ tnsping bdbname
If you get details of connection string by tnsping, you can try command with following format:
impdp bob/password#127.0.0.1:1521/pdbname directory=dpdump_dir dumpfile=BOB.dmp
I have removed "full=y" as it's not required if you are not restoring full database, specially it used apply with imp/exp utility.
You should remember that pdbname is being specified as a dbname/service_name in your example. You can confirm service_name by following command:
$ lsnrctl services; /* You can get service name and put it on your impdp command. */
In addition, you can try without specifying ip,port and dbname as you are working in localhost itself:
$ impdp bob/password directory=dpdump_dir dumpfile=BOB.dmp
First of all, you should check the connection
sqlplus> BOB/password#localhost:1521/pdbname
If you cannot connect, please connect with sys / as sysdba
Then using command:
SQL> alter session set container=pdbname
SQL> alter pluggable database pdbname open
Then quit and try to your command again. :)

Unable to log in to database as SYS with Oracle SQL Developer

I've worked with Oracle for some time but very much a noob with the Admin side of things and am learning, so bear with me.
I cannot log on to my database (orcl_test) with SQL Developer with the SYS username. I can log on just fine in SQLPlus with SYS as SYSDBA - when I try with SQL Developer I get an error:
ORA-01017: invalid username/password; logon denied.
Logging on as SYS as SYSDBA in SQLPlus, I created a test table within the database and granted the test user SCOTT with SELECT permissions. The Scott user can log on through SQL Developer w/o problem and access the allowed tables.
I have checked that the Scott user and SYS are logging in using the same settings -
Hostname: (ip address)
Port: 1521
SID: orcl_test
For SYS I flag the role SYSDBA - but otherwise the settings are the same.
Any thoughts on why I can't log on using SYS? Am I just overlooking something or have I configured my db incorrectly?
Not sure if this is relevant but I cannot use 'localhost' for the hostname, I have to enter the IP address. Where do I configure Oracle to recognize localhost?
This is a new installation of Oracle 11.2.0.1.0 on a standalone test box running Windows XP. Running Oracle SQL Developer 1.5.5.
From the The SYSDBA System Privilege and (Logging In and Connecting to the Database as SYSDBA:
1--Connecting AS SYSDBA invokes the SYSDBA privilege. If you omit the AS
SYSDBA clause when logging in as user SYS, the SQL Command Line
rejects the login attempt.
2--Using SQL Developer, open a database connection to the SYS user AS SYSDBA.
So - if this works for you:
sqlplus sys/Oracle_1#pdborcl as sysdba;
Try: "SYS AS SYSDBA" as below:
Alternatively:
you can type in: "SYS" and select from dropdown-menu ROLE: SYSDBA.
If I understand correctly the database is on the same host as the SQL Developer installation? Are you fully qualifying the connection when testing with SQLPlus:
sqlplus "sys/password#database as sysdba"
It may be the case that the error is correct. Make sure you've created a password file.
The sys password that you are using is not valid.
But because you are connecting to oracle by command on an Oracle machine, Oracle does not check your password even though your password is not right.
Just change the sys password and try again.
su - oracle
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=Euro2016 entries=5
which means: write to a file $ORACLE_HOME/dbs/orapw$ORACLE_SID a password Euro2016 which is used by SYSDBA
Now you can connect with sqldeveloper: username sys, password Euro2016 with chosen SYSDBA , hostname, port, sid from $ORACLE_SID

Resources