Thursday, October 31, 2019

Backup Docker container

Convert Container to Docker images:

docker commit container_name name/tag

Save docker images to files:

docker save name/tag > backupfile.tar

Import docker images from Files

docker load -i backupfile.tar

Wednesday, October 30, 2019

Fix iSCSI DataStore is Connected But inaccessible

Remount a iSCSI datastore in ESXI host after network failure or
iSCSI DataStore is Connected But inaccessible 

:Scan volume
esxcfg-volume -l

[root@esxi-11:/vmfs/volumes] esxcfg-volume -l
Scanning for VMFS-6 host activity (4096 bytes/HB, 1024 HBs).
VMFS UUID/label: 5b9279dd-659af4f5-9f6c-1866daf4b576/QNAP-01:GRAYLOG
Can mount: Yes
Can resignature: Yes
Extent name: naa.6e843b61b1c7f97dd817d4d65d8bddd7:1     range: 0 - 8388351 (MB)
Extent name: naa.6e843b6ab3d267ad2373d43a8d9645da:1     range: 8388352 - 16776703 (MB)

Scanning for VMFS-6 host activity (4096 bytes/HB, 1024 HBs).
VMFS UUID/label: 5b91fa1a-8d4ad5f5-8747-1866daf3466e/QNAP-01:DS-01
Can mount: Yes
Can resignature: Yes
Extent name: naa.6e843b69306f933db3d1d4045da669da:1     range: 0 - 4194047 (MB)

:Mount Volume

esxcfg-volume -m QNAP-01:DS-01
esxcfg-volume -m QNAP-01:GRAYLOG

Wednesday, October 16, 2019

Oracle EXPORT(expdp) by Tables in SCHEMAS

Oracle EXPORT(expdp) by Tables in SCHEMAS

export:
expdp system/manager directory=TEMP tables=SCHEMA1.TABLENAME1,SCHEMA2.TABLENAME2 dumpfile=SCHEMA_TABLES.dmp logfile=expdp_SCHEMATABLES.log

import:
impdp system/manager directory=DATA_PUMP_DIR dumpfile=SCHEMA_TABLES.dmp logfile=impdp_SCHEMATABLES.log

Friday, September 27, 2019

Set TimeZone Ubuntu 18

Set TimeZone Ubuntu

$ timedatectl list-timezones
$ sudo timedatectl set-timezone Asia/Bankok

Thursday, September 26, 2019

Tmux Tips

Tmux Tips

Tmux copy to ClipBoard

- ctrl + b, [ :Enter To Copy Mode
- Move Start/End with Arrow KEY
- ctrl + space :Start select hi-light
- alt + w :Copy To ClipBoard
- ctrl +b, ] :Paste

Tmux Create New windows

- ctrl + b, c :Create New Windows Terminal
- ctrl + b, n :Next Windows
- ctrl + b, 0-n :Select Windows by Number
- ctrl + b, w :List Windows Terminal

Tmux split panes

- ctrl + b, % :Split Vertical
- ctrl + b, " :Split Horizontal

SEND HTTP POST request using UTL_HTTP in Oracle Database 11G


grant execute on utl_http to wc
grant execute on dbms_lock to wc;

BEGIN
  DBMS_NETWORK_ACL_ADMIN.create_acl (
    acl          => 'local_test_acl_file.xml', 
    description  => 'A test of the ACL functionality',
    principal    => 'WC',
    is_grant     => TRUE, 
    privilege    => 'connect',
    start_date   => SYSTIMESTAMP,
    end_date     => NULL);
end;
/

begin
  DBMS_NETWORK_ACL_ADMIN.assign_acl (
    acl         => 'local_test_acl_file.xml',
    host        => 'ws.domain.local', 
    lower_port  => 5000,
    upper_port  => NULL);    
end;
/


create or replace
procedure send_post_requests
( p_string in varchar2
, p_number in number
) is
  req utl_http.req;
  res utl_http.resp;
  url varchar2(4000) := 'http://ws.domain.local:5000/test';
  name varchar2(4000);
  buffer varchar2(4000); 
  content varchar2(4000) := '{
"string_type":"'||p_string||'",
"number_type":"'||p_number||'"
}';

begin
  req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
  utl_http.set_header(req, 'user-agent', 'mozilla/4.0'); 
  utl_http.set_header(req, 'content-type', 'application/json'); 
  utl_http.set_header(req, 'Content-Length', length(content));

  utl_http.write_text(req, content);
  res := utl_http.get_response(req);
  -- process the response from the HTTP call
  begin
    loop
      utl_http.read_line(res, buffer);
      dbms_output.put_line(buffer);
    end loop;
    utl_http.end_response(res);
  exception
    when utl_http.end_of_body 
    then
      utl_http.end_response(res);
  end;
end send_post_requests;
/

begin
   send_post_requests('stringggggggg', 123456789);
end;
/

drop procedure send_post_requests;

begin
   DBMS_NETWORK_ACL_ADMIN.UNASSIGN_ACL(
     host        => 'tko.nida.local',
     lower_port  => 5000);
end;


begin
   DBMS_NETWORK_ACL_ADMIN.DROP_ACL(
      acl => 'local_test_acl_file.xml');
end;

/








ALCATEL 6900

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