Thursday, November 30, 2017

Remove Blank Line and Comment by grep

remove blank line:
grep -v -e ^$

remove comment line:
grep -v ^#

ex:
cat filename | grep -v -e ^$ | grep -v ^#

Friday, November 17, 2017

Find DB Size Order by Schemas, Oracle

select
   sum(bytes)/1024/1024 as size_in_megabyte,
   segment_type, owner
from
   dba_segments
where
   OWNER in ('MEISPSN','MEISPAY','HRIS', 'NDMS')
and
  segment_type like 'TABLE'
group by
   segment_type, owner
order by owner;


ALL DB SIze in Megabytes

set lines 200
set pages 999
col "DBSize" format a10
col "Free" format a10
col "Used" format a10
select    round(sum(used.bytes) / 1024 / 1024  ) || ' MB' "DBSize"
,    round(sum(used.bytes) / 1024 / 1024  ) -
    round(free.p / 1024 / 1024 ) || ' MB' "Used"
,    round(free.p / 1024 / 1024 ) || ' MB' "Free"
from    (select    bytes
    from    v$datafile
    union    all
    select    bytes
    from     v$tempfile
    union     all
    select     bytes
    from     v$log) used
,    (select sum(bytes) as p
    from dba_free_space) free
group by free.p
/

ALL DB Size in GB

set lines 200
set pages 999
col "DBSize" format a10
col "Free" format a10
col "Used" format a10
select    round(sum(used.bytes) / 1024 / 1024 / 1024  ) || ' GB' "DBSize"
,    round(sum(used.bytes) / 1024 / 1024 / 1024  ) -
    round(free.p / 1024 / 1024 / 1024 ) || ' GB' "Used"
,    round(free.p / 1024 / 1024 / 1024 ) || ' GB' "Free"
from    (select    bytes
    from    v$datafile
    union    all
    select    bytes
    from     v$tempfile
    union     all
    select     bytes
    from     v$log) used
,    (select sum(bytes) as p
    from dba_free_space) free
group by free.p
/

Tuesday, November 7, 2017

RHEL/CentOS EPEL Repository

On RHEL/CentOS – 32-bit OS

-------------- For RHEL/CentOS 6 --------------
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ihv epel-release-6-8.noarch.rpm
-------------- For RHEL/CentOS 5 --------------
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ihv epel-release-5-4.noarch.rpm

On RHEL/CentOS – 64-bit OS

-------------- For RHEL/CentOS 7 --------------
# wget dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
# rpm -ihv epel-release-7-11.noarch.rpm
-------------- For RHEL/CentOS 6 --------------
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ihv epel-release-6-8.noarch.rpm
-------------- For RHEL/CentOS 5 --------------
# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ihv epel-release-5-4.noarch.rpm

Monday, November 6, 2017

Increase size of tmpfs file system

ex: change to 8G 
edit /etc/fstab

tmpfs                   /dev/shm                tmpfs   defaults,size=8g        0 0


mount -o remount /dev/shm

Thursday, November 2, 2017

Enabled LLDP Alcatel Switch

SET LLDP System NAME:

system name ALL-Uplink
system location SIAM-FL11

SHOW LLDP Configure:

show lldp config or show lldp local-system

ENABLE LLDP remote System:

lldp chassis tlv management port-description enable system-name enable system-description enable system-capabilities enable
lldp chassis tlv management management-address enable
lldp chassis tlv dot1 vlan-name enable port-vlan enable
lldp chassis tlv dot3 mac-phy enable

Monday, October 16, 2017

Clear /BOOT Linux Ubuntu

Clear /BOOT Linux Ubuntu

1. uname -r @check Current Linux Kernal
2. dpkg --list 'linux-image*' @List All Linux kernel Images Store in /BOOT

- Manual delete

$sudo apt-get remove linux-image-VERSION @Manual delete Linux kernel Images

- Auto remove (recommend)

$sudo apt-get autoremove

- Update 
$sudo apt-get update


- Run Grub Update

$sudo update-grub

Tuesday, September 5, 2017

Generate scrip using dbms_metadata.get_ddl in ORACLE

select dbms_metadata.get_ddl('OBJECT_TYPE','OBJECT_NAME','OWNER') a from dual

ex.

:TYPE TABLE

select dbms_metadata.get_ddl('TABLE','PMS_ACADEVALSTAFFWORKPUB','HRIS') a from dual

:TYPE CONRAINTS

SQL> set linesize 200
SQL> col c format a100
SQL>set long 9999
SQL> select dbms_metadata.get_ddl('CONSTRAINT', 'PK_APP_POSTAPPLICANTTOPIC','HRIS') c from dual;

C
--------------------------------------------------------------------------------

  ALTER TABLE "HRIS"."APP_POSTAPPLICANTTOPIC" ADD CONSTRAINT "PK_APP_POSTAPPLICANTTOPIC" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE




Saturday, July 29, 2017

7zip command

Download 7zip Command and copy file to C:\window\system32

FOR %i IN (*.*) DO 7za.exe a "%~ni.zip" "%i"

Thursday, June 22, 2017

Find and Exec

mtime,ctime,atime
Option in Find Command ON Linux

mtime - modified content in files
ctime - mofified Permision, Group, Owner
atime - Time to access files

exp:

find /u03/rman-backup/ \  <----- path to finding
-name "*NIDAREG*" \    <------- find word in FileName
-mtime -1 \        <------- Modified Time ( in this case , time to Create file on last day (-1))
-exec scp -p {} admin@192.168.1.10:/STORAGE/rman-backup/NIDAREG \; <----- execute Command ( Copy file to another File Server via SCP command )

*scp option -p (preserve timestamp)

find ./*.gz \    <----- find *.gz
-mtime +7 \    <---- time over 7 day
-type f | \         <------ type File
xargs du -ksh    <-----find Size of File


STAT Command
- show atime,ctime, mtime

exp:

stat filename

[admin@M4000-Storage temp]$ stat BACKUP_NIDAREG_20170622.out
  File: ‘BACKUP_NIDAREG_20170622.out’
  Size: 33134           Blocks: 72         IO Block: 4096   regular file
Device: 810h/2064d      Inode: 112541699   Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/   admin)   Gid: ( 1001/   admin)
Context: unconfined_u:object_r:unlabeled_t:s0
Access: 2017-06-22 10:05:53.000000000 +0700
Modify: 2017-06-22 01:12:06.000000000 +0700
Change: 2017-06-22 10:15:57.289435709 +0700
 Birth: -


ref: http://www.unix.com/tips-and-tutorials/20526-mtime-ctime-atime.html

ADD SCSI Disk Oracle Linux

:find scsi controller

ls /sys/class/scsi_host/
host0 host1 host2

:scan scsi disk

echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan

Monday, May 1, 2017

SNMP Alcatel Switch

! SNMP :
aaa authentication snmp "local"
snmp security no security
user snmpuser password password read-only all no auth
snmp community map "NIDA_QA" user "snmpuser" on
snmp station 10.100.100.150 161 "snmpuser" v1 enable

system location SIAM_FL11

Tuesday, April 18, 2017

vCenter Appliance Update Patch

- mount cdrom
- connect esxi shell

"software-packages install --iso --acceptEulas"

- shutdown reboot -r updatepatch

Friday, February 17, 2017

Open SSL KeyGen Script

create bash:

#/bin/bash
openssl genrsa -des3 -out server.key 2048
openssl rsa -in server.key -out server.key.insecure
mv server.key server.key.secure
mv server.key.insecure server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 65535 -in server.csr -signkey server.key -out server.crt
openssl x509 -in server.crt -out server.pem -outform PEM

Tuesday, January 17, 2017

SKIP RBA Oracle Goldengate for Fix Process ABEND Using LOGDUMP Untility

REPLICAT   RMEIS     Last Started 2017-01-17 09:18   Status ABENDED
Checkpoint Lag       00:00:00 (updated 00:01:56 ago)
Log Read Checkpoint  File /data/ggate/dirdat/MEIS/rm000244
                     First Record  RBA 13800112


Logdump 14 >open /data/ggate/dirdat/MEIS/rm000244
Current LogTrail is /data/ggate/dirdat/MEIS/rm000244
Logdump 15 >
Logdump 15 >
Logdump 15 >
Logdump 15 >pos 13800112
Reading forward from RBA 13800112
Logdump 16 >n

2017/01/16 14:14:35.382.759 DDLOP                Len  1316 RBA 13800112
Name:
After  Image:                                             Partition 0   G  s
 2c43 353d 2734 3334 3530 3527 2c2c 4237 3d27 3433 | ,C5='434505',,B7='43
 3435 3035 272c 2c42 323d 2732 3034 3439 3827 2c2c | 4505',,B2='204498',,
 4332 313d 2727 2c2c 4233 3d27 4154 5427 2c2c 4234 | C21='',,B3='ATT',,B4
 3d27 5359 535f 494c 3030 3030 3230 3434 3938 4330 | ='SYS_IL0000204498C0
 3030 3036 2424 272c 2c43 3132 3d27 4154 5427 2c2c | 0006$$',,C12='ATT',,
 4331 333d 2744 424f 5553 4552 494e 464f 272c 2c42 | C13='DBOUSERINFO',,B
 353d 2749 4e44 4558 272c 2c42 363d 2741 4c54 4552 | 5='INDEX',,B6='ALTER

Logdump 17 >n <------ Press N for Next transaction

2017/01/16 14:14:36.382.759 DDLOP                Len  1267 RBA 13801583
Name:
After  Image:                                             Partition 0   G  s
 2c43 353d 2734 3334 3530 3927 2c2c 4237 3d27 3433 | ,C5='434509',,B7='43
 3435 3039 272c 2c42 323d 2732 3034 3439 3827 2c2c | 4509',,B2='204498',,
 4332 313d 2727 2c2c 4233 3d27 4154 5427 2c2c 4234 | C21='',,B3='ATT',,B4
 3d27 4442 4f55 5345 5249 4e46 4f27 2c2c 4331 323d | ='DBOUSERINFO',,C12=
 2727 2c2c 4331 333d 2727 2c2c 4235 3d27 5441 424c | '',,C13='',,B5='TABL
 4527 2c2c 4236 3d27 414c 5445 5227 2c2c 4238 3d27 | E',,B6='ALTER',,B8='
 4747 4154 452e 4747 535f 4444 4c5f 4849 5354 272c | GGATE.GGS_DDL_HIST',

Logdump 18 >

alter replicat Relplicate_name extseqno SEQ_File_Number, extrba NextRBN

ex:

alter replicat RMEIS extseqno 244, extrba 13801583

start replicate RMEIS

ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout