Thursday, March 27, 2014

fix 32-bit application default 2GB limitation

ref: http://www.jvadillo.com/software/3gbproblem.html

http://www.dansdata.com/askdan00015.htm


Improving Windows XP memory management for large amounts of data
As mentioned in the Microsoft Help & Support page, there is a boot option called /3GB that reduces the amount of memory reseved to the system to the last 1GB, leaving 3 GB for user applications instead of 2GB.
Two actions have to be taken in order to have an application that can access more than 2GB of RAM:
1. Change your Windows XP boot.ini file to have the /3GB flag active. To do so open the C:\boot.ini file in a text editor:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional 3GB " /fastdetect /3GB
2. Change your executable application header activating the LARGEADDRESSAWARE flag.
This flag can be activated using a Visual Studio application called EDITBIN.EXE.To do so, just call the tool as follows:
editbin /LARGEADDRESSAWARE name_of_the_executable.exe
This action modifies the following fields of the PE header structure:
  • IMAGE_FILE_HEADER.Characteristics: IMAGE_FILE_LARGE_ADDRESS_AWARE bit (0x0020) set.
  • IMAGE_OPTIONAL_HEADER32 CheckSum is recomputed taking into account the modified field.

Sunday, March 2, 2014

SFTP jail


summary:

In /etc/ssh/sshd_config :

You need to configure OpenSSH to use its internal SFTP subsystem.
Subsystem sftp internal-sftp
Then, I configured chroot()ing in a match rule.
Match User ftpuser
         ChrootDirectory /var/www/html
         X11Forwarding no
         AllowTcpForwarding no
         ForceCommand internal-sftp



create user

useradd ftpuser -g apache
chown root:root /var/www/html
usermod -d / ftpuser


detail : http://www.debian-administration.org/articles/590

Wednesday, December 25, 2013

Setup git Server under apache on Windows server 2008 R2

This summary is not available. Please click here to view the post.

Wednesday, August 28, 2013

quickest way to do massive dbsnmp password change for Oracle enterprise manager


1. using script change dbsnmp user password in database.

2. stop agent

3. modify following file  on agent home folder

$agent_inst_home/sysman/emd/targets.xml

4. change all rows have password, reset password in the file and update encryption to false



to



5. start agent

6. the password should be encrypted again.

Thursday, August 22, 2013

Oracle RAC starts hang

ref: http://abcdba.com/abcdbaservertroubleshootingrc3dstartuphangs


SYMPTOM

The Oracle High Availability Services (OHAS) software stack appears to hang when a server housing CRS, ASM, RDBMS and an application reliant on the database is rebooted.

CAUSE

It is not unusual for a server's startup routine as dictated by the contents of the /etc/rc3.d directory to contain not only the OHAS components - installed by root.sh as part of the grid infrastructure installation - but also a step that starts an application running on the same server - usually installed manually and configured to start after the OHAS components. It is also notuncommon to have the application program look for the existence of a database to which it will need to communicate, and to enter a spin/sleep cycle and wait for access to the database to become available.
Unfortunately, due to the requirements of OHAS to be able to handle, for example, a dead process situation, it relies on the facilities offered by the inittab functionality to issue a 'respawnable' execution of the init.ohasd process. This is the process that ultimately starts the OHAS software stack and, as per any configured services, will initiate, amongst others, the listener, the ASM instance and the RDBMS instance. The entry for this process is located in the/etc/inittab file and, like the rc3.d entries, is is also installed by root.sh as part of the grid infrastructure installation.
Field two of each entry in the /etc/inittab file state the run level(s) that the server must have reached in order for the entry to be executed. In the case of init.ohasd this is set to 3 and 5. Thus a 'chicken and egg' situation arises whereby the rc3.d entries cannot complete - in this example because the application is sleeping and waiting for the database to start - and the inittab entry - which ultimately starts the database - cannot begin because the rc3.dprocesses haven't finished. The net result is an apparently hung startup.

EXAMPLE /etc/inittab ENTRY

h1:35:respawn:/etc/init.d/init.ohasd run >/dev/null 2>&1 

SOLUTION

Write a wrapper for rc scripts and call original script at backgroud with &
e.g. 

#!/bin/ksh
#
# It was created as a workaround to speed up RAC's startup at boot time.  ###################################################################################

FLAG=${1}

/etc/init.d/gcstartup ${FLAG} &

 
As the /etc/inittab file will not get processed until /etc/rc3.d entries complete, any entry in the /etc/rc3.d directory must not be allowed to sleep and wait for the OHAS software stack to appear. Instead, either remove the application startup completely from the rc3.d process and if appropriate start the application manually after the OHAS software stack is up, or rewrite the application startup routine so that rather waiting 'in line' as part of the rc3.dprocesses, it spawns another 'out of line' process perhaps using the /usr/bin/at command and a suitable delay.
Either of the above solutions will ensure that the server reaches runlevel 3 unhindered, and so allows any dependent steps configured in /etc/inittab to begin.

Thursday, July 18, 2013

Using the Oracle 11GR2 database flash cache

http://guyharrison.squarespace.com/blog/2009/11/24/using-the-oracle-11gr2-database-flash-cache.html

key parameter

you configure the flash cache by setting the parameters DB_FLASH_CACHE_FILE and DB_FLASH_CACHE_SIZE.

Thursday, April 25, 2013

the way to set application path without touch system path

http://msdn.microsoft.com/en-us/library/ee872121%28VS.85%29.aspx#appPaths



o register and control the behavior of your applications with the App Paths subkey:
  1. Add a subkey with the same name as your executable file to the App Paths subkey, as shown in the following registry entry.
    HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER
       SOFTWARE
          Microsoft
             Windows
                CurrentVersion
                   App Paths
                      file.exe
                         (Default)
                         DontUseDesktopChangeRouter
                         DropTarget
                         Path
                         UseUrl

Thursday, April 11, 2013

database suspend


database suspend
ref:  --http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:373618158622
from Tom
"
The basic steps for using SUSPEND and RESUME are as follows:
Place the database tablespaces in hot backup mode using the ALTER TABLESPACE BEGIN BACKUP
statement. For example, to place tablespace USERS in hot backup mode enter:

ALTER TABLESPACE users BEGIN BACKUP;


       
If your mirror system has problems with splitting a mirror while disk writes are
occurring, issue the following:

ALTER SYSTEM SUSPEND;
   

       
Split your mirrors at the O/S or hardware level.

Issue the following:

ALTER SYSTEM RESUME;
   

       
Take the specified tablespaces out of hot backup mode. For example, to take tablespace
USERS out of hot backup mode enter:

ALTER TABLESPACE users END BACKUP;
   

       
Copy the control file and archive the online redo logs as usual for a backup.
"

Friday, January 18, 2013

How Do I Reset A Lost Weblogic Admin User Password?

ref: http://www.kpipartners.com/blog/bid/137794/how-do-i-reset-a-lost-weblogic-admin-user-password?utm_source=twitter&utm_medium=social&utm_content=f6f6d54b-7a48-4584-b676-8799daca3a5b

main steps:

1. Make sure all the services are down
2. change directory to \user_projects\domains\bifoundation_domain\bin
cd \user_projects\domains\bifoundation_domain\bin
3. Source the setDomainEnv.cmd(Windows) / setDomainEnv.sh (Linux) script so we can get all the WebLogic variables set correctly
In windows: setDomainEnv.cmd
In Linux: . setDomainEnv.sh
4. Now change the directory to security directory in your instance.
cd \user_projects\domains\bifoundation_domain\security
5. Move the DefaultAuthenticatorInit.ldift to a backup file
In Windows:
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit_old.ldift
In Linux:
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit_old.ldift
6. Run the “java weblogic.security.utils.AdminAccount newuser newpassword .” to generate a new DefaultAuthenticatorInit.ldift with a new user with the assigned password within the security directory
eg: java weblogic.security.utils.AdminAccount weblogic weblogic123 .
Notereplace newuser and newpassword with a user and password of your choosing. Ensure the password is a minimum of 8 characters and contains at least one numeric character. Also, don’t forget the period “.” at the end of the above command, it is required.
7. Change directory to \user_projects\domains\bifoundation_domain\servers\AdminServer\security
cd \user_projects\domains\bifoundation_domain\servers\AdminServer\security\
8. Edit the boot.properties file and replace newpassword and newusername with the user and password you defined in step 6. Do this for all the servers in the domain.
password=newpassword
username=newusername
The boot.properties will get encrypted once the admin server starts up
9. Rename or remove directory\user_projects\domains\bifoundation_domain\servers\AdminServer\data\ldap as it will get recreated once the WebLogic Admin server starts.
e.g:
rename \user_projects\domains\bifoundation_domain\servers\AdminServer\data\ldap \user_projects\domains\bifoundation_domain\servers\AdminServer\data\ldap_OLD
10. Change directory to \user_projects\domains\bifoundation_domain\bin and start the Weblogic Admin Server
In Windows: startWebLogic.cmd
In Linux:  ./ startWebLogic.sh
11. Once the weblogic server is up, you’ll be able to login to Console with the new weblogic Admin user and password.

