DisplayAdd1

TechnoTechDB is a platform, which will help to grow your carrier in Information sector. Having 15 years of Experience in Oracle/MongoDB/Postgres/Mysql databases, along with having good expertise level of knowledge in Scripting to automate database task. Our goal to start with zero to hero level expertise in Database. You can access/refer my some blogs on https://mrorcldba.blogspot.com link and post your comments and your suggestion to motive us.

Friday, 30 June 2023

How to Enable X11 in Linux

    ┌───────────────────────────────────────────────────┐
    │                 • MobaXterm Personal Edition v22.0 •                                               
    │               (SSH client, X server and network tools)                                              
    │                                                                                                                        
    │ ➤ SSH session to opc@XXXXXX                                                                          
    │   • Direct SSH      :  ✔                                                                                       
    │   • SSH compression :  ✔                                                                                  
    │   • SSH-browser     :  ✔                                                                                     │ 
    │   • X11-forwarding  :  ✘  (disabled or not supported by server)                          
    │                                                                                                                        
    │ ➤ For more info, ctrl+click on help or visit our website.                                  
    └───────────────────────────────────────────────────┘

Activate the web console with: systemctl enable --now cockpit.socket

[root@instance ~]# sudo yum install xorg-x11-xauth
Last metadata expiration check: 0:02:38 ago on Fri 30 Jun 2023 07:43:21 AM GMT.
Dependencies resolved.
===================================================================================================
 Package                          Architecture             Version                          Repository                       Size
===================================================================================================
Installing:
 xorg-x11-xauth                   x86_64                   1:1.0.9-12.el8                   ol8_appstream                    39 k
Installing dependencies:
 libICE                           x86_64                   1.0.9-15.el8                     ol8_appstream                    74 k
 libSM                            x86_64                   1.2.3-1.el8                      ol8_appstream                    47 k
 libXmu                           x86_64                   1.1.3-1.el8                      ol8_appstream                    75 k
 libXt                            x86_64                   1.1.5-12.el8                     ol8_appstream                   185 k

Transaction Summary
===================================================================================================
Install  5 Packages

Total download size: 421 k
Installed size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): libSM-1.2.3-1.el8.x86_64.rpm                                                               432 kB/s |  47 kB     00:00
(2/5): libICE-1.0.9-15.el8.x86_64.rpm                                                             544 kB/s |  74 kB     00:00
(3/5): libXt-1.1.5-12.el8.x86_64.rpm                                                              2.6 MB/s | 185 kB     00:00
(4/5): xorg-x11-xauth-1.0.9-12.el8.x86_64.rpm                                                     656 kB/s |  39 kB     00:00
(5/5): libXmu-1.1.3-1.el8.x86_64.rpm                                                              253 kB/s |  75 kB     00:00
----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                             1.4 MB/s | 421 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                          1/1
  Installing       : libICE-1.0.9-15.el8.x86_64                                                                               1/5
  Installing       : libSM-1.2.3-1.el8.x86_64                                                                                 2/5
  Installing       : libXt-1.1.5-12.el8.x86_64                                                                                3/5
  Installing       : libXmu-1.1.3-1.el8.x86_64                                                                                4/5
  Installing       : xorg-x11-xauth-1:1.0.9-12.el8.x86_64                                                                     5/5
  Running scriptlet: xorg-x11-xauth-1:1.0.9-12.el8.x86_64                                                                     5/5
  Verifying        : libICE-1.0.9-15.el8.x86_64                                                                               1/5
  Verifying        : libSM-1.2.3-1.el8.x86_64                                                                                 2/5
  Verifying        : libXmu-1.1.3-1.el8.x86_64                                                                                3/5
  Verifying        : libXt-1.1.5-12.el8.x86_64                                                                                4/5
  Verifying        : xorg-x11-xauth-1:1.0.9-12.el8.x86_64                                                                     5/5
Installed:
  libICE-1.0.9-15.el8.x86_64              libSM-1.2.3-1.el8.x86_64    libXmu-1.1.3-1.el8.x86_64    libXt-1.1.5-12.el8.x86_64
  xorg-x11-xauth-1:1.0.9-12.el8.x86_64

Complete!
[root@instance ~]# sudo yum install xterm
Last metadata expiration check: 0:02:48 ago on Fri 30 Jun 2023 07:43:21 AM GMT.
Dependencies resolved.
===================================================================================================
 Package                             Architecture           Version                           Repository                     Size
===================================================================================================
Installing:
 xterm                               x86_64            331-1.el8_3.2                     ol8_appstream                 528 k
