rasti.hil@hilandco.com +41 79 367-9677

Windows Commands

FOR /L %G IN (1,1,600) DO copy test.txt test%G.txt

ORA-24247: network access denied by access control list (ACL)

This mean that your user can't access to network.
Solution without any description pleas read the following source

create or replace
PROCEDURE CREATE_ACL(IN_USERNAME IN VARCHAR2,
IN_HOST IN VARCHAR2,
IN_PORT_START IN NUMBER DEFAULT NULL,
IN_PORT_END IN NUMBER DEFAULT NULL)
AS
ACL VARCHAR2(4000);
ACL_NAME VARCHAR2(4000);

l_port NUMBER;
u_port NUMBER;
BEGIN
-- create ACL name
acl_name := LOWER(in_host);
acl_name := REPLACE(acl_name, '.', '_');
acl_name := acl_name||'.xml';

-- chech if ACL is existing for a given host
-- if not than create a new ACL list
-- if yes than just add a user to list

FOR C1 IN (SELECT ACL FROM SYS.dba_network_acls where ACL='/sys/acls/'||acl_name)
LOOP
acl := C1.ACL;
END LOOP;

IF acl IS NOT NULL THEN
-- add to an existing list the user with CONNECT privilige
DBMS_NETWORK_ACL_ADMIN.add_privilege (acl => acl_name,
principal => upper(in_username),
is_grant => TRUE,
privilege => 'connect',
position => NULL,
start_date => NULL,
end_date => NULL);
COMMIT;
-- add to an existing list the user with RESOLVE privilige
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => acl_name,
principal => upper(in_username),
is_grant => true,
privilege => 'resolve');
COMMIT;
ELSE
-- create an ACL
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => acl_name,
description => in_host||' connection list',
principal => upper(in_username),
is_grant => true,
privilege => 'connect',
start_date => SYSTIMESTAMP,
end_date => NULL);
COMMIT;
-- assign host to ACL
-- now you can define port number
-- note[1] witn an existing ACL you can't define port numbers
-- if port numbers are NULL's then create a default one
IF in_port_start IS NULL THEN
l_port := 1;
ELSE
l_port := in_port_start;
END IF;
IF in_port_end IS NULL THEN
u_port := 10000;
ELSE
u_port := in_port_end;
END IF;
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => acl_name,
host => in_host,
lower_port => l_port,
upper_port => u_port);
COMMIT;
-- add to newly created list the user with RESOLVE privilige
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => acl_name,
principal => upper(in_username),
is_grant => true,
privilege => 'resolve');

COMMIT;
END IF;

EXCEPTION WHEN OTHERS THEN
dbms_output.put_line(SQLERRM);
END CREATE_ACL;

Step 2) use it:
note[1] I assume that CREATE_ACL procedure is created under sys user.
SQL> exec CREATE_ACL(IN_USERNAME   => 'scott',
IN_HOST => 'www.google.com',
IN_PORT_START => 80,
IN_PORT_END => 80);
SQL> conn scott/tiger
Connected.
SQL> select utl_http.request('http://www.google.com') from dual;
UTL_HTTP.REQUEST('HTTP://WWW.GOOGLE.COM')
--------------------------------------------
<!doctype html><html><head ...



janos ujvari @ 25th November 2009

Change image prefix /i/ after instalation of APEX

OK here is a new one

if you install or upgrade APEX your command look like this
sql> @apexins APEX APEX TEMP /i/

and the most common error is that you forgot the trailing slash at the and of image prefix
sql> @apexins APEX APEX TEMP /i

and when you are trying to access to APEX your image, CSS and JavaScript files are disappeared, checking the source code you get something like this
<script src="/ijavascript/apex_builder.js" type="text/javascript">

Probably now you had noticed that the slash is missing after letter i

Solution: Go to your apex install source change working directory to utilities and run reset_image_prefix.sql
sql> @reset_image_prefix.sql



janos ujvari @ 24th november 2009

Oracle 11g and JAVA and ORA-29516

Hi, so if you encounter with the following error when you want to call a JAVA Wrapper which source class was uploaded to db by loadjava:
ORA-29516: Aurora assertion failure: Assertion failure at eox.c:332
Uncaught exception System error: java/lang/UnsupportedClessVersionError



as the error says your class version is not recognized by Oracle.
  1. check your JAVA version by invoking:

  2. java -version

  3. check which JAVA version is used by Oracle 11g by invoking:

  4. [($ORACLE_HOME/jdk/bin/)|( %ORACLE_HOME%\jdk\bin)]java -version


