Get Oracle application server address - oracle

In Oracle Forms and Reports, is there existing any function or procedure or possibility to get application server's address.
For example:
http://hostname:portno/servlet/RWServletserver=repserver+report=ReportName+destype=cache+userid=ConnectString+desformat=htmlcss
And I want to get this part: http://hostname:portno
Or Maybe there is possibility to create link of application in other way, not by knowing address of application server?
The link is to the Excel file which is created by report. The link in top is just an example and it is not link to the file. the path to the file is known.

I have a partial solution for you - the following piece of Forms PL/SQL code will return the IP address of the application server :-
declare
v_ip_address varchar2(20);
--
begin
select SYS_CONTEXT('USERENV','IP_ADDRESS') into v_ip_address from dual;
--
end;
The caveat to this functionality is that the Form / Report must be connected to a database to use this, as it uses a database function. However, it will always return the IP address of the application server, not the database server; and has been tested where these are on different boxes.
SYS_CONTEXT is an Oracle database function (confirmed available in 9i, 10g and 11g) which returns the value of a parameter associated with the context namespace; it comes with a built-in namespace USERENV. This namespace has a number of interesting and useful parameters; see http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions165.htm#g1513460 for details.
The specific parameter being used here - IP_ADDRESS - returns the IP address of the connected client, which from the database's point of view is the application server, as this is where the Form / Report is actually executing - so you get what you need :) This should work for Reports as well as Forms, although I have not tested this.
I can't see a way of getting the port number, I'm afraid - but hopefully the above should help you.
Cheers,
Keith

Related

Using HTP.P in ATP oracle database

I've just started checking out the ATP database in oracles cloud.
I have an old pl/sql proc that I want to put on the ATP database.
Happily the procedure with calls to htp.p compiled with no errors...but how do I find the URL to use to get to my procedure?
(And BTW no the proc isn't something that can just be converted into a restful web service through apex.)
The answer I've gone with for this is that the ATP database comes with ORDS configuired and ready to use.
You can expose pl/sql procedures to requests through ORDS. This does require some manual work for each procedure but not a huge amount.
You will need to set up a module in ORDS and a template for each get/put etc call you want to send through to your procedure.
Its documented pretty well here:
https://oracle-base.com/articles/misc/oracle-rest-data-services-ords-remote-procedure-call-rpc-and-output-parameters
This is using the command line for everything - I've found it easier to use the restful data services available through apex to get a GUI interface to use to set this up. I believe there is a GUI available through sql developer too.

How to periodically update my local DB with changes from the Production DB

I want to know if there is a similar type of tool to say subversion for Oracle.
I am in a bit of a situation where I need to debug potential coding or data issues.
The problem is that the Data is quite big and to do a update every 24h or so will just be impossible. But Im thinking if there is a way to run a script that could look at the local and production DB, determine the difference between them ( production DB being the wanted changes ). and update the local DB with those new records/changes.
Is there something out there that might do this type of thing?
This will be for oracle 11gR2 databases
check whether the DBLINK works between the two oracle server
the db link tutorial id http://www.orafaq.com/wiki/Database_link
If the DBLINK works create a procedure like
PROCEDURE p1
IS
BEGIN
--MERGE SCRIPTS to your table
END;
call the same in DBMS_JOBS for each day like below
exec dbms_job.submit(:v_JobNo, 'proc1;', TRUNC(SYSDATE)+1, 'TRUNC(SYSDATE)+1');
for more information about jobs refer here http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_job.htm#BABHCBFD
if the DBLINK doesnot works you have to go some other middleware tools
Hope this will help you

Microsoft Enterprise Logging Block with Entity Framework asks for WriteLog procedure

I have a WCF service that uses Microsoft Enterprise Library Logging to log some messages to the Event Log. That works just fine.
The problem is that i want to log some messages to a table in an Oracle database. I am using the Entity Framework to communicate with that Oracle database.
The next step is a right click on the 'web.config' and choose the option 'Edit Enterprise Configuration'. I get the 'Enterprise Library Configuration' editor. In there i am trying to set the Logging Settings so that it also logs to the database, but when i add a database trace listener it´s asking me to fill in a procedure name. Do i have to add a procedure name to fill the table in Oracle? The msdn tells me to run the script that create an MSSQL database 'Logging' and some tables. But i don't have an MSSQL server, i have an Oracle server. And i don't want to use a seperate logging database, but save the logs to a single table.
Can anybody help me with this?
Kind regards
The Enterprise Library Database Trace Listener uses 2 stored procedures to write to the database: Add Category Procedure and Write To Log Procedure.
There is a SQL Server script to create the tables and stored procedures. This would have to be ported to Oracle.
Unfortunately, it looks like this does not work as easily as you would hope. See the blog post, Enterprise Library Logging to Oracle Database (this is based on EntLib 3, I believe) and the work item Cannot log to oracle Database using logging blocks for a description of some of the issues as well as some downloads to help.

How to retrieve Oracle server collation in order to set up linked server

After searching here and on the web, I finally decided to post the question. I am running an SQL 2000 server, and linked an Oracle 9i server. Everything works fine when I run queries, and even updates and inserts from and to the Oracle Linked server (using both Microsoft OLE DB driver and Oracle OLE DB driver) using the OPENQUERY approach.
The problem is that, in order to clean code a bit, I want to use four part names in my queries. I am doing this also when querying other SQL linked servers.
But when I run the queries against Oracle using four part names I get this error: ( I am translating the error message from spanish. Probably the original message in english id different)
ERROR: OLE DB 'MSDAORA' returned an invalid column definition.
Error Code: 7318
Digging a bit, I learned that this is probably related to nos having the right collation name set in the linked server properties.
Now... I am not an Oracle expert, so I need to find out what collation is the schema I connect to using in Oracle (apps... yes, I know, I know... )
So, the plain question is... How do I find out what collation Oracle is using? I have access to the Oracle server via Toad... is there any query I can run in order to find this out?
Thanks!
I think you're looking for the NLS settings, which you can find from these views:
V$NLS_PARAMETERS — "Current values"
NLS_DATABASE_PARAMETERS — What the database was created with.
NLS_INSTANCE_PARAMETERS — From changes by ALTER SYSTEM
NLS_SESSION_PARAMETERS — Combined, plus ALTER SESSION
V$PARAMETER — System parameters, where a lot of this is changed (contains all kinds of stuff)
The documentation is rather lacking here (or, quite likely, I couldn't find the right document), but this should get you what you want.
You will probably have to log in as SYSDBA to read some of these views.

Saving a report to a file on a client PC?

I would be grateful for a quick sanity check!
When calling Oracle Reports 10g from Oracle Forms 10g, is it possible to run an Oracle Report and save it on the users PC to a specified directory? (I know that if an Oracle Report is run in such a format as PDF the user can save the report to x location). To call the Oracle report I am using the Oracle Forms built-in "Run_Report_Object".
I don't think it is (but would be happy to revise my opinion!) and to obtain such functionality I would have to implement something similar to what is discussed in this thread
I have amended my question to include the fact that I am using the Oracle Forms built-in "Run Report Object" to call Oracle Reports.
There is a Oracle Report parameter: DESTYPE which can accept a value called LOCALFILE which saves the output to the client machine using the file name specified by DESNAME, however as I'm using "Run_Report_Object" it is not possible to use the value LOCALFILE.
One solution is to follow the steps given here.
Sources: Oracle Reports 10g Help (look for DESTYPE),
OTN thread

Resources