Friday, September 9, 2016

binary block editor (bbe) for windows



0. bbe's Win32 binary is here.

How to compile it for windows yourself:
1. get mingw-get-setup.exe from http://www.mingw.org/, install installer :) to c:\mingw. Then install neccessary packages:
  • c:\mingw\bin\mingw-get.exe install msys-bash
  • c:\mingw\bin\mingw-get.exe install mingw32-gcc
  • c:\mingw\bin\mingw-get.exe install msys-make
  • c:\mingw\bin\mingw-get.exe install msys-texinfo
2. get source from https://sourceforge.net/projects/bbe-/files/, extract it to c:\bbe-0.2.2

3. fix src\bbe.h lines 52-54 (https://sourceforge.net/p/bbe-/discussion/497696/thread/c7ef2724/)
[pre class="brush:text"]
// #ifndef HAVE_OFF_T
// #define long int off_t
// #endif
#define off_t long int
[/pre]

Next changes enables binary mode for files, otherwise you'll have troubles with EOF 0x1A symbol.
4. fix src\buffer.c
[pre class="brush:text"]
line 56:
from out_stream.fd = open(file,O_WRONLY | O_CREAT | O_TRUNC,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
  to out_stream.fd = open(file,O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,S_IRUSR | S_IWUSR);
line 100:
from new->fd = open(file,O_RDONLY);
  to new->fd = open(file,O_RDONLY | O_BINARY);
[/pre]
5. fix src\execute.c
[pre class="brush:text"]
line 420 from fseeko to fseeko64
line 550 from c->fd = fopen(file,"w"); to c->fd = fopen(file,"wb");
line 584 from c->fd = fopen(c->s1,"w"); to c->fd = fopen(c->s1,"wb");
line 602 from c->fd = fopen(c->s1,"r"); to c->fd = fopen(c->s1,"rb");
line 616 frim c->fd = fopen(c->s1,"r"); to c->fd = fopen(c->s1,"rb");
[/pre]
6. compile it:
run C:\MinGW\msys\1.0\msys.bat, it will start new unix-like console.
[pre class="brush:text"]
$ cd /c/bbe-0.2.2
./configure
make
[/pre]
7. grab your bbe.exe from src folder.
8. this solutuion works for me, but it might not work for you :)

References:



Thursday, September 1, 2016

Oracle 11g portable client


Sometimes it is handy to have an Oracle client on your USB stick immediately ready to use without prior installation. Oracle has a solution - the instant client. But what if you need more than just SQLPlus, for example exp/imp or tnsping... I've found simple aswer for this - Oracle XE.

Oracle home of Windows 64bit XE installation is just little bit more than 400Mb and when you remove bin\oracle.exe (140Mb) and rdbms\admin folder (54Mb), you'll have 11G Oracle client with sqlplus, tnsping, exp/imp, datapump and other tools all together around 200Mb. Not bad, i think. Put it on your usb stick, for example in F:\XP_CLIENT folder.

Plug in it to the computer with no Oracle software, open cmd:
[pre class="brush:text" title="cmd.exe"]
set ORACLE_HOME=F:\XP_CLIENT
set PATH=%ORACLE_HOME%\bin;%PATH%[/pre]and enjoy your exp/imp/sqlplus/tnsping/whatever

Links:

Update: imp/exp and impdp/expdp are included in the Oracle Instant Client 12.2 tools package.

Friday, May 13, 2016

How to keep images inside Oracle SQL Developer explain plan HTML export file


If you need to share SQL statement explain plan output created by Oracle SQL Developer, you can export it to html file. You need to press F10 to create Explain Plan tab, then RMB click on it and choose "Export HTML".


Oracle SQL Developer creates html file and saves all icons into "images" subfolder nearby. Therefore if you decide to copy or share this html file you will need to keep those images with it, or they will be replaced with ugly "broken image" icons:


To target this huge problem I've created small windows cmd script. It appends necessary images as CSS resources to html file and change internal <IMG> references accordingly. It also changes font style to "small sans-serif" since i think that it looks better :). For this script to run you'll need a SED utility from unxutils. Script expects html file with explain plan as a 1st parameter. Optional 2nd parameter "noimg" removes all image references from html. Result (all images are inside HTML, images subfolder is not required to share your HTML):


Use it at your own risk! Have fun. :)

References: