Posts Tagged ‘oracle’

28
Apr

how to get all rows in a single row?

   Posted by: İsmail ÇAKIR    in oracle

today one of my collague asked me to how to fetch all rows of a parameter table in a single row with .

so i wrote this.

select * from
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 1),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 2),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 3),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 4),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 5),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 6),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 7),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 8),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 9),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 10)

example gets 1o rows in a single row, actually it was constant 78 rows.
so he could used it like
resultset.getString(“param1″+i) with a loop.

and then he also needed 5 by 5 collected results with 2x columns in each view.

and my solution is

select * from
(select rownum as rx, b.* from (
select rownum as rnum, rowid as rid, a.* from (select param_a, param_b, param_c, param_d, param_e from user.test order by param_a, param_b, param_c) a) b
where rnum >=5 and rnum < 10) x,
(select rownum as rx, b.* from (
select rownum as rnum, rowid as rid, a.* from (select param_a, param_b, param_c, param_d, param_e from user.test order by param_a, param_b, param_c) a) b
where rnum >=10 and rnum < 15) y where x.rnum + 5 = y.rnum ;

anyone knows easier and more optimised way to do these?

Bookmark and Share
Tags: , , , ,

Tags: , , , ,

21
May

tora with oracle support on lucid (ubuntu 10.04 LTS (lucid lynx))

   Posted by: İsmail ÇAKIR    in oracle

first we take rpm packages from
oracle instant client downloads.
you need to download devel, basic, sqlplus packages.
we need alien to convert rpms to deb.
sudo apt-get install alien
convert them to deb packges;
alien -instantclient11.2-basic_11.2.0.1.0-2_i386.rpm
alien oracle-instantclient11.2-devel_11.2.0.1.0-2_i386.rpm
alien oracle-instantclient11.2-sqlplus_11.2.0.1.0-2_i386.rpm

install new deb packages with sudo dpkg -i

download and install the libaio library
libaio, libao-dev
give this commands;

sudo echo "/usr/lib/oracle/11.2/client/lib" > /etc/ld.so.conf.d/oracle.conf
sudo ldconfig
export ORACLE_HOME=/usr/lib/oracle/11.2/client
sudo "export ORACLE_HOME=/usr/lib/oracle/11.2/client" > ~/._profile

take package from proturk

wget http://www.proturk.com/downloads/tora_2.1.1-1_i386.deb
sudo dpkg -i tora_2.1.1-1_i386.deb

now you can run tora with /usr/local/tora/bin/tora command.

if it not works probably you dont have qtscintilla or qt4 libraries, install them with synaptic.

if you want to compile by yourself, here is the configure command;
./configure --with-instant-client=/usr/lib/oracle/11.2/client --with-oracle-includes=/usr/include/oracle/11.2/client --with-oracle-libraries=/usr/lib/oracle/11.2/client/lib --with-oci-version=11G

Bookmark and Share
Tags: , , , ,

Tags: , , , ,

2
Apr

oracle wallet ile kendinden imzalı sertifika kullanımı

   Posted by: İsmail ÇAKIR    in Bilgi Ve Deneyim

