Tags

11g (5) 12c (6) 18c (3) 19c (4) ASM (1) Critical Patch (11) Data Pump (1) Dataguard (9) Diverse (3) GRID (7) GitLab (2) Linux (8) OEM (2) ORA Errors (13) Oracle (12) RMAN (4)

Sunday, February 5, 2023

VNC Server Installation Steps

 VNC Server Installation Steps

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

yum groupinstall "Server with GUI"
unalias shutdown
shutdown -r now
yum install tigervnc-server xorg-x11-fonts-Type1
yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils

vncpasswd


pwd
/root
cd .vnc/

The File config file looks like as follow and no need to change.

vi .vnc/config

# securitytypes=vncauth,tlsvnc
# desktop=sandbox
# geometry=2000x1200
# 1920x1200
# localhost
# alwaysshared


VNC start stop script

Create a VNC start script as follow. 

more startVNC_55
vncserver -kill :55
sleep 5
vncserver :55 -geometry 1920x1200


./startVNC_55 &

ps -ef|grep vnc


MobaX

hostname=vm-adm-vnc-th.com

port=5955


For DISPLAY

NOTE: check following setting 

vi /etc/ssh/sshd_config
Uncheck and set to no
X11UseLocalhost no
service sshd restart

xhost +

or

xhost

ssh username@hostname -X

Test with the command

xclock

Your comments are most valuable and it would help me to come up with better posts. 

PLS-00302:component

 PLS-00302: component 'UNLOCK_TABLE_STATS' must be declared

PLS-00302: component 'UNLOCK_TABLE_STATS' must be declared

ORA-06550: line 1, column 7:


PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

SQL> exec dbms_stats.unlock_table_stats( ownname => 'HR' , tabname => 'EMPLOYEES');
BEGIN dbms_stats.unlock_table_stats( ownname => 'HR' , tabname => 'EMPLOYEES'); END;

                 *
ERROR at line 1:
ORA-06550: line 1, column 18:
PLS-00302: component 'UNLOCK_TABLE_STATS' must be declared
ORA-06550: line 1, column 7:

PL/SQL: Statement ignored


Solution:

exec sys.DBMS_STATS.UNLOCK_TABLE_STATS( ownname => 'HR' , tabname => 'EMPLOYEES');


Your comments are most valuable and it would help me to come up with better posts. 

Wednesday, November 9, 2022

oracle create private public synonym command

Oracle create private public synonym command

How to create synonym in Oracle 

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment.  


Private Synonym:

1. Login as scheman user under where should create synonym

2.  schemaname is equal The Schema name for example. 

     TEST01

     TEST02

The user schema TEST01 should get synonym from all tables unter the schema TEST02 located.

Login as  TEST01

sqlplus TEST01

set echo off
set verify off
set pagesize 0
set trimspool on
set headsep off
set linesize 100
set heading off
set feedback off
set timing off
set time off
set termout off
set headsep off
spool create_private_synonom.sql
SELECT 'create public synonym ' || object_name || ' for 
TEST02.' || object_name || ' ;' FROM dba_objects
WHERE owner = '
TEST02'
AND object_type IN ('TABLE', 'SEQUENCE', 'VIEW', 'PROCEDURE', 'PACKAGE');
spool off


Verify the script before you execute. Examples line

...
create synonym EMPLOY_HR for TEST02.EMPLOY_HR ;
...

Execute the script as follow.
sqlplus TEST01
SQL> @create_private_synonom.sql


Or use simple different way.

set echo off
set feedback off; 
set heading off; 
set term off
set pagesize 1000
set linesize 100
SET PAGES 0
spool create_synonom_table.sql
select 'create synonym ' || table_name || ' for ' || owner || '.' || table_name || ';'  FROM all_tables WHERE owner='TEST02';
spool off

select 'create synonym ' ||view_name || ' for ' || owner || '.' || view_name || ';'  FROM all_views WHERE owner='TEST02';


Public Synonym:

For Public synonym we need to just add the keyword public.

SELECT 'create public synonym ' || object_name || ' for TEST02.' || object_name || ' ;' FROM dba_objects
WHERE owner = 'TEST02'
AND object_type IN ('TABLE', 'SEQUENCE', 'VIEW', 'PROCEDURE', 'PACKAGE');

Your comments are most valuable and it would help me to come up with better posts.

Thursday, November 3, 2022

How to Share NFS Mount Step by Step

 

How to Share NFS Mount Step by Step


Mounting the NFS Share


PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 


NOTE:  Following guide will show you how to Mount the NFS Share

  • Source server  [your Server Name:test-db-01]
    ssh test-db-01
    vi /etc/exports
    /oracle/rman/backup test-db-02(rw,sync) test-db-03(rw,sync)
    /oracle/rman/backup/log jumphost-01(ro,sync,nohide,crossmnt)
           
         Execute following command 
     
    service nfs restart
    exportfs -ra
    

  • Destination Server [test-db-02, test-db-03,jumphost-01]
 login to the destination server where you want to mount the filesystem. In our case are   the above listed server.
          
     ssh test-db-02  and ssh test-db-03
     mkdir -p /oracle/rman/backup
     chown -R oracle:dba /backup
     mount -t nfs test-db-01:/oracle/rman/backup /oracle/rman/backup
           
           Same step for test-db-03:
          
          And same steps for the jumphost-01 server.
          ssh jumphost-01
     mkdir -p /oracle/rman/backup/log
     chown -R oracle:dba /backup
     mount -t nfs jumphost-   01:/oracle/rman/backup/log /oracle/rman/backup/log

    
     Add the entry on each server in the fstab file. In case of reboot the server,
          The mount will happen automatically.

     vi /etc/fstab
     test-db-01:oracle/rman/backup               oracle/rman/backup            nfs                defaults        0 0

Monday, October 24, 2022

Clean the flashback recovery area

 

Clean the flashback recovery area


free space in flash recovery area


PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

 NOTE: You can remove the file on the filesystem level.

cd /fast_recovery_area/TESTDB/archivelog
ls -al 
2022_10_07/
2022_10_08/
2022_10_09/
2022_10_10/

I am going to remove all files older then 5 hours.

find /fast_recovery_area/TESTDB/archivelog/2022*  \( -mmin +360 -a -name "*.arc" \) -exec rm {} \; > /dev/null 2>&1 

Login into DB and check the parameter:

sqlplus / as sysdbaq

col name format a32
col size_mb format 999,999,999
col used_mb format 999,999,999
col pct_used format 999

select
name,
ceil( space_limit / 1024 / 1024 /1024) size_gb,
ceil( space_used / 1024 / 1024 /1024) used_gb,
decode( nvl( space_used, 0),0, 0,
ceil ( ( space_used / space_limit) * 100) ) pct_used
from
v$recovery_file_dest
order by

name desc;


NAME                                  SIZE_GB      USED_GB  PCT_USED
-------------------------------- ------------  ------------ --------

/fast_recovery_area                     2,600        2,590       100


Increate the sieze as follow. 

NOTE: NO NEED DB RESART:

ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE =3500G SCOPE=BOTH;

RMAN command required to make empty space show via sql command..

rman target /
crosscheck archivelog all;

delete noprompt force expired archivelog all;


Make empty all files older then 0ne day:

#delete noprompt archivelog all completed before 'sysdate - 1';

Or older the 6 hours:

delete noprompt archivelog all completed before 'sysdate - 6/24';

Now execute the above sql command again and check the space:

NAME                                  SIZE_MB      USED_MB PCT_USED
-------------------------------- ------------ ------------ --------

/fast_recovery_area                     3,500        2,590       74


You can use the follwing scrip to execute the RMAN commands.

delete_archivelog.sh

more delete_archivelog.sh

#!/bin/bash
date '+%Y-%m-%d  %H:%M:%S'
. /set_home_env 
TESTDB #set DB environment variables.
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
rman target / <<EOF
crosscheck archivelog all;
delete noprompt force expired archivelog all;
#delete noprompt archivelog all completed before 'sysdate - 1';
delete noprompt archivelog all completed before 'sysdate - 6/24';
EOF
date '+%Y-%m-%d  %H:%M:%S'
cd /fast_recovery_area/
TESTDB/archivelog

