Wednesday, 5 June 2013

Last Analyzed - clean format

Last Analyzed set pagesize 100 select * from ( select t.owner, to_char(t.last_analyzed, 'DD-MON-YYYY') LAST_ANALYZED, count(*) COUNT, RANK() OVER (PARTITION BY owner ORDER BY count(*) desc) "rank" from dba_tables t where owner not in ('SYS','SYSTEM','SYSMAN','OUTLN','CTXSYS','MDSYS','TSMSYS','DMSYS','EXFSYS','DBSNMP','XDB','ORDSYS','WMSYS','ORDPLUGINS','ANONYMOUS','ORACLE_OCM','DIP','XS\$NULL','APEX_PUBLIC_USER','MGMT_VIEW','SMTYPES','ORDDATA','SPATIAL_WFS_ADMIN_USR','MDDATA','SI_INFORMTN_SCHEMA','DATAADMIN','APEX_030200','OWBSYS_AUDIT','OLAPSYS','SPATIAL_CSW_ADMIN_USR','OWBSYS','APPQOSSYS','AVAIL','FLOWS_FILES') group by t.owner, to_char(t.last_analyzed, 'DD-MON-YYYY') order by t.owner, COUNT desc, LAST_ANALYZED ) where "rank" = 1;

Thursday, 23 May 2013

Tomcat with tnsname

Oracle Thin JDBC connection to a TNS alias (tnsname)

1. Log in as user that owns tomcat

2. Shutdown tomcat if running

3. export this env
export JAVA_OPTS="-Doracle.net.tns_admin=/u01/oracle/product/10.2.0/network/admin"

5. Make sure tomcat owner is able to read file sin the above TNS directory

4. Startup tomcat

5. DB connection using tns should work

Note:
  • Above worked for me on 10.2.0.1.0 database with, tomcat-5.5.20 (Linux) and jdk1.6.0_12 (May 2013)

  • Above worked for me on 11g database with, tomcat-7.0.40 (Win) and 1.7.0_21 (May 2013)

  • Similar to normal thin connection ("jdbc:oracle:thin:@nidevdb", username, password)
  • Some docs / sites also say you can use below, instead (i could not get it to work).

System.setProperty("oracle.net.tns_admin", "/u01/oracle/product/10.2.0/network/admin");


more info, see book:
Book: Oracle® Database JDBC Developer's Guide (11g Release 2 (11.2))
Chapter: 8 Data Sources and URLs

Thursday, 16 May 2013

Data Pump option

Simple Datapump create directory dump_dir as '/u11/oracle/exp_cust'; create directory log_dir as '/u11/oracle/exp_cust/logs'; grant read,write on directory dump_dir to CUST_DUMMY_STAGE; grant read,write on directory log_dir to CUST_DUMMY_STAGE; -- Export expdp CUST_DUMMY_STAGE/nidb schemas=CUST_DUMMY_STAGE dumpfile=dump_dir:expdp_09FEB2013_CUST_DUMMY_STAGE_%U.dmp logfile=log_dir:full1.log_09FEB2013_expdp_CUST_DUMMY_STAGE.log parallel=4 filesize=10G -- Import impdp system schemas=CUST_DUMMY_STAGE dumpfile=dump_dir:expdp_09FEB2013_CUST_DUMMY_STAGE_*.dmp logfile=log_dir:full1.log_09FEB2013_impdp_CUST_DUMMY_STAGE.log parallel=4 -- with remap / fromuser-touser impdp system schemas=CUST_DUMMY_PROD remap_schema=CUST_DUMMY_PROD:CUST_DUMMY_STAGE dumpfile=dump_dir:cust_dummy_prod_201305182300_01.dp logfile=dump_dir:log_imp_cust_dummy_prod_201305182300_.log parallel=4

Friday, 19 April 2013

asmcmd tips

To get size of all the archive logs asmcmd ls DG_BIN | while read; do printf 'DG_BIN/%s\n' "$REPLY"; asmcmd du "DG_BIN/$REPLY"; done

Wednesday, 20 February 2013

Remove Latin or special char

To remove Latin or special char sed -e 's/[Ā]/A/g;s/[àâā]/a/g;s/[ọõ]/o/g;s/[íìī]/i/g;s/[êệ]/e/g;s/[ḥ]/h/g;s/[Ḥ]/H/g;s/[şṣ]/s/g;s/[ū]/u/g;s/[ʿ]//g;s/[Ṣ]/S/g;s/[Ṭ]/T/g;s/[ṭ]/t/g;s/[Ḍ]/D/g;s/[ḍ]/d/g' a.txt

Thursday, 7 February 2013

Zen cart change number of zones from 3

(Zone by continent)

By default, the module comes with support for 3 zones. This can be easily altered with a coding change by editing the Zones Shipping Module file (If you make this change and your Zones module is already installed/active, you'll need to record your settings, then click Remove, then click Install, and re-enter all your settings. Otherwise your change will have peculiar visual side-effects).
/includes/ modules/ shipping/ zones.php // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_zones = 3; }
Next, you will want to activate the module by going to the Admin, point your cursor at Modules, then clicking on Shipping. A list of all shipping modules should appear. Click on Zone Shipping. Click on the install button.

Notes
1: Great Britain
2: Austria, Belgium, , France, Germany, Greenland, Iceland, Ireland, Italy, Norway, Holland/Netherlands, Denmark, Poland, Spain, Sweden, Switzerland, Finland, Portugal, Israel, Greece
3: USA, Canada
4: Japan, Australia, New Zealand, Singapore, Taiwan, China, Hong Kong
5: (Other, inc India, UAE)

When you enter these country lists, enter them into the Zone X Countries fields, where "X" is the number of the zone. They should be entered as two character ISO country codes in all capital letters. They should be separated by commas with no spaces or other punctuation. For example:
1: GB 3: AT,BE,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR 2: US,CA 4: JP,AU,NZ,SG,TW,CN,HK 5: 00

Sunday, 3 February 2013

OpenBravo Tips

openbravopos.properties config file lives in '/home/' in Linux or 'C:\Document and Settings\' in Windows For example to test the printer is properly connected to the first serial port type: in Windows type test > COM1: in Linux echo test > /dev/ttyS0 See: http://wiki.openbravo.com/wiki/Projects:POS/Hardware_Installation_Guide If a serial connection is chosen, the configuration must be: bauds: 9600, data bits 8, stop bits 1 and parity none.