ORA-02019: connection description for remote database not found - oracle

I have created a db link AM_ADMIN through SQL Developer:
I am trying to check if it is a valid database link. When I test it from the SQL Developer wizard it is successful. But when I use the below command:
SELECT * FROM dual#AM_ADMIN
I'm getting the error:
ORA-02019: connection description for remote database not found
How can I rectify this error?

According to your screenshot you created the database link as AM_ADMIN.INT.xxx. You are calling it without the domain, just as #AM_ADMIN. Unless you have a sqlnet.ora which defines names.default_domain with the same domain value (and have SQL Developer configured to recognise that), you will need to fully-quality the link name when you use it:
SELECT * FROM dual#AM_ADMIN.INT.xxx

This error will occur when a database link is not made PUBLIC, and the user who created the link is different to the user attempting to use the link. For example, creating the link as the SYS user and then trying to use the link as the AM_ADMIN user.
In this instance either make the link PUBLIC (which all users can then access), or grant the AM_ADMIN user the privileges to create a database link.

I had the same problem and I found out that it was a stupid error caused by (Description = (... HOST = !...). When you create Database Link in USING clause, you should:
use the keyword HOST if you are using the IP address
use keyword HOSTNAME if you are using the name
I just wanted to share it because I lost half a day trying to figure that out and I couldn't find any information about it...

Related

How to solve ORA-65096 from Oracle SQL Developer?

I am trying to create a new user from Oracle SQL Developer. I made a connection with the user Sys and the password that I entered in the installation of Oracle Database XE 18c.
When creating the user I get the error ORA-65096, I have searched the internet and the solution I found is to write the following:
alter session set "_ORACLE_SCRIPT" = true;
However, I want to know if it is possible to create the new user without using any SQL statement or script and do it from the Oracle SQL Developer interface, do I have to login with a different user than Sys to create a new user? or what do I have to do? Could someone give me a detailed explanation please. I am learning how to use this database and I want to try to understand what I am doing.
oerr ora 65096
65096, 00000, "invalid common user or role name"
// *Cause: An attempt was made to create a common user or role with a name
// that was not valid for common users or roles. In addition to >the
// usual rules for user and role names, common user and role names
// must consist only of ASCII characters, and must contain the >prefix
// specified in common_user_prefix parameter.
// *Action: Specify a valid common user or role name.
This implies that you are connected to the root container instead of to a regular plug in database (pdb) where applications should be built. The solution for you is not to overrule setting to enable building an application in the root container but to connect to the pdb that has been made to host your application.
you can check the available pdb's by viewing v$pdbs. The special pdb cdb$root is as the name already tries to tell, the root container. show PDBS will give similar output.
Using alter session set container = [pdb_name]; can be used to switch to your container of choice where regular rules apply.
Even better is to directly connect to that pdb using sqlnet.

Able to connect through CMD but not to Oracle SQL developer to Oracle DB

So I got connected to Oracle 11g in cmd as follows
However, when I type the same username and password in Oracle SQL Developer, it does not work. And I have uname and pwd, what goes in the connection name?
This what I got, when i entered a connection name and My uname and PWD
Oracle SQL Developer
Just give any string in your connection name, that is used for identify different connection in sql developer.
Like,
Connection name : Connection_1
username : system
password : yourpass
If you want to create another connection to another database or another schema then you have to give another name and by login you can directly access that particular schema.
Hope it will help.
I think the issue might be that SQL Developer uses a different tnsnames.ora file. The file can be set under:
Tools>Preferences>Database>Advanced
Choose the correct tnsnames directory there.
Depending on your developer version, you might also want to set the Oracle Client folder.
After that in your connection dialog choose TNS instead of BASIC. And pick the tnsalias name from the list from the file.
Let me know if that works.
I also faced the same issue and after trying series of steps came to this conclusion.
1)Make sure to follow the blog to install the DB and check the validation steps too :
https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/Windows_DB_Install_OBE/Installing_Oracle_Db12c_Windows.html
This blog makes sure that you are able to connect to SQL via CMD.
2) If you still face issue while connecting to SQL developer for the same configuration,check : Advanced system settings-->Environment variables-->system variables--> PATH
Make sure you have entry for the DB here.
Environment variable for DB
3) If above step is a success,check the tnsnames.ora and listener.ora files present in the location : dbhome_1\network\admin
These files should have a valid entry for the localhost and SID/service name.
Thanks,
Sandeep

Pl-Sql User Connection

I've been starting oracle on my job. But i've been using MS all the time. Now i have problem on User-Shema structure. I tryed a create table with sql query, but table had been created in somewhere else then i wanted. (I've already created a user named LPA) I just wrote the query, and table is in the (GeneralDatabase) Tablespaces->Users->(Here). I want to create a table in LPA schema, under the table folder. I've been searching for it but i could'nt get it. So need some help please.
PS:I found that i need to connect with user, than write to query with TS_LPA(Thats my tablespace). But i also cant connect with the user LPA.(We can say this is my first problem)
In Oracle there is no "dbo" or default schema, in case that is what you are looking for. You must specify the target user account when you connect (log in) to the database, and that account will be used as the default schema for all of your subsequent actions. (This is similar to a home directory in Linux, where if I log in as williamr and create a file, it will belong to williamr and not some generic default account.)
In your case I suspect you are connecting as SYS or similar, in which case your table now belongs to SYS (or whoever you are connected as). You'll need to drop it and try again.
If you don't want to post the connect string you used to connect initially for some reason, then execute the following query to see your current schema:
select user, sys_context('userenv','current_schema') from dual;
(Normally user and sys_context('userenv','current_schema') will be the same, but worth double-checking.)
In PL/SQL Developer you can only issue connect commands from a Command window (not a SQL window). Alternatively you can use the 'log on' menu tool, or Session > Set Main Connection from the menu, or (best if you want to reuse it later) Tools > Define Connections, which has a 'Test...' button to validate a new connection. You'll need the username, password and database service name (not just username and password).
connect with LPA user.
specify the schema name before table name.
create table LPA.tbl_name(col1 datatype1,....);

How to create a database in Oracle using JDBC?

I want to create a new database on an Oracle server via JDBC. I cannot seem to connect to the database without providing an SID: using a URL like jdbc:oracle:thin:#//[IP]:1521 results in an error of "ORA-12504, TNS:listener was not given the SID in CONNECT_DATA"
Alternatively, if I log into a specific SID, I can run most DDL commands except for CREATE DATABASE foo which fails with an error of "ORA-01100: database already mounted"
How am I supposed to create a database if I cannot connect to the server without specifying a specific database and cannot create a database if I am already logged into a specific database?
AFAIK creating a database needs an internal and direct connection which can only be done by logging in directly on the server (normally a user account called 'oracle').
One reason for that: users are stored in the database itself. No database = no user to connect to by an external client.
Please also note Justin's comment about oracles database schemas. This is probably what you are looking for
What you need are following commands:
CREATE TABLESPACE CREATE USER and few GRANT ... TO ... -- to have rights to connect and create objects, at least

In Access 2002, how can I transfer databases from multiple oracles sources?

I have some simple VBA to import tables from multiple Oracle databases. I have one ODBC entry, and I connect to different databases using different credentials.
My transfer database code is simple:
DoCmd.TransferDatabase acImport, "ODBC", "ODBC;DNS=source;UID=user;PWD=pass;", acTable, "SomeRemoteTable", "MyLocalTable", True
That code works, but when I run the same command with a different user/pass immediatley after this command I get this error:
Run-time error '3011': The Microsoft Jet database engine could not find the object 'SomeRemoteTable'. Make sure the object exists and that you spell its name and the path name correctly.
Here's the catch:
The DNS, user credentials, and table names are correct. If I open access and comment either line out, then either transfer will run successfully. However, once one command runs, the other will not run until Access has been closed and reopened.
I'm guessing that there must be a way to close the first connection before proceeding to the next. Does anyone have any ideas on what I can try?
If the databases are owned by you how about setting up a dblink on one of them to the other ?
You will then only need 1 connection.

Resources