openssl sitesinden .-0.1.tar.gz dosyasını indirin.
Manager’i açıp yeni bir ile sertifika istemi oluşturun.
Sertifika istem dosyasını “.csr” uzantısı ile export edip (örneğin deneme.csr), ssl.ca paketinizi indirdiginiz yere kaydedin.
new-root-ca.sh ile kendinize bir root sertifikası oluşturun, oluşucak dosyanın ismi “ca.crt” dir.
sign-server-cert.sh deneme.csr şeklinde
onaylı kullanıcı sertifkamızı oluşutururuz. oluşan dosyanın ismi bu örnekte “deneme.crt” dir.
ilk oluşturduğumuz “ca.crt” dosyasını oracle wallet a trusted (güvenilen) sertifika olarak ekleriz, kendimi istemimize ait kendinden imzalı “deneme.crt” dosyasını da
kullanıcı sertifikası olarak walleta giriyoruz. Auto-login seçin ve wallet i kaydedin. Kullanıma hazırsınız.
yok ben mitm den korkuyom kendinden imzalı kullanmam derseniz, apache-ssl in sitesinden size copy paste bir official ca listesi ;

  1. Thawte Consulting, at http://www.thawte.com/html/RETAIL/ssl/index.html

  2. CertiSign Certificadora Digital Ltda., at http://www.certisign.com.br

  3. IKS GmbH, at http://www.iks-jena.de/produkte/ca/

  4. BelSign NV/SA, at http://www.belsign.be

  5. Verisign, Inc. at http://www.verisign.com/products-services/security-services/ssl/index.html

  6. TC TrustCenter (Germany) at http://www.trustcenter.de/tc-server

  7. Deutsches Forschungsnetz at http://www.pca.dfn.de/dfnpca/certify/ssl/

  8. Entrust.net Ltd. at http://www.entrust.net/products/index.htm

  9. Equifax Inc. at http://www.equifaxsecure.com/ebusinessid/

  10. GlobalSign NV/SA at http://www.GlobalSign.net
  11. NetLock Kft. (Hungary) at http://www.netlock.net
  12. Certplus SA (France) at http://www.certplus.com
  13. GeoTrust Inc. (USA) at http://www.freessl.com
  14. register.com (USA) at http://commercelock.register.com
  15. lanechange.net (Canada) at http://www.lanechange.net/#server certs
  16. KPN Telecom (The Netherlands) at http://certificaat.kpn.com/

  17. Tier Networking (USA) at http://www.tier-networking.com/sslcerts/

  18. ipsCA (Spain) at http://certs.ipsca.com/FreeCertsForApacheSSL/

  19. CAcert (Australia) at http://www.cacert.org/

  20. Comodo CA (USA/UK) at http://www.instantssl.com/

  21. Xolphin (Netherlands) at http://www.sslcertificaten.nl/

  22. usertrust (USA) at http://www.usertrust.com/

  23. Networking4All (Netherlands) at http://www.ssl-beveiligd.nl/

  24. Microsec Kft. (Hungary) at http://www.e-szigno.hu/

  25. DigiCert Inc. (USA) at http://www.digicert.com
Bookmark and Share
Tags: , , , , , ,

Tags: , , , , , ,

15
Mar

oracle XMLType kullanımı

   Posted by: Muhammed YÜRÜRDURMAZ    in Database, oracle

Öncelikli olarak tipinde bir tablo oluşturalım. Tablo adı deneme_tablo olsun

create table deneme_tablo of xmltype;

bir kayıt insert edelim

insert into deneme_tablo values(
	xmltype('<kisi adi="muhammed" soyadi="yürürdurmaz" />')
)
insert into deneme_tablo values(
	xmltype('<kisi adi="ismail" soyadi="çakır" />')
)

şimdi tüm kayıtları listeleyelim

select * from deneme_tablo

şimdi ismi muhammed olan kayıtları sorgulayalım

select * from deneme_tablo tb
where (tb.OBJECT_VALUE, '/kisi[@adi=''muhammed'']') = 1

şimdi kişi adlarını listeleyelim olan kayıtları sorgulayalım

select (tb.OBJECT_VALUE, '/kisi/@adi') from deneme_tablo tb
Bookmark and Share
Tags: , , , ,

Tags: , , , ,

7
Mar

sql between operatörü

   Posted by: Muhammed YÜRÜRDURMAZ    in Database, oracle

select * from tablo where sayi  1 and 5

kullanırken between operatörünbe dikkat edin. bazı veritabanlarında 1 dahil olmazken bazılarında 5 dahil olmuyor. bazırlarında 1 ve 5 dahil olurken bazılarında 1 ve 5 dahil olmuyor

örnek olarak üzerinde 1 ve 5 dahil oluyor

Bookmark and Share
Tags: , , ,

Tags: , , ,

27
Feb

SqlTools Linux üzerine kurma

   Posted by: İsmail ÇAKIR    in Linux, oracle

Öncelikle indiriyoruz.

sistemimizde kuruluysa direkt olarak tıklayıp kurabiliriz.
wine yoksa
sudo apt-get install wine
ile kuruyoruz.
a ihtiyaç duyucaz, instantclient-basic-win32-11.1.0.7.0.zip. basic versiyonu indiriyoruz. Tabi benim veritabanım türkçe encoding de eğer ingilizce ise veritabanınız daha ufak olan basic-lite paketini indirebilirsiniz.
ev dizinimizdeki
.wine/drive_c/Program Files/SQLTools 1.42/ dizinine gidip instantclient-basic-win32-11.1.0.7.0.zip dosyasını buraya açıyoruz.
instantclient_11_1 dizinine açıcaktır. içindekileri üst dizine taşıyın.

daha sonra wine Sqltools.exe komutuyla ya da ana menudeki wine grubundan SQLtools u çalıştırabilirsiniz.

Bookmark and Share
Tags: , , , , ,

Tags: , , , , ,

26
Feb

oracle dbconsole localtime hatası

   Posted by: İsmail ÇAKIR    in Linux, oracle

komutu ile başlatmaya çalıştığınızda

/usr/bin/diff: /etc/: No such file or directory TZ set to
Etc/GMT+12 Enterprise Manager 10g Database Control Release

hatası alıyorsanız, sisteminizin ayarını yapmamışınızdır demektir.

ln -sf /usr/share/zoneinfo/Turkey /etc/localtime

komutu ile oluşturacağınız linkle bu sorunu aşabilirsiniz.

eğer

does not match the current environment TZ setting

hatası görüyorsanız, db ile sistem timezone farklıdır.

ORACLE_HOME dizinine geçip

resetTZ agent

komutu vererek bu sorunu da aşabilirsiniz.

Bookmark and Share
Tags: , , , , , ,

Tags: , , , , , ,

Hani böylesine zorla yapmak istemeyizde mecbur kalınca, niye olmasın :)
stop
komutuyla durmuyorsa.
#!/bin/

for ind in `ps -aef | grep | grep -v grep | cut -f4 -d ' '`
do
kill -9 $ind
echo "process $ind"
done
if [ $? -eq 0 ]; then
lsnrctl start
fi
exit

Bookmark and Share
Tags: , , , , ,

Tags: , , , , ,

14
Apr

gtko oracle sql admin

   Posted by: İsmail ÇAKIR    in Linux

    ve sqldeveloper alternatifi olarka kullanılabilen bir   editörü.

http://www.proturk.com/download//deb/gtko2_2.26-1_i386.deb

adresinden elde ediceğiniz deb’i kurmadan önce
tora yazımda verdiğim gibi instanclient kurmanız ve ORACLE_HOME ayarınızı yapmanız lazım .

gtkohttp://.sourceforge.net/

Bookmark and Share
Tags: , ,

Tags: , ,

13
Apr

oracle desteği ile tora debian etch üzerinde

   Posted by: İsmail ÇAKIR    in Uncategorized

Bildiğiniz gibi ve da desteği olmadan geliyor.  Eğer desteği olan tora gerekirse şunları yapın:

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html

adresinden instanclient basiclite, sqlplus ve devel paketlerini indirin.
Rpm olarak indirip alien ( yoksa sudo apt-get install alien) ile kurun.

http://debian.mirror.inra.fr/debian/pool/main/liba/libaio/libaio1_0.3.106-3_i386.deb

http://debian.mirror.inra.fr/debian/pool/main/liba/libaio/libaio-dev_0.3.106-3_i386.deb

paketlerini kurun.

sonra

sudo vi /etc/ld.so.conf.d/oracle.conf

komutu verin ve dosyaya

/usr/lib/oracle/11.1.0.1/client/lib

yazın

sudo ldconfig

komutu verin.

export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client

komutu verin.

bunu ._profile dosyanıza da ekleyin.

wget http://www.proturk.com/download//deb/tora_1.3.21-3_i386.deb

sudo dpkg -i  tora_1.3.21-3_i386.deb

ile kurun

komut satırına tora demeniz yeticektir.

Bookmark and Share
Tags: , , , ,

Tags: , , , ,

Switch to our mobile site