12 The last things is if some file get locked reboot your machine or find the process and stop it or kill it. I run into file get locked by jvm controller.

Monday, November 26, 2012

Run remote commands by powershell


--ref: http://searchsystemschannel.techtarget.com/feature/PowerShell-remoting-in-Windows-Server-2008-R2

--1. enable remote on server e.g. xxx

PS C:\Users\oraexec> Enable-PSRemoting

WinRM Quick Configuration
Running command "Set-WSManQuickConfig" to enable this machine for remote management through WinRM service.
 This includes:
    1. Starting or restarting (if already started) the WinRM service
    2. Setting the WinRM service type to auto start
    3. Creating a listener to accept requests on any IP address
    4. Enabling firewall exception for WS-Management traffic (for http only).

Do you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
WinRM already is set up to receive requests on this machine.
WinRM has been updated for remote management.
Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
WinRM firewall exception enabled.


Confirm
Are you sure you want to perform this action?
Performing operation "Registering session configuration" on Target "Session configuration "Microsoft.PowerShell32" is
not found. Running command "Register-PSSessionConfiguration Microsoft.PowerShell32 -processorarchitecture x86 -force"
to create "Microsoft.PowerShell32" session configuration. This will restart WinRM service.".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
PS C:\Users\oraexec>

--2. add to trust on client
If you are managing a remote computer from a computer that is running Windows 7, start the Windows Remote Management (WinRM) service to allow for the addition of trusted hosts. Open a Command Prompt session with elevated user rights by clicking Start, clicking All Programs, clicking Accessories, right-clicking Command Prompt, and then clicking Run as administrator. Type the following, and then press Enter: net start winrm
For remote connections in a Workgroup to Workgroup/Domain scenario, the remote computer must be added to the trusted hosts list on the source computer. To do this, run the following command on the source computer in a Command Prompt window that is opened with elevated user rights.
winrm set winrm/config/client @{TrustedHosts="RemoteComputerName"}
For remote connections in a Workgroup to Workgroup/Domain scenario, if a user is not logged on by using the source computer’s built-in administrator account, the following WinRM registry key must be configured to allow remote access from the source computer. This change is required because of a User Account Control (UAC) limitation on non-administrator accounts that are members of the Administrators group. To change this registry key, run the following command on the source computer at a command prompt that is opened with elevated user rights.
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
By default, WinRM allows for a maximum of five connections to a remote computer to be active per user. To increase the limit, run the following command on the source computer, in which X represents the number of connections that you want to allow, at a command prompt that is opened with elevated user rights.
winrm s winrm/config/winrs @{MaxShellsPerUser="X"}


winrm set winrm/config/client @{TrustedHosts="xxxxx"}

--3. run powershell on client
 $host.version

--4. test connection with remote
PS H:\> Test-WSMan xxxxx


wsmid           : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor   : Microsoft Corporation
ProductVersion  : OS: 0.0.0 SP: 0.0 Stack: 2.0

--remote commands
Invoke-Command -ComputerName Monolith -ScriptBlock { Get-ChildItem C:\ } -credential chris
Invoke-Command [-FilePath] [[-ComputerName] ]

Invoke-Command -ScriptBlock {E:\scripts\test.cmd} -ComputerName cepaoas91 -credential cepaoas91\oraremote

--5. enter remote session
Enter-PSSession -ComputerName server1 -Credential domain\user

Enter-PSSession -ComputerName server1 -Credential domain\user



Tuesday, June 5, 2012

Setup Android SDK in Titanium studio

1. follow instructions to download and install https://wiki.appcelerator.org/display/guides/Installing+and+Updating+Android+SDK

2 Install google NDK

3. configure SDK in titanium preference


Monday, May 28, 2012

How to display all markers in KML on google map.

1. create your map on google.
2. upload kml
3. right click link of kml shows on google map and copy link address
4. put link address in search box on google map. Now it shows all markers
5. copy the link in address box, and put it in your applicaiton or plug-in s.

e.g.https://maps.google.com/maps?q=http://maps.google.com/maps/ms%3Fauthuser%3D0%26vps%3D7%26hl%3Den%26ie%3DUTF8%26oe%3DUTF8%26msa%3D0%26output%3Dkml%26msid%3D206738220065198958312.0004b30f84e45cd59ff3a&hl=en&sll=37.0625,-95.677068&sspn=56.987104,114.785156&vpsrc=0&t=h&z=11

Friday, February 3, 2012

test Oracle webservice by PL/SQL

--load java for webservice
--ref: DBWS Callout Utilities User's Guide for RDBMS 10.1 or 10.2 [ID 428775.1]
--http://docs.oracle.com/cd/B19306_01/java.102/b14188/intro.htm#BHCIBFGJ
--download:http://download.oracle.com/technology/sample_code/tech/java/jsp/dbws-callout-utility-10131.zip

--to load java make sure using right java version

export PATH=$ORACLE_HOME/jdk/bin:$PATH

loadjava -u rsong/slb -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar

--test ref: http://www.oracle-base.com/articles/10g/utl_dbws10g.php

CREATE OR REPLACE FUNCTION add_numbers (p_int_1 IN NUMBER,
p_int_2 IN NUMBER)
RETURN NUMBER
AS
l_service RSONG.UTL_DBWS.service;
l_call RSONG.UTL_DBWS.call;
l_wsdl_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_service_qname RSONG.UTL_DBWS.qname;
l_port_qname RSONG.UTL_DBWS.qname;
l_operation_qname RSONG.UTL_DBWS.qname;

l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_return NUMBER;
BEGIN
l_wsdl_url := 'http://www.oracle-base.com/webservices/server.php?wsdl';
l_namespace := 'http://www.oracle-base.com/webservices/';

l_service_qname := RSONG.UTL_DBWS.to_qname(l_namespace, 'Calculator');
l_port_qname := RSONG.UTL_DBWS.to_qname(l_namespace, 'CalculatorPort');
l_operation_qname := RSONG.UTL_DBWS.to_qname(l_namespace, 'ws_add');

l_service := RSONG.UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);

l_call := RSONG.UTL_DBWS.create_call (
service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname);

l_xmltype_in := SYS.XMLTYPE('
' || p_int_1 || '
' || p_int_2 || '
');
l_xmltype_out := RSONG.UTL_DBWS.invoke(call_Handle => l_call,
request => l_xmltype_in);
RSONG.UTL_DBWS.release_call (call_handle => l_call);
RSONG.UTL_DBWS.release_service (service_handle => l_service);

l_return := l_xmltype_out.extract('//return/text()').getNumberVal();
RETURN l_return;
END;
/

exec dbms_java.grant_permission( 'RSONG', 'SYS:java.lang.RuntimePermission', 'getClassLoader', '' );
select add_numbers(1,2) from dual;

DBAREPO1 SQL> /
select add_numbers(1,2) from dual
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: java.lang.NoClassDefFoundError
ORA-06512: at "RSONG.UTL_DBWS", line 193
ORA-06512: at "RSONG.UTL_DBWS", line 190
ORA-06512: at "RSONG.ADD_NUMBERS", line 25


--debug
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','shutdownHooks','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','setFactory','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','accessClassInPackage.sun.util.calendar','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','getClassLoader','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','createClassLoader','');
exec dbms_java.grant_permission('RSONG','SYS:java.util.logging.LoggingPermission','control','');
exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','http.proxySet','write' );
exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','http.proxyHost','write');
exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','http.proxyPort','write');

exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','*','read,write,resolve,connect');

-- shows true error
DBAREPO1 SQL> select add_numbers(1,2) from dual;
select add_numbers(1,2) from dual
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model:
oracle.j2ee.ws.common.tools.api.WsdlValidationException: Failed to setup HTTP
Connection to URL: "http://www.oracle-base.com/webservices/server.php?wsdl",
caused by: java.security.AccessControlException. : the Permission
(java.net.SocketPermission www.oracle-base.com resolve) has not been granted to
RSONG. The PL/SQL to grant this is dbms_java.grant_permission( 'RSONG','SYS:java.net.SocketPermission', 'www.oracle-base.com', 'resolve' )
ORA-06512: at "RSONG.UTL_DBWS", line 193
ORA-06512: at "RSONG.UTL_DBWS", line 190
ORA-06512: at "RSONG.ADD_NUMBERS", line 25



exec dbms_java.grant_permission('RSONG', 'SYS:java.net.SocketPermission', '88.208.252.198:80','connect,resolve' );

DBAREPO1 SQL> select add_numbers(1,2) from dual;
select add_numbers(1,2) from dual
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.ExceptionInInitializerError
ORA-06512: at "RSONG.UTL_DBWS", line 404
ORA-06512: at "RSONG.UTL_DBWS", line 401
ORA-06512: at "RSONG.ADD_NUMBERS", line 39

--finally
exec dbms_java.grant_permission( 'RSONG', 'SYS:java.util.PropertyPermission', 'HTTPClient.socket.idleTimeout', 'write' );

DBAREPO2 SQL> select add_numbers(1,2) from dual;

ADD_NUMBERS(1,2)
----------------
3
--overall permissions
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','shutdownHooks','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','setFactory','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','accessClassInPackage.sun.util.calendar','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','getClassLoader','');
exec dbms_java.grant_permission('RSONG','SYS:java.lang.RuntimePermission','createClassLoader','');
exec dbms_java.grant_permission('RSONG','SYS:java.util.logging.LoggingPermission','control','');
exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','http.proxySet','write' );
exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','http.proxyHost','write');
exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','http.proxyPort','write');

exec dbms_java.grant_permission('RSONG','SYS:java.util.PropertyPermission','*','read,write,resolve,connect');

exec dbms_java.grant_permission('RSONG', 'SYS:java.net.SocketPermission', '88.208.252.198:80','connect,resolve' );

exec dbms_java.grant_permission( 'RSONG', 'SYS:java.util.PropertyPermission', 'HTTPClient.socket.idleTimeout', 'write' );

Wednesday, January 11, 2012

11R2 RAC listener and service name clarify

1. Service name
In Oracle RAC you should not change service_names in initxxx.ora parameter file. You need use servctl utility to add,remove a service name and the utility will update parameter file.http://docs.oracle.com/cd/E11882_01/rac.112/e17264/configwlm.htm#CHDJIAJH

2. Listener
From 11R2 start using SCAN listener. there is one bug that DBCA does not recognize parameter format like orarac1-scan:1521.
The workaround will be
a) set remote_listener to '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=162.106.114.130)(PORT=1521)))(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=162.106.114.131)(PORT=1521))))' which applied to database running under version 11R1 or before
b) set remote_listener to 'orarac1-scan:1521' in sqlplus after database is created.

3. client connection process
a) a client contact listener listed in tnsnames.ora. 11R2 client can handle multiple address with a name but the version before does not.
b)make hand shake with the listener(scan listener), if it fails client 11R1 or before will fail. 11r2 client will try next ip returned by scan name and so on.
c) if client success make hand shake with scan listener then scan listener will find service registered in RAC and try find a instance which has less workload.
If there is no service registered, it will use information registered in listener which has instance lists.
d) pass connect to that instance(load balancing) or random instance if there is no workload information found in previous step.
e) connection made.

Tuesday, January 3, 2012

Oracle RAC patch 11.2.0.3 quit due to fatal error Unable to obtain network interface list from Oracle ClusterwarePRCT-1302 : The "with" has an invalid

##bug OIFCFG Reports PRIF-30 after Successful Upgrade to 11gR2 Grid Infrastructure [ID 983718.1] ##
## bug 8632280 ###
olive /dbaadm/bu/bin/patch/patchset11203/GI/grid$ oifcfg getif
nxge1 162.106.225.0 global cluster_interconnect
Only in OCR: nxge0 162.106.114.0 global public
PRIF-30: Network information in OCR profile needs to be synced with GPnP profile
olive /dbaadm/bu/bin/patch/patchset11203/GI/grid$ oifcfg delif -global nxge1
olive /dbaadm/bu/bin/patch/patchset11203/GI/grid$ oifcfg setif -global nxge0/162.106.114.0:public
olive /dbaadm/bu/bin/patch/patchset11203/GI/grid$ oifcfg getif
nxge0 162.106.114.0 global public