How to get HD serial and IP of a machine?

To discuss Oracle Forms & Reports related technical issues.
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

How to get HD serial and IP of a machine?

Post by mirza_rehan »

Assalam-o-Alaikum,

I have two Questions.....

first want restrict my software on specifict machine for example i get its HDD serial number or processorID or any other unique ID is it possible or not????

second i want machine name or IP or data entry operator's machine, machine name is get with v$ views but i m not work deeply on it.. any one tell are these operations performed???? or not???????


waiting for your reply

Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
admin
Posts: 2062
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Post by admin »

To get the serial number of your hard disk you should use host command to create a text file in the main form, and then verify the serial by reading this text file.

d:\>dir serial.txt
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

Assalam-o-Alaikum

I am unable to find serial.txt file, is any way to find IP address / machine of data entry operator's??? its very urgent i am little bit bussy in my software so i dont have time for R&D, i browse little bit. with the help of this query i get terminal name of data entry operator and his osusername, if more then one user connect from same userid then i think i give multiple record???? or give some problem


this is query for getting terminal name


select terminal,osuser from V$session
where user#=uid
and status='ACTIVE'

Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
admin
Posts: 2062
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Post by admin »

Sorry it was,

d:\>dir > serial.txt -- a file will be created
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

My question is that how can i get HDD serial number????????? ???

pleasee tell me is it possible????? or not?????


Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
sikandar
Posts: 32
Joined: Fri Mar 31, 2006 4:13 pm
Location: Pakistan
Contact:

Post by sikandar »

Simple answer is no as no function in oracle available.

D:\>dir
Volume in drive D is New Volume
Volume Serial Number is A070-86E5 <<< I was suggesting to get this info.
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

Assalam-o-alaikum

I think this is done by ora_ffi package?????? can any one give me example of ora_ffi package how we use dll file in Developer??? if any one give me sample form i will very thankfull


Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
admin
Posts: 2062
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Post by admin »

Pl read this following metalink note hope of any help,

Subject: HOW TO ACCESS OPERATING SYSTEM ENVIRONMENT VARIABLES WITHIN ORACLE TOOLS
Doc ID: Note:1014976.4 Type: PROBLEM
Last Revision Date: 04-MAY-2005 Status: PUBLISHED


Problem Description:
====================

How do you access values from the operating system (OS)
within Oracle Forms, Oracle Reports, or Oracle Graphics
without using User Exits?

How do you programmatically read an environment variable
into a form, report, or chart?

How do you access environment variables defined in the ORACLE.INI file,
the Windows Registry, the SYSTEM.INI file, or the DOS AUTOEXEC.BAT file?

Examples
--------
While running an Oracle Forms, Reports, or Graphics application,
how do you isolate the following information?

o UNIX group name that a user belongs to

o values of DOS environment variables defined in the AUTOEXEC.BAT file

o values of environment variables defined in ORACLE.INI and WIN.INI files


Problem Explanation:
====================

TOOL_ENV.GETVAR returns only variables declared in the ORACLE.INI file
or the Windows Registry.

How do you return environment variables from the SYSTEM.INI
and AUTOEXEC.BAT files?


[ Search Words: uid, variable, TEMP, TERM, terminal, VT100, VT220, printer,
GET_APPLICATION_PROPERTY, GETDOSENVIRONMENT(),
GetPrivateProfileString, WritePrivateProfileString,
D2KWUTIL, INI, files, reading, writing, accessing,
Win_API_Environment, Read_INI_File, Write_INI_FILE,
GETVAR, PATH, d2kapi ]

NEW: UNIX: HOST() TO EXECUTE; REDIRECT OUTPUT TO FILE; READ WITH TEXT_IO

Solution Description:
=====================

o Use HOST() to issue the UNIX command from Forms to output the information
you want.

o Use the UNIX Pipe ( | ), to send the output through the UNIX awk/sed
utilities to extract just the values you want.

o Redirect the output of this to a unique filename

For example:

HOST('uid | awk ... | sed ...> filename )

o Back in forms, open and read the file using the Text_IO package.

o You could then use HOST() again to remove the created file.



Solution Explanation:
=====================

For example: the uid UNIX command will give the the user's userid and group
id, which you could then access from Oracle Forms using the method described
above.



UNIX: CREATE TABLE, USE GET_APPLICATION_PROPERTY, HOST, RUN_PRODUCT

Solution Description:
=====================

1. Create a table named tenv.
Use this table for compilation purposes of the form.

2. Insert the following code in the desired trigger or procedure.
This example uses the RUN_PRODUCT built-in to call Oracle Graphics and
accesses the environment variable GPATH.

DECLARE
un VARCHAR2(80);
pw VARCHAR2(80);
BEGIN
un := GET_APPLICATION_PROPERTY(USERNAME);
pw := GET_APPLICATION_PROPERTY(PASSWORD);
FORMS_DDL('CREATE TABLE tenv (v1 VARCHAR2(100))');
HOST('echo set termout off > tenv.sql');
HOST('echo insert into tenv values \('||'\'''||'\&1'||'\'''||'\)\; >>
tenv.sql');
HOST('echo commit\; >> tenv.sql');
HOST('echo exit >> tenv.sql');
HOST('sqlplus -S '||un||'/'||pw||' @tenv $GPATH');
SELECT v1
INTO :global.gp
FROM tenv;
FORMS_DDL('DROP TABLE tenv');
HOST('rm tenv.sql');
RUN_PRODUCT(GRAPHICS, :global.gp || '/disp1.ogd', SYNCHRONOUS, BATCH,
FILESYSTEM, NULL, 'dept.c1');
END;

3. Before you run the form, drop the table tenv.


Solution Explanation:
=====================

You can refer to Oracle Support Bulletin 107368.663. However, this uses an
external file and database table, which can be a problem in a multi-user
environment and requires you to keep track of more objects.


Solution References:
====================

Bulletin 107368.663
Access Environment Variables from Forms



DOS: CREATE FORMS PARAMETER AND USE %VAR% TO PASS ON F45RUN COMMAND LINE

Solution Description:
=====================

To obtain a "DOS" variable:

1. Declare a parameter in the form:
DOS_PARAM VARCHAR2(200)

2. Pass this parameter to Oracle Forms on the command line
when you invoke Runform.
o You can set up a Runform icon that runs the form
with this parameter specified.

Set DOS_PARAM to the desired DOS variable enclosed in percent (%) signs.
f45run module=myform userid=username/password DOS_PARAM=%TEMP%

Windows expands %TEMP%, so the parameter holds the full value at runtime.

However, this method only works from Runtime and is somewhat clumsy.


Solution Explanation:
=====================



WIN: USE TOOL_ENV.GETVAR TO GET ORACLE ENVIROMENT VARIABLE VALUES

Solution Description:
=====================

Use the TOOL_ENV.GETVAR built-in to interact with Oracle environment variables.

Syntax: PROCEDURE TOOL_ENV.GETVAR
(varname VARCHAR2,
varvalue VARCHAR2);

varname - is the name of the environment variable
varvalue - is the value of the environment variable

TOOL_ENV.GETVAR allows you to import a valid ORACLE environment variable
(e.g. on Windows: ORACLE_HOME, TK21_ICON, OTM25, etc.) into a VARCHAR2
variable.

If you supply a varname parameter that is not a valid ORACLE environment
variable, the varvalue returned is null. Even if you create and set
your own environment variable, TOOL_ENV.GETVAR does not return the
assigned value. Since the user-defined variable is not a valid ORACLE
environment variable, TOOLS_ENV.GETVAR returns a null as the varvalue.

Example 1
---------
To read the ORACLE_HOME environment variable into an Oracle Forms item:
TOOL_ENV.GETVAR('ORACLE_HOME', :block.item);

Example 2
---------
To read the terminal environment variable into a Forms item:
TOOL_ENV.GETVAR('TERM', :block.item);

Example 3
---------
To read the printer environment variable into a Forms item,
issue the following:
TOOL_ENV.GETVAR('PRINTER', :block.item);


Note:
-----
If you are using the 32-bit version of Oracle Forms then TOOL_ENV.GETVAR()
will work for only the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE section of the
Registry.

For the other sections use the D2KWUTIL package as:

WIN_API_ENVIRONMENT.read_registry

similarly, to write to the registry use:

WIN_API_ENVIRONMENT.write_registry


Solution References:
====================

The TOOL_ENV Package
in chapter 8, "Oracle Procedure Builder Packages",
of the Procedure Builder 1.5 Developer's Guide



WIN: USE ORAFFI TO CALL WINAPI GETDOSENVIRONMENT(),GETPRIVATEPROFILESTRI

Solution Description:
=====================

You can use the ORAFFI to call WinAPI GetDOSEnvironment() to get DOS
environment variables.

Read in the ini file variables using the GetPrivateProfileString, and
WritePrivateProfileString to write to an ini file. These are windows
functions. These function can be called using the ORA_FFI built-in package.

For the 32 bit tools you can use the equivalent functions for accessing the
registry. See the D2KWUTIL package.


Solution Explanation:
=====================



USE HOST TO WRITE VALUE TO FILE AND TEXT_IO TO READ IT IN FORMS

Solution Description:
=====================

UNIX:
-----
o Use HOST() to issue the UNIX command from Forms to output the information
you want.

o Use the UNIX Pipe ( | ), to send the output through the UNIX awk/sed
utilities to extract just the values you want.

o Redirect the output of this to a unique filename

For example:

HOST('uid | awk ... | sed ...> filename )

o Back in forms, open and read the file using the Text_IO package.

o You could then use HOST() again to remove the created file.

For example, the uid UNIX command will give the the user's userid and group
id, which you could then access from Oracle Forms using the method described
above.


WINDOWS:
--------
1. To retrieve the value of the environment variable in a text file,
issue the HOST command to execute an operating system command.
Include the following PL/SQL code in a trigger:

HOST('echo %TEMP% > out.txt');

2. Use the TEXT_IO package to read the text file into Oracle Forms.
See Oracle Support Bulletins 106573.931 "(V45) Reading and Writing Text
Files" and 11165515.61 "Using the TEXT_IO Package"


Solution References:
====================

Bulletin 106573.931
(V45) Reading and Writing Text Files

Bulletin 11165515.61
Using the TEXT_IO Package



WIN 32-BIT: D2KWUTIL UTILITY IS AVAILABLE

Solution Description:
=====================

The following is a summary of how you can access various types of
Environment Variables on Windows platforms:

1. Values in INI files (e.g. the old ORACLE.INI or SYSTEM.INI which
duplicates some Registry info on Win95):

To Read: Win_API_Environment.Read_INI_File in D2KWUTIL
To Write: Win_API_Environment.Write_INI_FILE in D2KWUTIL

2. Values in the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE section of the registry

To Read: TOOL_ENV.GETVAR() built-in
To Write: Win_API_Environment.Write_Registry in D2KWUTIL

3. Values in other sections of the registry

To Read: Win_API_Environment.Read_Registry in D2KWUTIL
To Write: Win_API_Environment.Write_Registry in D2KWUTIL

4. "DOS" environment Variables (e.g. PATH set in AUTOEXEC.BAT)

To Read: Win_API_Environment.Get_Environment_String in D2KWUTIL


Solution Explanation:
=====================

The D2KWUTIL utility is currently available for 32-bit ports only.
It is on the 32 bit Developer/2000 r1.3.2 cd-rom in the fdemo45 directory but
this is not the latest version. The latest version can be obtained via email
from Oracle WorldWide Support.

SOME of the Functions the Utility Provides:
-------------------------------------------
* Read and Write Registry
* Environment functions:
Get DOS variable
Get Windows Username
Get Windows Directory
Get Temp Directory


Solution References:
====================
Note 1015929.4
SEE DEV/2000 R1.3.2 RELEASE NOTES;
C:\ORACLE_HOME\FORMS45\DOC\RELNOTES.WRI
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

Assalam-o-Alaikum

thank you very much for you kind help, please give me only example of using DLL in developer i have a software in VB for geting HDD serial using DLL please if possible please send me only one example of using DLL in Developer 6i. and i am using developer 6i and there is no release note file available for help.

once again thank you

Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
admin
Posts: 2062
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Post by admin »

Here is the way you can get client info,

SQL> SELECT sys_context('USERENV', 'OS_USER') FROM dual;

SYS_CONTEXT('USERENV','OS_USER')
-------------------------------------------------------------
sikandar

SQL> ed
Wrote file afiedt.buf

1* SELECT sys_context('USERENV', 'IP_ADDRESS') FROM dual
SQL> /

SYS_CONTEXT('USERENV','IP_ADDRESS')
-------------------------------------------------------------
92.10.1.1 << I have changed it for security purpose.

SQL>

More detail is available at the following link,
http://download-west.oracle.com/docs/cd ... .htm#88703
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

Assalam-o-Alaikum

thank you very much for you kind help, i got IP_Address of machie, but this query fails

SQL> SELECT sys_context('USERENV', 'OS_USER') FROM dual;
SELECT sys_context('USERENV', 'OS_USER') FROM dual
*
ERROR at line 1:
ORA-02003: invalid USERENV parameter

waiting from your repaly for HDD serial number


Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
admin
Posts: 2062
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Post by admin »

To get hard disk serial number here is the sample,

http://www.orafaq.com/forum/t/50371/68790/
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

Assalam-o-Alaikum

Very very very thankyou for your kind help, you have done a greate job.........

Allah aap ko khush rekhay

Best regards,
R E H A N M I R Z A
System Analyst / Senior Oracle Developer
Cell: +92-304-2120807

When ever you pray
Please remember me and my family
ahmadbilal
Posts: 615
Joined: Mon Sep 18, 2006 1:32 am
Location: United Arab Emirates
Contact:

Post by ahmadbilal »

SELECT sys_context('USERENV', 'OS_USER') FROM dual;

Command Get Username Where The Database Installed if you are working in Clinet Server Env. Either runing oracle Applocation server or simply forms runtime you can not get the dataentry machine IP or Username

For Example if Server machine named as SERVER having user name X
and three Clients
A with username W
B With username R
C With username Q

When You Query This
SELECT sys_context('USERENV', 'OS_USER') FROM dual;
U Can Get Username X On machine Server

For This Purpose You have To investigate the Function <b>Change Organization</b> Of oracle Business Suite.
mirza_rehan
Posts: 132
Joined: Sun Apr 02, 2006 10:36 am
Location: Pakistan

Post by mirza_rehan »

No Ahmed you are absolutely wrong i will give client machine and osuser name

take care
Allah Hafiz
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests