Oracle Database link with error - oracle11g

I'm trying to create a database link form an Oracle server to another.
The command I'm using is:
create public database link mylink connect to myuser identified by 0000 authenticated by myuser identified by 0000 using 'myTNSNameRemoteServer';
sqlplus give me this error:
ERROR at line 1:
ORA-00933: SQL command not properly ended
Putting the '*' under the first character of the password in its first instance.
Have I to escape it in someway?
Thanks

The solution was to double quote the password:
create public database link mylink connect to myuser identified by "0000" authenticated by myuser identified by "0000" using 'myTNSNameRemoteServer';

you can try this:
CREATE DATABASE LINK "dblink_name"
CONNECT TO "user_user"
IDENTIFIED BY "user_pass"
USING '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = "user_server" )(PORT ="user_port" ))
)
(CONNECT_DATA =
(SERVICE_NAME = "user_service_name")
(SRVR = DEDICATED)
)
)' ;

Try this one:
CREATE DATABASE LINK ABCD CONNECT TO USER IDENTIFIED BY PASSWORD USING 'DBALIASAME';

Related

R: NULL value passed as symbol address, error in .Call(RS_PostgreSQL_init, config.params, force) :

I'm new to stackoverflow, so please forgive me if this is not the right place for my question.
When I set up a connectin with PostgreSQL via RPostgreSQL package i get the following error:
error in .Call(RS_PostgreSQL_init, config.params, force) :
NULL value passed as symbol address
after performing the following code
con <- dbConnect(dbDriver("PostgreSQL"), dbname = "dbname", host = "xyz0123456",
port = 5432, user = "Username", password ="password")
The code was working on my old machine. but i fails to work on my new PC.
any idea what this is about?
Thanks in advance!
Franz Hans

How to connect to remote PostgreSQL with R, certificate validation required

I'm trying to connect to a remote Postgres database with ssl = verify ca mode. My problem seems to be similar to Connect to Redshift via SSL using R and Connect to Postgres via SSL using R, but they do not work properly. The error is always
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect (null)#datadb1 on dbname "(null)"
My code is something like this
library("RPostgreSQL")
host = 'datadb1'
dbname = 'test'
port = 5432
password = pw
username = 'pep'
pg_dsn = paste0(
'dbname=', dbname, ' ',
'sslrootcert=', "C://root-ca.crt", ' ',
"sslkey=C://pep.key", " ",
"sslcert=C://pep.crt",
'sslmode=verify-ca'
)
dbConnect(RPostgreSQL::PostgreSQL(), dbname=pg_dsn, host=host,
port=port, password=password, user=username)
It's not a general database problem though, because I'm able to connect to the db using Python.
Update: I had made a mistake in specifying the path; the error is actually this:
Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (could not connect pep#datadb1 on dbname "test")
According to the error message, the problem is that you're passing empty values for the username and database name. That suggests your actual code doesn't match what you've entered here. I would write a 10-line Rscript program that just connects and grabs a bit of data, like this:
#!/usr/bin/Rscript
library("RPostgreSQL")
host = '192.168.36.2'
dbname = 'test'
port = 5432
password = 'secret'
username = 'pep'
pg_dsn = paste(
'dbname=', dbname, ' ',
'sslrootcert=', 'rootCA.pem', ' ',
'sslkey=pem.key', ' ',
'sslcert=pem.crt', ' ',
'sslmode=verify-ca',
sep=""
)
conn <- dbConnect(RPostgreSQL::PostgreSQL(), dbname=pg_dsn, host=host,
port=port, password=password, user=username)
rs <- dbSendQuery(conn, statement="SELECT COUNT(*) FROM users")
data <- fetch(rs, n=1)
dim(data)
So I don't think this is related to SSL certs at all, but the fact that your variables aren't being set the way you think they are.
EDIT: I created my own CA and used it to sign a server cert and a client cert. I put Postgres 9.3 on a fresh VM and have connections working, with certs required on both sides. I can connect with both psql and R. So I'm afraid I can't reproduce your problem. But a few things look suspicious in your code:
You only need one forward slash in your paths, not two. (If you were using backslashes you'd need two.)
You need a space before sslmode, like this:
'sslcert=pem.crt', ' ',
not this:
'sslcert=pem.crt',
Do either of those changes fix your problem?

No database selected with RMySQL

I'm trying to connect to remote publicly-accessible MySQL server EnsEMBL public server using RMySQL, but when I try to list the tables, an error occurs:
library(RMySQL)
mydb = dbConnect(MySQL(),
user = 'anonymous',
port = 5306,
host = 'asiadb.ensembl.org')
dbListTables(mydb)
Error in .local(conn, statement, ...) :
could not run statement: No database selected
Is there a a way to find out the name? Or Am I making a completely different mistake altogether?
You have to specify the name of the db in the dbConnect call. e.g. :
mydb = dbConnect(MySQL(),
user = 'anonymous',
port = 5306,
host = 'asiadb.ensembl.org',
db = 'homo_sapiens_core_83_38')
dbListTables(mydb)
It is weird that database = 'testdb' executed with dbExecute in R
db <- dbConnect(RMySQL::MySQL(),
user = 'root',
password = 'pwd123',
host = 'localhost',
database = 'testdb'
)
dbExecute(db, MySQLStatement) # Executed Without Error
But when used dbListTables(db) showing no databases selected.
Changed database into db worked as expected
db <- dbConnect(RMySQL::MySQL(),
user = 'root',
password = 'pwd123',
host = 'localhost',
db = 'testdb'
)

Connection Information for Oracle SQL Developer database

I'm new to Oracle, and I have installed Oracle Database 11g.
When I open some connection on Oracle SQL Developer, I get a dialog where I've to enter the username and the password as the following :
The problem is that I don't knwo what is the username and the password, in the installation I choosed orcl as the Username and orcl as the password but when I enter them I get the error message :
How can I solve this problem ?
I've another question : what is this page https://localhost:1158/em and why I get Page Web Inaccessible when I acces to it.
EDIT 1 :
This is the content of the listener.ora file :
# listener.ora Network Configuration File: C:\app\Aimad\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Aimad\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Aimad\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
ADR_BASE_LISTENER = C:\app\Aimad
EDIT 2:
this is the output of the command tnsping xe :
The reason why you are getting the error is because you have not specified service name or SID as it doesn't know to which instance it should connect.
I suppose you are using one of the latest versions of SQL Developer available for download.
Right click connections and choose New Connection from context menu, you will get a window like one is pasted below, there you enter connection details and do not forget to enter either service name or SID.
Hope this helps.

ORA-12154 Error while connecting grid view in ASP.net to oracle database

Details:
username is scott
password is tiger
Server name - I gave prashanth-PC, which I found in tnsnames.ora - at this point I get
ORA-12154: TNS:could not resolve the connect identifer specified
When I connect using code, it is working. In code I will leave data source blank. But when I connect using the grid view tool. It is asking server name. I don't know which server name should I specify. For reference I have posted the contents of my "tnsnames.ora" file. Please check it. Am using Oracle 10g.
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = prashanth-PC)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
I'm assuming you're using the ".Net Framework Data provider for oracle" as your provider.
In this case the server name should contain the "alias" from your tnsnames.ora - in your case "XE".
The error you get may be caused because it can't find the tnsnames.ora file.
Make sure you set the "TNS_ADMIN" environment variabl to point to the path of the directory containing the tnsnames.ora file.
Server name expects the Oracle service name, not your machine host name. Try entering XE at the server name. If this fails:
Check if you have multiple tnsnames.ora file
If so, ensure all the tnsnames.ora files are in sync or find out which tnsnames.ora
is in use - This can be done by checking your path variable & finding out which path has the first mention of tnsnames.ora
Also ensure that the tns listener service is up & running from the Windows Services list
I faced this issue just now. What I was trying to do was to provide share to the TNS files folder, located under "Admin" folder of the oracle client installation location, with developer folks to ensure that the sanity of TNSentries on the server.
What I noticed was that when I applied the share over the "Admin" folder, the "(LocalHostName)\Authenticated Users" was removed from the security context of the "Admin" folder.
Once I added "Authenticated Users" back to the security context of the folder with default rights, the error was gone.
OS version: Win 2012 DC Edition
Oracle client Client: Oracle client 11.2.0

Resources