find /fast_recovery_area/TESTDB/archivelog/* -type d -empty -print -exec rm -r {} \;


Your comments are most valuable and it would help me to come up with better posts.

Thursday, May 5, 2022

Extend device using LVM

Extend device using LVM

How to Extend LVM Partition with lvextend command

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 


Extent physical volume using LVM 

# Use  VCenter and give the disk.

ls -l /dev/disk/by-path/ <<== Scan the correct scsi device

echo 1 > /sys/class/scsi_device/0\:0\:3\:0/device/rescan

vgdisplay
fdisk -l
...
...
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   209715199   104856576   83  Linux
...
...

partprobe

fdisk /dev/sdc <<== With the command  another disk is recognized. Example: sdc1 or  sdc2 recognized


n              #n   add a new partition
p              #p   print the partition table
enter
enter
enter
w              #w   write table to disk and exit
partprobe

fdisk -l
...
...
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   209715199   104856576   83  Linux
/dev/sdc2       209715200   419430399   104857600   83  Linux
...
...

pvscan
PV /dev/sdc1   VG vg_data         lvm2 [<100.00 GiB / 0    free]
PV /dev/sdc2                      lvm2 [100.00 GiB]

pvcreate /dev/sdc2    <<== sdc2 is a new disk
pvscan

vgs
  VG      #PV #LV #SN Attr   VSize    VFree
  vg_data   1   1   0 wz--n- <100.00g    0

vgextend vg_data /dev/sdc2

vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  vg_data   2   1   0 wz--n- 199.99g <100.00g

lvextend -l +100%FREE /dev/mapper/vg_data-lv_data

xfs_growfs /data


Done:

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

Steps for Physical Host extend LVM File system with multipath.

rescan-scsi-bus.sh -a -w -m

multipath -ll

#LUN WWID finden. You do with pipe

lsscsi -i -s 

vgdisplay

lvdisplay


vi /etc/multipath.conf  # add new LUN ID 

service multipathd reload

multipath -ll


parted /dev/mapper/tst-03DATA_03

GNU Parted 3.1

Using /dev/mapper/tst-01DATA_03

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel gpt

(parted) mkpart tst-03DATA_03 2048s 100%

(parted) align-check opt 1

1 aligned

(parted) quit


ll /dev/mapper/

pvcreate /dev/mapper/tst-03DATA_03p1

You can use multiple PV in one command.

pvcreate /dev/mapper/xxx /dev/mapper/xxx

pvscan

vgs

vgextend vg_data /dev/mapper/tst-03DATA_03p1

You can as well as extend multiple VG as one command  

vgextend /dev/mapper/xxx /dev/mapper/xxx

lvextend --resizefs -l +100%FREE /dev/vg_data/lv_data

df -hl

Done

Your comments are most valuable and it would help me to come up with better posts.


Wednesday, April 27, 2022

Create new xfs Filesystem

 

Create new xfs Filesystem

Add a new Hard Disk to Linux

How do I mount a disk in XFS

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

# First assign a disk via VCenter

# Now we can add and mount new assign disk to the Linux system.

To find which host bus number is relevant.
grep mpt /sys/class/scsi_host/host?/proc_name
/sys/class/scsi_host/host0/proc_name:mptspi   <<== this ist the output

# Scan scsi host device 0
echo "- - -" > /sys/class/scsi_host/host0/scan

# Now you should be able to see the new Disk.
 
fdisk -l
mkfs.xfs /dev/sdb
mkdir /data
mount /dev/sdb /data
df -hl

# Add the entry in the fstab file
vi /etc/fstab
/dev/sdb    /data     xfs     defaults        0 0

Done.

If you want to create ext4 file system. Please use the following steps:

fdisk -l
fdisk /dev/sdc
n
enter
enter 
enter 
p

mkfs.ext4 /dev/sdc1 
blkid

vi /etc/fstab
UUID=832d4328-3dde-4861-b57b-06ce2be7245g       /data        ext4    defaults        0 0


Your comments are most valuable and it would help me to come up with better posts. 

physical standby without duplicate command

physical standby without duplicate command create a physical standby database using RMAN without using duplicate command PURPOSE:   All docu...