probably the two versions are not the same.
Solution use the same version for compiling *.java files, or if you want to be 100% sure use
[($ORACLE_HOME/jdk/bin/)|( %ORACLE_HOME%\jdk\bin)]javac
for compiling.

janos ujvari @19th november 2009

Linux commands


Terminal - ps with parent/child process tree

ps auxf

10 files/dirs using disk
du -chs * | sort -rn | head

Find the largest file in a directory

find . -type f -iname "*.TMP" -printf '%s %p\n'| sort -nr | head -10

Calculate the directory contained number of files:

find . -maxdepth 1 -type f |wc -l

Using a loop with rm command to delete lot of files

 for i in *.py; do rm -f $i; done

cd $ORACLE_HOME
du -ak | sort -k1,1n
export folder=$ORACLE_HOME/Apache/Apache/logs
find $folder -name '*log*' -type f -mtime +2 | xargs ls -l
find $folder -name '*log*' -type f -mtime +2 | xargs rm

export folder=$ORACLE_HOME/j2ee/*/log/*/*
find $folder -type f -mtime +2 | xargs ls -l
find $folder -type f -mtime +2 | xargs rm

export folder=$ORACLE_HOME/discoverer/logs
find $folder -type f -mtime +2 | xargs ls -l
find $folder -type f -mtime +2 | xargs rm

export folder=$ORACLE_HOME/ldap/odi/log
find $folder -type f -mtime +2 | xargs ls -l
find $folder -type f -mtime +2 | xargs rm

export folder=$ORACLE_HOME/ldap/log
find $folder -type f -mtime +2 | xargs ls -l
find $folder -type f -mtime +2 | xargs rm


find . -type f -size +1000k | xargs ls -l

ps -ef | grep oracle | grep -v root | awk '{print $2}' | xargs kill

lsof -i -n -P | grep 1810

grep -i 'word' filename
grep 'string1 string2' filename
cat otherfile | grep 'something'
grep -r "word" /etc/

grep -c 'word' /path/to/file
grep -v bar /path/to/file
grep -l '192' *.log

putty login failed "No supported authentication methods left to try"

vi /etc/ssh/sshd_config

set PasswordAuthentication to yes

ARP cache contents arp -an

Track ARP traffic
tcpdump -n -i eth0 arp
tcpdump -c 3 -nni eth0:1 arp

Send ARP Reponse (gratuitous ARP response ) arping -q -c 3 -A -I eth0 192.168.1.11

kill -9 `pgrep -of soaMNGSRV_02`

vi -O foo.txt bat.txt


  • ctrl+z
  • bg
  • disown -h 
  • exit


  • Ctrl-z
  • jobs
  • bg %jobnum ( job %1 & )


DATE=$(date +%Y%m%d-%H%M%S)

list the process specific file
lsof /var/log/syslog

list the processes under a specified directory
lsof +D /var/log/

list the process with a string
lsof -c java

list the process with specific users ( exclude ^oracle )
lsof -u oracle

list by a specific process
lsof -p 1753

list pid
lsof -t java

list specific user and command string
lsof -u oracle -c java

list specific user and command string and belongs to user
lsof -u oracle -c java -a

list specific user ,command string and belongs to user, repeat
lsof -u oracle -c java -a -r5

list all the network (-i4 or -i6)
lsof -i

list particular port
lsof -i :7001

list all the TCP or UDP
lsof -i tcp; lsof -i udp;


Single port:
nc -zv 127.0.0.1 80

Multiple ports:
nc -zv 127.0.0.1 22 80 8080

Oracle Software Download with wget

wget --load-cookie /home/user/.mozilla/firefox/xxxxx.default/cookies.txt "http://edelivery.oracle.com/EPD/Download/process_download/Vxxxxxx.zip?file_id=xxxxx&aru=xxxx&userid=xxxx&egroup_aru_number=xxxx&email=xxxx@xxxxx&country_id=xxx&patch_file=Vxxxx.zip" -O Vxxxxx.zip

Clone your Ubuntu installation onto a new hard disk

open a terminal window, and type the command:

  1. fdisk -l
  2. dd if=/dev/sda of=/dev/sdX
check right order; old disk > newdisk

OPATCH_PLATFORM_ID

Normally the platform id is picked up from the file :
%ORACLE_HOME%\inventory\ContentsXML\ oraclehomeproperties.xml
(If you want to over-ride the value, it can be done through setting the variable OPATCH_PLATFORM_ID.)

