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




ALCATEL 6900

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