Friday, 30 October 2020

Password prompt taking long time Linux Centos 7

 RHEL7:

Symptom: 34 seconds to prompt password ssh login
Solution (my case):
- vi /etc/ssh/sshd_config
- GSSAPIAuthentication no
- service sshd restart

vi /etc/ssh/sshd_config
UseDNS no

vi /etc/resolv.conf
options single-request-reopen ;in the last line. No network restart required

Monday, 31 August 2020

Oracle Database Find blocking sessions

 select v.sql_text,v.sql_fulltext,sub.* from v$sql v,

(select sample_time,s.sql_id sql_id, session_state, blocking_session,

owner||'.'||object_name||':'||nvl(subobject_name,'-') obj_name,s.program,s.module,s.machine

from dba_hist_active_sess_history s, dba_objects o

where event = 'enq: TX - row lock contention'

and o.data_object_id = s.current_obj#

order by 1 desc) sub where sub.sql_id=v.sql_id;



select s1.username || '@' || s1.machine

|| ' ( THIS SID=' || s1.sid || ' )  is blocking '

|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status

from gv$lock l1, gv$session s1, gv$lock l2, gv$session s2

where s1.sid=l1.sid and s2.sid=l2.sid

and l1.BLOCK=1 and l2.request > 0

and l1.id1 = l2.id1

and l2.id2 = l2.id2 ;




SELECT 

'alter system kill session ''' || SID || ',' || s.serial# || ',@'||inst_id||''' immdiate;',sid,username,serial#,process,NVL (sql_id, 0),

sql_address,blocking_session,wait_class,event,p1,p2,p3,seconds_in_wait

FROM gv$session s WHERE blocking_session_status = 'VALID'

OR sid IN (SELECT blocking_session

FROM gv$session WHERE blocking_session_status = 'VALID');

Thursday, 6 August 2020

Import an Oracle APEX Application export file from a higher version into a lower version

Follow the below process to know how and where to change required details:

  • Create one dummy application in target instance and export it
  • Compare export files from source instance and target instance as shown in below table. It can be seen that the p_version and p_release parameter values are different in both the files
In source instance (18.1)  

begin

wwv_flow_api.import_begin (

 p_version_yyyy_mm_dd=>'2018.04.04'

,p_release=>'18.1.0.00.45'

,p_default_workspace_id=>XXXXXXX

,p_default_application_id=>XXXXXX

,p_default_owner=>'XXX'

);

end;
In target instance (5.1.4)

begin

wwv_flow_api.import_begin (

 p_version_yyyy_mm_dd=>'2016.08.24'

,p_release=>'5.1.4.00.08'

,p_default_workspace_id=>XXXXXXX

,p_default_application_id=>XXXXXXX

,p_default_owner=>'XXXX'

);

end;
  • So, change the parameter values of import_begin procedure in source export file. For e.g., the release and the version parameters in export file
    from ‘18.1.0.00.45’  to ‘5.1.4.00.08‘ and
    from    ‘2018.04.04’    to ‘2016.08.24’ respectively
  • Import edited export file in target instance this time it will allow you to run the script

Friday, 3 July 2020

DUPLICATE DATABASE from backup location 11.2 and later

alter system set DB_FILE_NAME_CONVERT='/u01/oradata/psgprod/PSGPROD/datafile/','/u02/oradata/psgtest/' scope=spfile;
alter system set LOG_FILE_NAME_CONVERT='/u01/oradata/psgprod/PSGPROD/datafile/','/u02/oradata/psgtest/' scope=spfile;

run
{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux4 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux11 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux12 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux13 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux14 DEVICE TYPE DISK;
DUPLICATE DATABASE TO psgtest
 BACKUP LOCATION '/u02/backup';
}




Thursday, 25 June 2020

R12.2 ADOP Query object compilation

select * from
(
select
eusr.user_name owner
, count(decode(obj.type#,88,NULL,decode(obj.status,1,NULL,1))) Actual
, count(decode(obj.type#,88,decode(obj.status,1,NULL,1),NULL)) Stub
, count(decode(obj.type#,88,decode(obj.status,1,NULL,1),decode(obj.status,1,NULL,1))) Total
from
sys.obj$ obj
, sys.obj$ bobj
, (
select
xusr.user#
, xusr.ext_username user_name
, ed.name edition_name
from
(select * from sys.user$ where type# = 2) xusr
, (select * from sys.obj$ where owner# = 0 and type# = 57) ed
where xusr.spare2 = ed.obj#
union
select
busr.user#
, busr.name user_name
, ed.name edition_name
from
(select * from sys.user$ where type# = 1 or user# = 1) busr
, (select * from sys.obj$ where owner# = 0 and type# = 57) ed
where ed.name = 'ORA$BASE'
) eusr
where obj.owner# = eusr.user#
and bobj.obj#(+) = obj.dataobj#
and obj.type# not in (0, 10)
and ( obj.type# =88 or (obj.type# = 88 and bobj.type# =10) )
and obj.remoteowner is null
group by eusr.user_name
) x
where total > 0
order by 1;

Wednesday, 20 May 2020

APEX 20.1 Installation steps for Windows




1- After download the apex_20.1.zip file extract the contents to c:\apex201\apex folder.
2- Open cmd and go  inside this path C:\apex201\apex
3- Connect as sys user:  sqlplus / as sysdba
4- After connecting to sqlplus run the installation script: @apexins.sql SYSAUX SYSAUX TEMP /i/
At the end of the script you will receive as below output:
Oracle Application Express is installed in the APEX_200100 schema.

The structure of the link to the Application Express administration services is as follows:
http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
http://host:port/apex/apex_admin     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex/apex_admin     (Oracle REST Data Services)

The structure of the link to the Application Express development interface is as follows:
http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)
http://host:port/apex     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex     (Oracle REST Data Services)

timing for: Phase 3 (Switch)
Elapsed: 00:01:35.41
timing for: Complete Installation
Elapsed: 00:23:58.38

PL/SQL procedure successfully completed.





1 row selected.

Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

C:\apex201\apex>


5- Connect again as sys user:  sqlplus / as sysdba
6- After connecting to sqlplus run the installation script: @apxchpwd.sql, provide instance admin password:
...set_appun.sql
================================================================================
This script can be used to change the password of an Application Express
instance administrator. If the user does not yet exist, a user record will be
created.
================================================================================
Enter the administrator's username [ADMIN]
User "ADMIN" exists.
Enter ADMIN's email [ADMIN]
Enter ADMIN's password []
Changed password of instance administrator ADMIN.



7- Connect again as sys user:  sqlplus / as sysdba  and run script
@apex_epg_config.sql  C:\apex201

8- Unlock users  users by run below scripts:

ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER IDENTIFIED BY Tahaluf_123;

9- Configure Apex RESTful Services, run and provide passwords:
@apex_rest_config.sql

10- Set the http port:

EXEC DBMS_XDB.SETHTTPPORT(9191);

11- Run below script to configure ACL Prior to Oracle Database 12c database:
/* Then run the below script */
Declare
    acl_path Varchar2(4000);
Begin
  -- Look for the ACL currently assigned to '*' and give APEX_200100
  -- the "connect" privilege if APEX_200100 does not have the privilege yet.
    Select
        acl
    Into acl_path
    From
        dba_network_acls
    Where
        host = '*'
        And lower_port Is Null
        And upper_port Is Null;

    If dbms_network_acl_admin.check_privilege(acl_path, 'APEX_200100', 'connect') Is Null Then
        dbms_network_acl_admin.add_privilege(acl_path, 'APEX_200100', true, 'connect');
    End If;

Exception
  -- When no ACL has been assigned to '*'.
    When no_data_found Then
        dbms_network_acl_admin.create_acl('power_users.xml', 'ACL that lets power users to connect to everywhere', 'APEX_200100',
        true, 'connect');
        dbms_network_acl_admin.assign_acl('power_users.xml', '*');
End;
/

Commit;

for Oracle Database 12c or later run the following script:
/* Then execute the below script */
Begin
    DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
        host => '*',
        ace => xs$ace_type(privilege_list => xs$name_list('connect'),
                           principal_name => 'APEX_200100',
                           principal_type => xs_acl.ptype_db));
End;
/


11- Access using the url http://localhost:8181/apex/apex_admin

12 - Execute the following as sys user:
ALTER USER ANONYMOUS ACCOUNT UNLOCK;
ALTER USER ANONYMOUS IDENTIFIED BY Tahaluf_123;

Monday, 11 May 2020

EBS R12.2: ADOP Online Patching - Set Up Secure Shell(ssh) on Application Tier Nodes

[oraapp@pft1 ~]$ perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl enablessh -contextfile=/u01/app/EBS/fs2/inst/apps/EBS_pft1/appl/admin/EBS_pft1.xml -hosts=pft1,pft2
Enter SSH User password for the OS user oraapp:
    Log: /u01/app/EBS/fs2/inst/apps/EBS_pft1/logs/appl/rgf/TXK/enablessh.log

SSH equivalence setup successful.

Number of Visitors