SQL & PL/SQL :: Created Function For Knowing Status Of Link Which Connect With Remote Database
May 22, 2013
I have created a function for knowing the status of link which connect me with remote database.function is as follows
---------------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION get_status_db_link (p_db_link_in VARCHAR2)
RETURN NUMBER AS
rows NUMBER;
v_code NUMBER;
v_errm VARCHAR2(64);
[code]....
Now functin should returns 1 when link is up and it should return 0 when link down but sometime when link is down it continues showing executing it hang my pc.
in a 9.2.0 db I create a db link but does not function :
CREATE DATABASE LINK "ONEDB" CONNECT TO "user1" IDENTIFIED BY "****" USING 'ONEDB';
SQL> select * from dual@"ONEDB"; select * from dual@"ONEDB" * ERROR : ORA-12154: TNS:could not resolve service nameBut on the same server I can connect to 11g in sqlplus :
Z:>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Mar. Juin 19 10:13:45 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> connect user1@ONEDB password : Connected.Of cours the other DB links toward 9.2.0 databases work well.
I have one PLSQL package that does a join of two tables of remote database instance via the datalink. I just wonder where the most calculation(the join) is done, local machine or remote machine? Is there any best practice to have a better performance for such configuration.
I installed oracle 10g and developed simple software using forms 6i. Its working well as a stand alone system.
I want to share it in network. so I installed forms 6i as oracle client , copied the tnsnames.ora from the oracle installation path to forms installation path.(inside NET80/Admin folder)
When i try to connect with user name and password , it comes ORA-12203 Unable to connect to destination. I checked LSNRCTL in the database machine, it is listening.
I am using Report Builder 10.1.2.0.2. There is a table in a remote database with synonyms/links defined. I am getting error trying to access those tables. DBA says links/synonyms are correct and I am also able to access that table from SQLTool without error.
I can do a select statement on those tables from 'SQL Query statement' in data model.
Error is generated only if I try to use those tables in 'Formula' or in function/procedure.
I am trying to connect to a database located at my work from at home. I am running into the following issue (see command and error below):
ansichart@ansivm:~/src/perl$ sqlplus aspxdba/********@aspxp2 SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 18 21:15:09 2013 Copyright (c) 1982, 2011, Oracle.
All rights reserved. ERROR:ORA-12545: Connect failed because target host or object does not exist-- Here is my tnsnames.ora file (I have the service_name censored out for privacy reasons):-
I have verified that I can establish a TCP connection to this DB server on the port specified, using the same info from the TNSnames.ora file (see below):-
---ansichart@ansivm:~/src/perl$ nmap -sT -p 1521 orarac9-scan Starting Nmap 5.21 (URL.... ) at 2013-07-18 20:53 CDTNmap scan report for orarac9-scan (10.1.13.115)Host is up (0.0088s latency).PORT STATE SERVICE1521/tcp open oracle Nmap done: 1 IP address (1 host up) scanned in 0.09 secondsansichart@ansivm:~/src/perl$--
I have another terminal opened up to a server at work and I can connect to the DB with sqlplus just fine. I verified that the record for this database on the tnsnames.ora file is the same as it is at work. In conclusion, I can connect to the Database at work, but I cannot at home, even though I am using the same connection information and verified that port 1521 is accessible on this Database server from at home. So why can't I establish a DB connection?
i create new database (Student) using command line, now i want to connect with newly created database (using sys as sysdba), but again it directly connected with old database (ORCL). So what should i do to connect with newly created database (Student).
There are 2 Oracle databases with pseudo names Remote and Local. I have a function in Remote called FUS.F_Return_10 which simply returns 10 for testing purposes, where FUS is a schema name. In Local I want to create a procedure that will call the above function. Here's the PL/SQL:
CREATE OR REPLACE PROCEDURE TEST ( V_COUNT OUT NUMBER ) AS V_FOO NUMBER(2,0); BEGIN
[Code]...
There's a Public Database Link called PER_ACC in Local. When I try to create this procedure I get: Encountered symbol "@" when expecting one of the following: .(*%&................
In Database A I have a series of config tables and stored procedures/functions In Database B I have a lot of tables.
I would like to execute my stored procedures and all associated functions in database A on my data in database B.
Now I've figured out that creating a database link enables me to do SQL selects on data in both A and B...but how do I run SP/Funcs ? I've read something about packages but not sure if I'm heading in the right direction.
Do I need to create a simple synonym ? Can I use the existing DB link ? or is there a special way of calling them, or...
I like the A/B database set up since I can keep battle tested code in one location and have it work across multiple dbs...saves me having to create everything in every database.
I have IR wit one column link target to URL, and it uses javascript:my_function(#COLUMN_VALUE#)as URL, that is, calls some function and passes the value of that column to the function; everything works fine; but when I place a cursor over the link, bottom line of IE9 browser (is it called a 'status bar'?) clearly shows:
'javascript:my_function(<actual value>)' Is there any way to prevent it from showing function name and parameter value? I tried onmouseover="window.status='';"but it does not work
When I try to remotely connect to an Oracle schema using SQLplus, I consistantly get this error:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Yet I can connect to the same machine, from my own machine just fine using SQLDeveloper.Here are the details I have collected so far
- I am using the instantclient for OS X - export DYLD_LIBRARY_PATH=/Users/jeff/instantclient - export ORACLE_HOME=/Users/jeff/instantclient - export TNS_ADMIN=/Users/jeff/instantclient/tns
The command line i ran : ./sqlplus seam_classoft/seam_classoft@//oracle11gtest.terida.net:1521/orcl
Its behind a VPN, so I'm not worried about posting my info.
My /Users/jeff/instantclient/tns/tnsnames.ora that I copied directly from the server looks like this:
I've tried changing SERVICE_NAME to SID = orcl, no change inbehavior. My original guess was that the database wasn't registered with the listener, but that would mean sqlDeveloper should fail as well, but it works.Here is out put of lsnctrl status:
LSNRCTL> status Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 07-JUN-2010 09:16:40 Uptime 42 days 0 hr. 58 min. 59 sec Trace Level off [code]....
I have a database up and running (including listener) on machine A. From that machine, everything seems fine. However, when I try to connect to it from another machine (say, machine B) on the network, the connection cannot be established (exact message: connection to database failed: The Network adapter cannot establish the connection).
I can successfully ping machine A from machine B. The machine A db is a default install (ORCL).
Is it possible the DB listener is not configured properly to connect to remote clients? On machine B, I have oracle tools such as SQLPLUS, Oracle Net Manager, and Net Configuration Assistant.
After restarting the listener, we could connect using the connect identifier from the local server. However, when trying to connect from a remote client we received the error of "no listener". In the remote client the identifier is defined with host=ip_address. TNSping from the client to the host was successful.
When we changed listener.ora to host=up_address we could connect ONLY from the remote computer. Only after changing the host in tnsnames.ora file to the IP as well - we could connect from both the local server and the remote client.
I usually use host=localhost in the listener file (and the local tnsnames file) and never had this problem before.
I have a strange problem of connecting Oracle Forms6i from our Remote site.actually we change our IP address of lease line, we connect to it.but when we connect locally,forms are running without any problem,but when we connect globally or from other sites it can't able to connect,even sql prompt and toad also connect from remote site,but when we try to connect forms(forms runtime) it gives error message(ORA-12203: TNS:unable to connect to destination).when we connect this application from local application(Forms) it can connect well but from globally it can't able to connect.
Basically I've created a function, when I run it there is a user input. Mine is a customer number between 1-10.
I was wondering is there a way to add in error check so if I typed in an invalid number it would give me a message saying "Wrong customer_number" or something along the lines of that?
I was told I wasn't able to use "DBMS_OUTPUT.PUT_LINE" in the function I need to tamper with the function header?
Here is my header -
CREATE OR REPLACE FUNCTION hours (custid customer.cust_id%TYPE)
What I am trying to do is print out page that displays all of the column titles and the data under them for a query given by the user. It is then going to be put into an excel spreadsheet.
I've done this before with Java, simply by using the getMetaData function, but I can't seem to find an alternative for PL/SQL. It seems at the very least I need to know the number of columns in a query, but that would defeat the purpose of this.
Is what I am trying to do even possible or is knowing the column names an absolute necessity when printing table data?
I am not familiar with form with report in APEX. I have a lot of forms with reports that was created before, but they have only create buttons. Now I need to add edit and delete buttons. I wish I do not have to recreate forms with reports. But when I tried to add delete function by comparing a form with delete button created by APEX, but it does not work. the delete button does not react at all.
setting is as follows:
button style: template based button button template: Button button type: normal action: redirect to URL execute validation: NO URL target: javascript:apex.confirm(htmldb_delete_message,'DELETE'); database action: SQL delete action condition type: value of item / column in expression1 is not null expression1: P2172_ALIAS_ID
I also enable the delete in the process of :"Process Row of SOR_ALIAS"
If I set action of delete button as submit page, I can delete the row, but no standard popup warning,
I'm trying to connect a oracle client application on the client machine to a remote oracle server on the server machine but i get a connection fail.
On the server machine I configured oracle server in the following way:
Installed oracle server. Created a database "DB_Test" with the database configuration assistant Created a LISTNER with the Oracle NET Manager with the following parameter:
Protocol: TCP/IP HOST: server pc hostname (ENZOVAIO) or server machine address ip (192.168.0.71) in the network lan Port Number: 1521 Created "dbtest" service with the Oracle NET Manager with with the following parameter: Service Name: "dbtest" Protocol: TCP/IP HOST: server pc hostname (ENZOVAIO) or server machine address ip (192.168.0.71) in the network lan Port Number: 1521
All services on the server machine are running and I opened port number (1521) in the router. On the client machine I installed SQL PLUS and SQL Developer.
With SQL Plus as by the official documentation I have entered the following command:
CONNECT username/password@[//]host[:port][/service_name]. In my case is: CONNECT SYSTEM/oracledb@//ENZOVAIO:1521/testdb.
With SQL Developer I have entered the same parameter.
But with both SQLPlus and SQL Developer the connection fails.
Acer laptop, Intel Processor w/ Windows 7 Professional (64-bit) Delphi 2010 Professional Oracle XE (+ the Oracle XE client that comes with it)
I cannot can't to the Oracle database from Delphi. The error I keep getting is:
Alias is not currently opened. [Oracle][ODBC][Ora]ORA-12154:TNS: could not resolve the connet identifier specified.
Here's what I've done:
1. Create an ODBC connection to my Oracle database
- run C:WindowsSysWOW64odbcad32.exe to open the ODBC administrator. - Data source name: bt_user - TNS Server Name: localhost/xe - user bt_user - Clicked "test connection" -- Success.
2. Open Delphi and drop a TDatabase component on my main form.
- Set the Alias Name property to "bt_user" (the alias I set up in ODBC) - Set database name to "bt_user". - Checked "connected".
Alternatively, I tried using the Delphi ADO components (the dbGo components).
- Drop TADOConnection component on my form. - Select "connection string" and open the dialog. - Click "build string". - Select "Microsoft OLE DB Provider for ODBC Drivers" from the selection. - In "use data source", select "bt_user" from the drop-down list (my ODBC connection from #1) - Click "test connection".
Again the same error.
My questions are:
1. Can Delphi work with Oracle XE (Express Edition)?
2. If so, then do I need to install the "Instant Client"?
3. Will the instant client for Oracle 10g work with Oracle 10g XE?
4. Do I need to install any additional ODBC driver(s)?
5. Why was I successful in creating the ODBC connection in Windows, but it failed in Delphi?
6. Will Visual Studio.NET (C#) work with Oracle XE, and what are the steps for setting that up?
Import: Release 10.2.0.1.0 - Production on Wednesday, 17 March, 2010 11:07:02 Copyright (c) 2003, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Release 10.2.0.1.0 - Production Starting "MUBA"."SYS_IMPORT_TABLE_01": muba/******** tables=FUNCTION_NO directory=testdump NETWORK_LINK=DBLINK1 Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Is it possible to use Database authentication in APEX through database link, and how?Also is it posible to read roles from users through database link?
I want to update my table base on changes in a column of a table from remote database automatically. I just want to pick some updated column then update to my own. i have made a trigger but failed.
CREATE OR REPLACE TRIGGER TG_UPD_ID after update OF STUD_ID on STUDENT@SCHOOLDB for each row begin
update MARKS set ID_ST = :new.STUD_ID where STUDID_STUDENT = :old.IDS;
end;
Error report: ORA-02021: DDL operations are not allowed on a remote database 02021. 00000 - "DDL operations are not allowed on a remote database" *Cause: An attempt was made to use a DDL operation on a remote database.
For example, "CREATE TABLE tablename@remotedbname ...".
*Action: To alter the remote database structure, you must connect to the remote database with the appropriate privileges.
I have 2 database . One is production and other is Integration and I have one table "emp" which is on integration server and a synonym of that table with the same name"emp" on production. On production we have a proc in which we are using "emp", but some time our integration server goes down, so is there any way to ping the integration server inside the proc and if it returns success then we will execute the rest of code of proc , otherwise it will send a mail to us saying that integration server is down.
I am running ORACLE 10.2.0 on Windows Virtual PC. System: Microsoft Windows XP SP3.
Yesterday I wanted to make a copy of my Virtual Machine Hard Drive Image. I directly copied all the files to my external hard drive, but I forgot shutting down my virtual machine when I was doing this.
Today I found my instance failed startup.
In OEM, it is showing:
Agent Connection to Instance Status: Failed Details ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)
In SQLPlus:
SQL> connect sys/password as sysdba Connected to an idle instance SQL> startup ORACLE instance started.