Unix
export OPATCH_PLATFORM_ID=0
set OPATCH_PLATFORM_ID=0

OracleAS Metadata Repository Creation Assistant

Initialization Parameters


alter system set aq_tm_processes=9 scope=both;
alter system set sessions=400 scope=both;
alter system set pga_aggregate_target=96M scope=both;
alter system set shared_pool_size=175M scope=both;
alter system set db_cache_size=144M scope=both;
alter system set query_rewrite_enabled=TRUE scope=both;



cd ultrasearch/admin
@wk0setup.sql "/u00/app/oracle/product/10.2.0" @SID SYS
password "as sysdba" wksys SYSAUX TEMP "" "" DATABASE ""
/u00/app/oracle/product/mrca/classes12.zip
/u00/app/oracle/product/mrca/orai18n.jar
/u00/app/oracle/product/mrca/jdk/bin/java
/u00/app/oracle/product/mrca/ctx/bin/ctxhx NOT_INITIALIZED
NOT_INITIALIZED /u00/app/oracle/product/mrca


conn / AS sysdba

CREATE TABLESPACE "XDB" DATAFILE 'xmldb01.dbf' SIZE 250M
AUTOEXTEND ON NEXT 10485760 MAXSIZE 2048M LOGGING
ONLINE PERMANENT BLOCKSIZE 8192 EXTENT MANAGEMENT LOCAL
AUTOALLOCATE SEGMENT SPACE MANAGEMENT MANUAL;

spool xdb_install.lst

-- create functionality and repository

@rdbms/admin/catqm.sql oracle XDB TEMP


@ctx/admin/catctx.sql CTXSYS SYSAUX TEMP NOLOCK
@ctx/admin/defaults/drdefus.sql

sq
@ord/admin/ordinst.sql SYSAUX SYSAUX
@ord/im/admin/iminst.sql
@ord/im/admin/imchk.sql

create user MDSYS identified by password
default tablespace SYSAUX account lock;
@md/admin/mdprivs.sql
spool spatial_installation.lst
@md/admin/mdinst.sql
spool off




-- test spatial
execute validate_sdo;
select comp_id, control, schema, version, status, comp_name from dba_registry where comp_id='SDO';
select object_name, object_type, status from dba_objects where owner='MDSYS' and status <> 'VALID' order by object_name;

Adding startup script

Let’s begin I need to start lampp at boot time. So in a next few step I’ll show how was I solved this problem.

[1]: create a script

sudo mcedit /etc/init.d/lampp

#!/bin/bash
/opt/lampp/lampp start


[2]: add my script to startup list

sudo update-rc.d lampp defaults


[3]: I have to make this file executable

sudo chmod +x /etc/init.d/lampp


[4]: reboot and enjoy

sudo reboot

Sql Developer Data Modeling

1) Select File -> Import -> Data Dictionary

2) Click Add button

3) Type: ORACLE
Name: hr
Host: localhost
Port: 1521
SID: xe
Username: hr
Password: (password for hr user)

Click OK button

4) Select hr connection.

Click the Test Connection.
If connection is not successful error message is displayed.
Click the Next button.
5) Check in hr schema and click Next button.


6) Click Select All button and click Next

7) Click Finish 8) Click Save or Close

Connecting to MySQL in JDeveloper



1) Download MySQL Connector/J 3.0.11
2) Select Tools -> Default Project Properties in JDeveloper



3) Select Libraries in the tree view. Click Add Library in the right plane.


4) Click New.. 5) Library Name: MySql
Location: User
Click Add Entry..

The Select Path Entry dialog is displayed.

6) Click OK


7)Click OK
8)Select the Connections tab and right-click on the Database node to select New Database Connection.
9) Click Next

10) Connection Name: MySql
Connection Type:
Third Party JDBC Driver

Click Next.

11) In the Authentication window specify Username as root (Password is not required to be specified for a root user by default), and click on Next.
12) Click New..

In the Driver Class field enter com.mysql.jdbc.Driver.

Click Browse..In the Library, select the MySql library that you defined earlier.
Click OK
Click OK

13) Enter the URL: jdbc:mysql://localhost/test?
Click Next

14) Click Test Connection

SSH tuneling: it's easy

Often the remote computer I want to operate is firewalled so it only possible to connect over port# 22.
Here is a simple description how to make an ssh tunel:
ssh -f user@remote-machine.com -L localport#:remote-machine.com:remoteport# -N

-f run in background;
-L localport#:remote-machine.com:remoteport# which local port will be connected to wich remote port.
-N instructs OpenSSH to not execute a command on the remote system.