Installing dependencies:
 libXaw                              x86_64                 1.0.13-10.el8                     ol8_appstream                 194 k
 libXft                              x86_64                 2.3.3-1.el8                       ol8_appstream                  67 k
 libXpm                              x86_64                 3.5.12-9.el8_7                    ol8_appstream                  58 k
 libfontenc                          x86_64                 1.1.3-8.el8                       ol8_appstream                  37 k
 xorg-x11-font-utils                 x86_64                 1:7.5-41.el8                      ol8_appstream                 104 k
 xterm-resize                        x86_64                 331-1.el8_3.2                     ol8_appstream                  38 k
Installing weak dependencies:
 xorg-x11-fonts-misc                 noarch                 7.5-19.el8                        ol8_appstream                 5.8 M

Transaction Summary
===================================================================================================
Install  8 Packages
Total download size: 6.8 M
Installed size: 9.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): libXpm-3.5.12-9.el8_7.x86_64.rpm                                                           748 kB/s |  58 kB     00:00
(2/8): libXaw-1.0.13-10.el8.x86_64.rpm                                                            1.1 MB/s | 194 kB     00:00
(3/8): libXft-2.3.3-1.el8.x86_64.rpm                                                              386 kB/s |  67 kB     00:00
(4/8): libfontenc-1.1.3-8.el8.x86_64.rpm                                                          375 kB/s |  37 kB     00:00
(5/8): xterm-331-1.el8_3.2.x86_64.rpm                                                             4.9 MB/s | 528 kB     00:00
(6/8): xorg-x11-font-utils-7.5-41.el8.x86_64.rpm                                                  819 kB/s | 104 kB     00:00
(7/8): xterm-resize-331-1.el8_3.2.x86_64.rpm                                                      377 kB/s |  38 kB     00:00
(8/8): xorg-x11-fonts-misc-7.5-19.el8.noarch.rpm                                                   19 MB/s | 5.8 MB     00:00
----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                              14 MB/s | 6.8 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                          1/1
  Installing       : libXpm-3.5.12-9.el8_7.x86_64                                                                             1/8
  Installing       : libXaw-1.0.13-10.el8.x86_64                                                                              2/8
  Installing       : xterm-resize-331-1.el8_3.2.x86_64                                                                        3/8
  Installing       : libfontenc-1.1.3-8.el8.x86_64                                                                            4/8
  Installing       : xorg-x11-font-utils-1:7.5-41.el8.x86_64                                                                  5/8
  Installing       : xorg-x11-fonts-misc-7.5-19.el8.noarch                                                                    6/8
  Running scriptlet: xorg-x11-fonts-misc-7.5-19.el8.noarch                                                                    6/8
  Installing       : libXft-2.3.3-1.el8.x86_64                                                                                7/8
  Installing       : xterm-331-1.el8_3.2.x86_64                                                                               8/8
  Running scriptlet: xterm-331-1.el8_3.2.x86_64                                                                               8/8
  Verifying        : libXaw-1.0.13-10.el8.x86_64                                                                              1/8
  Verifying        : libXft-2.3.3-1.el8.x86_64                                                                                2/8
  Verifying        : libXpm-3.5.12-9.el8_7.x86_64                                                                             3/8
  Verifying        : libfontenc-1.1.3-8.el8.x86_64                                                                            4/8
  Verifying        : xorg-x11-font-utils-1:7.5-41.el8.x86_64                                                                  5/8
  Verifying        : xorg-x11-fonts-misc-7.5-19.el8.noarch                                                                    6/8
  Verifying        : xterm-331-1.el8_3.2.x86_64                                                                               7/8
  Verifying        : xterm-resize-331-1.el8_3.2.x86_64                                                                        8/8

Installed:
  libXaw-1.0.13-10.el8.x86_64          libXft-2.3.3-1.el8.x86_64                      libXpm-3.5.12-9.el8_7.x86_64
  libfontenc-1.1.3-8.el8.x86_64        xorg-x11-font-utils-1:7.5-41.el8.x86_64        xorg-x11-fonts-misc-7.5-19.el8.noarch
  xterm-331-1.el8_3.2.x86_64           xterm-resize-331-1.el8_3.2.x86_64

Complete!
[root@instance ~]#

Wednesday, 21 June 2023

Oracle Database Query Running more than 1 minutes and will kill automatically

Hello Friends, 

Below script help us to get SID and Serial details which is running more than 1 minutes and will kill automatically if you will keep below steps into a .sql file and run it from sql prompt. Please refer below screenshot. 

















SQL> select  round(last_call_et / 60,2) Time_in_mins, sid, serial# from gv$session where type<>'BACKGROUND' and username<>'SYS' and username <> 'DBSNMP' and last_call_et / 60 > 1;

no rows selected

