Thursday, 16 February 2017

Identifying Host Names and IP Addresses

Identifying Host Names and IP Addresses
This article presents a mixed bag of Oracle functionality relating to the identification of host names and IP addresses for Oracle clients and servers.
UTL_INADDR
The UTL_INADDR package was introduced in Oracle 8.1.6 to provide a means of retrieving host names and IP addresses of remote hosts from PL/SQL.
The GET_HOST_ADDRESS function returns the IP address of the specified host name.
SQL> SELECT UTL_INADDR.get_host_address('bart') FROM dual;

UTL_INADDR.GET_HOST_ADDRESS('BART')
--------------------------------------------------------------------------------
192.168.2.4

SQL>
The IP address of the database server is returned if the specified host name is NULL or is omitted.
SQL> SELECT UTL_INADDR.get_host_address from dual;

GET_HOST_ADDRESS
--------------------------------------------------------------------------------
192.168.2.5

SQL>

An error is returned if the specified host name is not recognized.
SQL> SELECT * UTL_INADDR.get_host_address('banana') from dual;
SELECT * UTL_INADDR.get_host_address('banana') from dual
ERROR at line 1:
ORA-29257: host banana unknown
ORA-06512: at "SYS.UTL_INADDR", line 19
ORA-06512: at "SYS.UTL_INADDR", line 40
ORA-06512: at line 1
SQL>
The GET_HOST_ADDRESS function returns the host name of the specified IP address.
SQL> SELECT UTL_INADDR.get_host_name('192.168.2.4') FROM dual;

UTL_INADDR.GET_HOST_NAME('192.168.2.4')
--------------------------------------------------------------------------------
bart

SQL>
The host name of the database server is returned if the specified IP address is NULL or omitted.
SQL> SELECT UTL_INADDR.get_host_name FROM dual;
GET_HOST_NAME
--------------------------------------------------------------------------------
C4210gR2                                                                     
1 row selected.                                                            
SQL>

An error is returned if the specified IP address is not recognized.
SQL> SELECT * UTL_INADDR.get_host_name('1.1.1.1') FROM dual;
SELECT * UTL_INADDR.get_host_name('1.1.1.1') FROM dual;
ERROR at line 1:
ORA-29257: host 1.1.1.1 unknown
ORA-06512: at "SYS.UTL_INADDR", line 4
ORA-06512: at "SYS.UTL_INADDR", line 35
ORA-06512: at line 1
SQL>
SYS_CONTEXT
The SYS_CONTEXT function is able to return the following host and IP address information for the current session:
  • TERMINAL - An operating system identifier for the current session. This is often the client machine name.
  • HOST - The host name of the client machine.
  • IP_ADDRESS - The IP address of the client machine.
  • SERVER_HOST - The host name of the server running the database instance.
The following examples show the typical output for each variant.
SQL> SELECT SYS_CONTEXT('USERENV','TERMINAL') FROM dual;
SYS_CONTEXT('USERENV','TERMINAL')
--------------------------------------------------------------------
marge
1 row selected.
SQL> SELECT SYS_CONTEXT('USERENV','HOST') FROM dual;
SYS_CONTEXT('USERENV','HOST')
--------------------------------------------------------------------
marge
1 row selected.

SQL> SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') FROM dual;

SYS_CONTEXT('USERENV','IP_ADDRESS')
--------------------------------------------------------------------
192.168.2.3
1 row selected.
SQL> SELECT SYS_CONTEXT('USERENV','SERVER_HOST') FROM dual;
SYS_CONTEXT('USERENV','SERVER_HOST')
--------------------------------------------------------------------
C4210gr2
1 row selected.
SQL>
V$INSTANCE
The HOST_NAME column of the V$INSTANCE view contains the host name of the server running the instance.
SQL> SELECT host_name FROM v$instance;

HOST_NAME
------------------------------------------------
C4210gR2

1 row selected.

SQL>



V$SESSION
The V$SESSION view contains the following host information for all database sessions:
  • TERMINAL -The operating system terminal name for the client. This is often set to the client machine name.
  • MACHINE -The operating system name for the client machine. This may include the domain name if present.
The following examples show the typical output for each column.
SQL> SELECT terminal, machine FROM v$session WHERE username = 'TIM_HALL';

TERMINAL                       MACHINE
------------------------------ ----------------------------------------------------
MARGE                          ORACLE-BASE\MARGE

1 row selected.                                                            

SQL>

Tuesday, 10 January 2017

Adding a Component in 11g or 12c

Create New Report Server in Oracle 12c and 11g
Oracle 12c Methods:
1.    Create a reports tools instance (Mandatory, if you are planning to use the same box for reports development)
2.    Create a reports server instance (OPTIONAL, only if you want to host a standalone reports instance)
3.    Goto‘C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Classic_domain\bin>
startComponent<Report Server name>’
Start WLST(Weblogic Scripting Tool) console, and execute the below commands one after another (Make sure the node manager & the Weblogic admin server services are already started)
connect("weblogic","weblogic password", "hostname:7001")
my weblogic password :weblogic123
my hostname : localhost
createReportsToolsInstance(instanceName='reptools1', machine='AdminServerMachine')
createReportsServerInstance(instanceName='repserver', machine='AdminServerMachine')
exit()
Oracle 11g Methods:
For running reports, if you need to create a new standalone report server, you can do so by the following steps:
1.     Go to %ORACLE_INSTANCE%\bin ($ORACLE_INSTANCE/bin in Unix)
2.     Type in “opmnctl status” to see if opmn is running. If not, run “opmnctl startall”.
3.     Type in the following to create a new standalone reports server: 
opmnctl createcomponent -adminUsername weblogic -adminHost full_computer_hostname -adminPort 7001 -oracleHome C:\Oracle\Middleware\as_1 -oracleInstance C:\Oracle\Middleware\asinst_1 -instanceName asinst_1 -componentName name_of_report_server -componentType ReportsServerComponent
Example : opmnctl createcomponent –adminUsername weblogic –adminhost localhost –adminport 7001 –oracleHome C:\Oracle\Middleware\FRMHome_1 –oracleInstance  C:\Oracle\Middleware\asinst_1 –instanceName asinst_1 –componentName repserver –componentType ReportServerComponent
4.     Start the server “opmnctl startproc ias-component=name_of_report_server”

REP-51019: System user authentication is missing.

Error:
REP-51019: System user authentication is missing.
Solution:
First take a back/rename up of your rwserver.conf original file.

Some changes required in rwserver.conf
remove security tag from

<job jobType="report" engineId="rwEng" securityId="rwJaznSec"/>
to
<job jobType="report" engineId="rwEng"/>

And
Comment the line below from
<security id="rwJaznSec" class="oracle.reports.server.RWJAZNSecurity"/> to <!--security id="rwJaznSec" class="oracle.reports.server.RWJAZNSecurity"/-->

You will find the rwserver.conf file from the below path.

C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Classic_domain\config\fmwconfig\components\ReportsServerComponent\Your_report_server_name\rwserver.conf

C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Classic_domain\config\fmwconfig\servers\WLS_REPORTS\applications\reports_12.2.1\configuration\rwserver.conf

C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Classic_domain\config\fmwconfig\components\ReportsToolsComponent\reptools1\rwserver.conf


1)    Make single signon yes
2)      Add the below <webcommandaccess>L2</webcommandaccess> 

Path may be different from machine to machine.

Check with your path.

Restart your Report Server….

Displaying Icon on Button in Oracle Forms 12c


Icons Buttons in 12c Fusion Middleware.
1. Start the following Services
     Start Weblogic Admin Server
     Start Weblogic Server WLS_FORMS
2. copy the icon folder in following path
    C:\Oracle\Middleware\<ORACLE_HOME>\forms\java

3. Switch to command Prompt
   cd C:\Oracle\Middleware\<ORACLE_HOME>\forms\java\icons
   now apply the following command
   C:\Oracle\Middleware\<ORACLE_HOME>\forms\java\icons>C:\Oracle\Middleware\<ORACLE_HOME>\oracle_common\jdk\bin\jar -cvf frmicons.jar *.gif


4.copy the icons.jar file into C:\Oracle\Middleware\<ORACLE_HOME>\forms\java

5. Edit/update formsweb.cfg file: (Don’t Forget to take back up File)
Path=C:\Oracle\Middleware\<ORACLE_HOME>\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_12.1.1\config\formsweb.cfg  …to update/include:
Forms applet parameter
codebase=/forms/java
# Forms applet parameter
imageBase=codebase
# Forms applet archive setting for other clients (Sun Java Plugin…etc)
archive=frmall.jar,frmicons.jar
# Forms applet archive setting for JInitiator
archive_jini=frmall_jinit.jar,frmicons.jar[/text]

6. Edit/update Registry.dat file: (Don’t Forget to take back up File)
Path=C:\Oracle\Middleware\<ORACLE_HOME>\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_12.1.1\config\forms\registry\oracle\forms\registry\Registry.dat
[text]default.icons.iconpath=icons/
default.icons.iconextension=gif[/text]

7. At the end of CLASSPATH in DEFAULT.env add the following value
  ;C:\Oracle\Middleware\<ORACLE_HOME>\forms\java\icons.jar
8. a block message appear from java, press do not block
9. now run your forms.

The path and drive i used to this practical its created on my PC, but you must change the path and drive where you install the oracle forms.

Character Set Change


--------------Steps to change the database character set------------


To change the database character set, perform the following steps:

1. Shut down the database, using either a SHUTDOWN IMMEDIATE or a SHUTDOWN NORMAL statement.

2. Do a full backup of the database because the ALTER DATABASE CHARACTER SET statement cannot be rolled back.

3. Startup Oracle database

SQL> startup mount;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET AL32UTF8;
If you get the error ORA-12712, please update the following table.

"ORA-12712: new character set must be a superset of old character set"

SQL> update sys.props$ set VALUE$='AL32UTF8' where NAME='NLS_CHARACTERSET';
SQL> commit;
If you get the error ORA-12721, please login as DBA user.

"ORA-12721: operation cannot execute when other sessions are active"

4. shutdown immediate; or shutdown normal;

5. startup oracle database

SQL> startup mount;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET AL32UTF8;
select open_mode from v$database;
SQL> shutdown immediate;
SQL> startup;

--------------------Check the NLS parameters--------------------------

SQL> SELECT PARAMETER, VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET');

Wednesday, 14 December 2016

RENAME REPORT SERVER 11G


RENAME REPORT SERVER 11G

Start:
Step 1.  Open Command Prompt.
Step 2. cd C:\Middleware\asinst_1\bin.
Step 3.  Execute command "opmnctl stopall ".



Step 4.  cd C:\Middleware\Oracle_FRHome1\BIN
Step 5.  Execute command "emctl stop agent ".





Step 6.  Go to C:\Middleware\asinst_1\config\OPMN\opmn
Edit and update the report server name in following…
\opmn.xml







Step 7. Go to C:\Middleware\asinst_1\config\ReportsServerComponent\repserver
Rename the folder name same as Report server name.



Step 8. Go to C:\Middleware\asinst_1\config\ReportsServerComponent\repserver
Change reports server name in following...
\component-logs.xml.
\logging.xml.