Thursday, August 18, 2011

Connecting to Oracle 10G, when you have Oracle 11G Installed in your PC





When you want to connect to Oracle 10G, 
when you have Oracle 11G already Installed in your PC... 


you will get something like whut the hell i cannot connect to 10G now?


the trick is...


the Environment Path in windows will set the pirority to 11G so your 10G will be left out and get rotten suck.


to solve it... just alter the environment 


and set the path again so 10G is the first pirority :


C:\oracle\product\10.2.0\client_1\bin;c:\app\product\11.2.0\dbhome_1\bin;


how about that? now u can logon and do import export your DMP files again...



Wednesday, August 10, 2011

oracle timestamp tak sama dengan sysdate








jika anda select CURRENT_TIMESTAMP  dan tak sama dengan SYSDATE, maknanya setting time zone tak betul.


untuk betulkan sila run berikut ( kl adalah minus 8, bukan plus 8 la ok dalam oracle nie ):
    
    ALTER SESSION SET TIME_ZONE = '-8:0';


dah select semula disini :
    

    SELECT CURRENT_TIMESTAMP, SYSTIMESTAMP, sysdate FROM DUAL;    


haaa... kan dah sama... terbaekk kata tok aba

Wednesday, August 3, 2011

Oracle Wrapping / Obfuscating






The advantages of obfuscating, or hiding, the source code of PL/SQL units with the wrap utility or wrap subprograms of the DBMS_DDL package are:
  • It is difficult for other developers to misuse your application, or business competitors to see your algorithms.
  • Your source code is not visible through the USER_SOURCEALL_SOURCE, or DBA_SOURCE data dictionary views.
  • SQL*Plus can process the obfuscated source files.
  • The Import and Export utilities accept wrapped files. You can back up or move wrapped procedures.
Untuk Hide Script Dari Orang Lain @ Kedekut Sikit @ Kasi Secure Sikit, Anda Hanya Perlu Wrappingkan Coding Anda.


sila ikut sebijik contoh dibawah :


coding asal :
=============================================
CREATE OR REPLACE PACKAGE HAIRE.PKG_1
AS
   FUNCTION encrypt (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC;
END;
/


CREATE OR REPLACE PACKAGE BODY HAIRE.PKG_1
AS
     encryption_key    PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES; 
     encryption_type     RAW (32) := UTL_RAW.cast_to_raw('KeySulitTakBolehShare10012');
     


     FUNCTION encrypt (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC
     IS
        encrypted_raw      RAW (2000);
     BEGIN
        encrypted_raw := DBMS_CRYPTO.ENCRYPT
        (
           src => UTL_RAW.CAST_TO_RAW (p_plainText),
           typ => encryption_key,
           key => encryption_type
        );
       RETURN encrypted_raw;
     END encrypt;
END;
/


script untuk encrypt :
=============================================
 DECLARE
  v_procedure VARCHAR2(32767);
  BEGIN
   v_procedure :=  'CREATE OR REPLACE PACKAGE BODY HAIRE.PKG_1 AS      
     encryption_key    PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES; 
     encryption_type     RAW (32) := UTL_RAW.cast_to_raw(''KeySulitTakBolehShare10012''); 
     FUNCTION encrypt (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC     IS        encrypted_raw      RAW (2000);     BEGIN
        encrypted_raw := DBMS_CRYPTO.ENCRYPT  ( src => UTL_RAW.CAST_TO_RAW (p_plainText),  typ => encryption_key,  key => encryption_type  );  RETURN encrypted_raw;
     END encrypt;'
    || 'END;';


    SYS.DBMS_DDL.CREATE_WRAPPED(v_procedure);

  END;
  /


coding yang di encrypt encrypt :
=============================================
CREATE OR REPLACE PACKAGE BODY HAIRE.PKG_1 wrapped 
a000000
1f
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
b
220 17d
wzuxYssdavttxYHqXzhV1MDQgswEF8wg3nMr9zbyi+BNA9as/xHmM3ux5NLTYvQIt8Z8+NyaDtluG
1861gIhWSOVDZ0DGpRkTB5TALwDmeCZEIrwZNTBaHsifISVip9KRFa odmiUbGpP+1R
4B+4DSPlHnsnm/xLsYtLtXAkAKnhNLe4P2gTMoZTasaNB3jqFIeM09m/50NlaoGkQ8eMP14eUoP
ATTwMhJOsl3qGAo=
/