SQL> select  round(last_call_et / 60,2) Time_in_mins, sid, serial# from gv$session where type<>'BACKGROUND' and username<>'SYS' and username <> 'DBSNMP' and last_call_et / 60 > 1;

TIME_IN_MINS        SID    SERIAL#

------------ ---------- ----------

        12.6         15         21

        12.6        125         63

        12.6        138         55

SQL> set pagesize 0 linesize 1000 feedback off verify off trimspool on heading off echo off

SQL> SET SERVEROUTPUT ON

SQL> SET PAGESIZE 500

SQL> SET LINESIZE 300

SQL> spool /tmp/sid_kill.sql

SQL> select  'alter system kill session '''||sid||','||serial#||'''immediate ;' from gv$session where type<>'BACKGROUND' and username<>'SYS' and username <> 'DBSNMP' and last_call_et / 60 > 1;

alter system kill session '15,21'immediate ;

alter system kill session '125,63'immediate ;

alter system kill session '138,55'immediate ;

SQL> spool off;

SQL> set pagesize 0 linesize 1000 feedback on verify on trimspool on heading on echo on

SQL> @/tmp/sid_kill.sql

SQL> SQL> select  'alter system kill session '''||sid||','||serial#||'''immediate ;' from gv$session where type<>'BACKGROUND' and username<>'SYS' and username <> 'DBSNMP' and last_call_et / 60 > 1;

SQL> alter system kill session '15,21'immediate ;

System altered.

SQL> alter system kill session '125,63'immediate ;

System altered.

SQL> alter system kill session '138,55'immediate ;

System altered.

SQL> spool off;

SQL> exec dbms_lock.sleep(5);

PL/SQL procedure successfully completed.

SQL> select  sid, serial# from gv$session where type<>'BACKGROUND' and username<>'SYS' and username <> 'DBSNMP' and last_call_et / 60 > 1;

no rows selected

Sunday, 18 June 2023

TRANSPOSE Column to Rows in Linux script

Below commands I have used in Oracle query where some time I need to put data in IN clause from txt file manually or with other method. But with this commands you can put in script it will automatically generate syntax format for ORACLE IN Clause  
















[oracle@oracle11g ]cat sqlid.txt    <<--- Input
c3yw7auzsah15
378r7ukq8caam
9y55n98wubu9d
f7m1bh706uqss


[oracle@oracle11g ]$ cat /tmp//sqlid.txt | while read a
> do
> _sqlid+="'$a',"
> echo $_sqlid >/tmp//_sqlid1.log
> done
[oracle@oracle11g ]$ cat /tmp//_sqlid1.log
'c3yw7auzsah15','378r7ukq8caam','9y55n98wubu9d','f7m1bh706uqss',
[oracle@oracle11g ]$



[oracle@oracle11g ]$ _sid_lst=`  cat /tmp//_sqlid1.log | rev | cut -c2- | rev`
[oracle@oracle11g ]$ echo $_sid_lst
'c3yw7auzsah15','378r7ukq8caam','9y55n98wubu9d','f7m1bh706uqss'     <-- Output


Monday, 12 June 2023

Direct upgrade and Migrate DB from 11.2.0.4 to 19c PDB

 /opt/oracle/product/19c/dbhome_1/jdk/bin/java -jar /opt/oracle/product/19c/dbhome_1/rdbms/admin/autoupgrade.jar -create_sample_file config



cat /home/oracle/autoupg/11204upgrade.cfg

global.autoupg_log_dir=/opt/oracle/cfgtoollogs/autoupgrade

upg1.sid=orcl1

upg1.dbname=orcl1

upg1.start_time=NOW

upg1.source_home=/opt/oracle/product/11g/dbhome_1

upg1.log_dir=/home/oracle/autoupg

upg1.target_home=/opt/oracle/product/19c/dbhome_1

upg1.upgrade_node=oracle11g

upg1.target_version=19.1.0

upg1.run_utlrp=yes

upg1.timezone_upg=yes

upg1.target_cdb=cdb1


/opt/oracle/product/19c/dbhome_1/jdk/bin/java -jar /opt/oracle/product/19c/dbhome_1/rdbms/admin/autoupgrade.jar -config /home/oracle/autoupg/11204upgrade.cfg -mode ANALYZE



/opt/oracle/product/19c/dbhome_1/jdk/bin/java -jar /opt/oracle/product/19c/dbhome_1/rdbms/admin/autoupgrade.jar -config /home/oracle/autoupg/11204upgrade.cfg -mode DEPLOY



















Steps to Rename Host in Oracle RESTART (ASM) in Linux

  oracle@localhost ] asmcmd ASMCMD> lsdg State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_...