Showing posts with label OS. Show all posts
Showing posts with label OS. Show all posts

Monday, July 20, 2009

How to check or identify which process is listening to port 80 in windows

From yesterday, on my computer I could not start my apache service. From the XAMPP Control Panel Application whenever I start Apache it fails to start. I reinstalled apache several time but it could not help . In fact after installing Apache HTTPD web server or Microsoft IIS Internet Information Services web server, or any other application software or service and daemon that requires to open and listen to port 80 (HTTP) or port 443 (HTTPS SSL) it fails. So I consider myself to investigate about the program that is using port 80 or 443.

I am sure that a program is using port 80 or port 443 and restrict apache to use these port as I get following after installing Apache web server using XAMPP.

(OS 10052) Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down


So, I need to identify the program which is listening to port 80 and kill that process or at least restrict that process to listen to port 80.

To following steps will help you to find the culprit one.

1)Open command prompt. You can do it by clicking your start menu, then select Run, type cmd in the Run box and hit enter.

2)I expect you will see command prompt here unless you have viruses in your computer that restrict to show. In the command prompt type,

>netstat -o -n -a | findstr 0.0:80
in order to determine the process ID which is using port 80.

or type,
>netstat -o -n -a | findstr 0.0:443
in order to determine the process ID which is listening to port 443.

or type,
>netstat -aon
in order to list all connection that is listening, established, starting, closing and all other states. As netstat -aon will list all connections so from that you need to manually search for line 0.0.0.0:80 or 0.0.0.0:443 to determine the process ID.

3)Determine the process ID which is listening to port 80 or 443.
A typical output from the above commands are,
E:\Documents and Settings\Arju>netstat -o -n -a | findstr 0.0:80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4712

E:\Documents and Settings\Arju>netstat -o -n -a | findstr 0.0:443
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 4712
UDP 0.0.0.0:443 *:* 316

E:\Documents and Settings\Arju>netstat -aon

Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4712
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1324
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 4712
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 1920
TCP 0.0.0.0:5101 0.0.0.0:0 LISTENING 7636
TCP 0.0.0.0:17536 0.0.0.0:0 LISTENING 316
TCP 10.65.49.113:1175 118.160.238.122:80 ESTABLISHED 316
TCP 10.65.49.113:1451 209.85.137.125:5222 ESTABLISHED 1588
TCP 10.65.49.113:1561 66.102.9.83:80 CLOSE_WAIT 3436
TCP 10.65.49.113:1623 96.17.159.66:80 CLOSE_WAIT 1964
TCP 10.65.49.113:2659 216.10.192.112:80 CLOSE_WAIT 5164
TCP 10.65.49.113:2782 216.10.192.112:80 CLOSE_WAIT 3692
TCP 10.65.49.113:3084 74.125.87.83:80 ESTABLISHED 2736
TCP 10.65.49.113:3179 74.125.87.191:80 ESTABLISHED 2736
TCP 10.65.49.113:3180 74.125.87.83:80 ESTABLISHED 2736
TCP 10.65.49.113:3185 74.125.87.101:443 ESTABLISHED 5164
TCP 10.65.49.113:3187 74.125.87.147:80 ESTABLISHED 5164
TCP 10.65.49.113:3850 68.180.217.28:5050 ESTABLISHED 7636
TCP 10.65.49.113:3881 68.142.233.181:80 ESTABLISHED 7636
TCP 10.65.49.113:4837 207.46.125.86:1863 ESTABLISHED 320
TCP 127.0.0.1:1247 0.0.0.0:0 LISTENING 3692
TCP 127.0.0.1:1557 0.0.0.0:0 LISTENING 6172
TCP 127.0.0.1:1557 127.0.0.1:1558 ESTABLISHED 6172
TCP 127.0.0.1:1558 127.0.0.1:1557 ESTABLISHED 7928
TCP 127.0.0.1:1672 0.0.0.0:0 LISTENING 1532
TCP 127.0.0.1:1727 127.0.0.1:1728 ESTABLISHED 7636
TCP 127.0.0.1:1728 127.0.0.1:1727 ESTABLISHED 7636
TCP 127.0.0.1:1990 127.0.0.1:1991 ESTABLISHED 5164
TCP 127.0.0.1:1991 127.0.0.1:1990 ESTABLISHED 5164
TCP 127.0.0.1:1993 127.0.0.1:1994 ESTABLISHED 5164
TCP 127.0.0.1:1994 127.0.0.1:1993 ESTABLISHED 5164
UDP 0.0.0.0:443 *:* 316
UDP 0.0.0.0:17536 *:* 316
UDP 10.65.49.113:123 *:* 1364
UDP 10.65.49.113:1900 *:* 1500
UDP 127.0.0.1:123 *:* 1364
UDP 127.0.0.1:1025 *:* 1924
UDP 127.0.0.1:1171 *:* 316
UDP 127.0.0.1:1716 *:* 320
UDP 127.0.0.1:1730 *:* 7636
UDP 127.0.0.1:1900 *:* 1500
UDP 127.0.0.1:2993 *:* 1588
UDP 127.0.0.1:9877 *:* 1924
UDP 127.0.0.1:9977 *:* 1924
UDP 127.0.0.1:62976 *:* 1924

From the above output we see process ID 4712 is the culprit one which is listening to port 80 and 443 and thus restrict web server to use them.

4)In this step find the process which has the Process ID 4712. You can simply follow http://arjudba.blogspot.com/2009/07/how-to-know-process-id-or-pid-on.html and bring task manager to display that process ID. From task manager Image Name determine the process name.

So now you can kill that process or still if you want to run that process first run you web server/apache and then run that program. In this way apache first will listen to port 80 and that program will not be able to use as it starts after web server.

Related Documents

How to know process ID or PID on windows

Process Identifier or Process ID or PID is the unique ID of a process running on the system. With PID we can uniquely identify a process and can know about their characteristics.

On unix based system like linux, solaris, HP-UX with "ps" command we can easily identify each type of process and their PID. We can also grep the output for filtering. But for Windows operating system such as Windows 95, Windows 98, Windows 2000, Windows XP, Windows Vista, Windows Server 2003, Windows Server 2008 and Windows 7 there is no such utility or command.

In windows through GUI we can still see the process ID or PID of a process. This is sometime very essential to track a culprit process. It can be seen from Task Manager. To get Task Manager right click on empty area in the task bar and then you can select Task Manger. You can also get Task Manager window by clicking CTRL+ALT+DEL.

After opening task manager you will see there is no process ID or PID there by default. But you can see Processes tab there. Whenever you click on processes tab, process information is shown. By default option is Image Name(Process Name), User Name(the user under whom process is running), CPU(percentage of CPU usage) and Mem Usage(Total how many KB is allocated to the process).

To get Process ID,
- Click Processes tab.
- Click on View menu, then click on Select Columns.
- In the "Select Columns" or "Select Process Page Columns" dialog, check the checkbox for PID (Process Identifier), and click OK.


You will see PID is shown and you can easily track each process identifier.

Related Documents

Sunday, July 5, 2009

Different ways to open Office .docx documents

DOCX is the Word document which is the "Microsoft Office Open XML Format Document". This is the new upcoming format for Microsoft Office documents. This extension came with Microsoft Office 2007. It is a combination of XML architecture and ZIP compression for size reduction.

Microsoft introduced the .docx file format in its Office 2007 and wants it to replace the commonly used doc format. Any word document in Office 2007 can be saved as .docx file extension but as .docx extension is latest version, so older version like Office 2000, Office XP, Office 98 are not still aware of the .docx file extension. So these software can't open the .docx file. Though Microsoft promised that .docx file will be compatible to old Microsoft word but they are still their promises.

Now, as many users still using old Microsoft Office so many users can't open the .docx file document. So the main question for these users is of course how they would open a docx file to be able to read and work with it. The answer depends on the platform you are using. Below is some solutions based on platform you are using as well as solution of platform independent.

For Older Version of Microsoft Office:
If you are on windows machine and you have older version of Microsoft Office like Office XP, Office 2000, Office 98 then the best way is to install Microsoft compatibility pack for previous Office versions that adds .docx support in Microsoft Word. You can download the compatibility pack from http://office.microsoft.com/en-us/word/HA100444731033.aspx.

If you use Open office Software:
If you use open office software then you can use the Open XML Translator for Open Office to be able to read and edit docx files.

Online Solution:
There are many websites over Internet that do the conversion job and most of them do offer the job for free. You can upload your .docx file in that site and then you will get back .doc document. There are many docx converter sites for it.

A hack way:
This procedure worked perfectly for Microsoft Office 2007 beta version. But if it is not beta then it will not work. Still you can get an idea about the contents inside your .docx file. The idea is as .docx file is the combination of XML architecture and ZIP compression. So first save the .docx file as .zip and then extract it using any extract utility like unzip. If you used beta version then word folder you will get your expected word file. If you don't you can still have an idea to rename big sized .XML to .HTML and open that file in your browser.

Related Documents

Tuesday, August 26, 2008

RMAN-06172: no autobackup found

Error Description:
While performing disaster recovery I get the error RMAN-06172 as below.

RMAN> restore spfile to pfile '/oracle/app/oracle/product/10.2.0/db_1/dbs/initARJU.ora' from '/backup1/snap/june/ctl_sp_bak_c-448149146-20080607-00';

Starting restore at 27-AUG-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK

RMAN-00571: ====================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ====================================================
RMAN-03002: failure of restore command at 08/27/2008 00:42:41
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

Cause of The Error
To perform restore operation to a new host you must have at least one autobackup of the controlfile. If you don't have autobackup of the controlfile then you would not be able to perform disaster recovery. For example if you have snapshot of controlfile backup then you will not be able to restore spfile or controlfile.

Solution of The Problem
1)To perform a disaster recovery, the minimum required set of backups is backups of some datafiles, some archived redo logs generated after the time of the backup, and at least one autobackup of the control file. So find autobackup of the controlfile and use it for restore operation.

Also ensure that you have autobackup intact and your autobackup is not corrupted. If you have corrupted backup then you will get above error.

My autobackup piece is /export/home/oracle/8rji9vrq_1_1 and so I used,
RMAN> restore spfile from '/export/home/oracle/8rji9vrq_1_1';

2)In situation you have autobackup of controlfile and it is not corrupted then still you can get the error. It is because of platform difference in endian format. It was because of BIG endian or LITTLE endian format. If you take backup in BIG endian platform and want to restore it to LITTLE endian format then above error will appear. You can check the endian format by below query.
SQL> set linesize 100
SQL> col PLATFORM_NAME format a80
SQL> select PLATFORM_NAME, ENDIAN_FORMAT from V$TRANSPORTABLE_PLATFORM;


PLATFORM_NAME ENDIAN_FORMAT
-------------------------------------------------------------------------------- --------------
Solaris[tm] OE (32-bit) Big
Solaris[tm] OE (64-bit) Big
Microsoft Windows IA (32-bit) Little
Linux IA (32-bit) Little
AIX-Based Systems (64-bit) Big
HP-UX (64-bit) Big
HP Tru64 UNIX Little
HP-UX IA (64-bit) Big
Linux IA (64-bit) Little
HP Open VMS Little
Microsoft Windows IA (64-bit) Little
IBM zSeries Based Linux Big
Linux 64-bit for AMD Little
Apple Mac OS Big
Microsoft Windows 64-bit for AMD Little
Solaris Operating System (x86) Little
IBM Power Based Linux Big

17 rows selected.

We see Solaris[tm] OE (32-bit) or Solaris[tm] OE (32-bit) has big endian format but Solaris Operating System (x86) has little endian format. So we can't perform any restore operation in Microsoft Windows 64-bit for AMD or Solaris Operating System (x86) or Microsoft Windows IA (32-bit) (All these has Little endian format) from backup that was taken from Big endian format like Solaris[tm] OE (32-bit) or Solaris[tm] OE (32-bit) or IBM Power Based Linux or IBM zSeries Based Linux or HP-UX (64-bit) or AIX-Based Systems (64-bit).

If you try to restore in Little edian format, from backup taken in Big endian format platform RMAN can't read the backuppiece and will return,
RMAN-00571: ====================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ====================================================
RMAN-03002: failure of restore command at 08/27/2008 00:42:41
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

The solution is to use same endian format.

Related Documents
RMAN-06026, RMAN-06023 During Restore Using RMAN
ORA-19573: cannot obtain exclusive enqueue for datafile 1

Wednesday, July 30, 2008

How to determine OS block size for windows or unix

In many times you probably have heard about set the oracle db block size as a multiple of the OS block size. But whenever you ask how I can determine or find OS block size for windows or Unix then many one get stopped. In fact this question is OS related. In this post I will show how I can get OS block.

1)UNIX or Linux System.
On my Solaris Machine,
SQL> !perl -e '$a=(stat ".")[11]; print $a'
8192
On my debian Linux,
$ perl -e '$a=(stat ".")[11]; print $a'
4096

On my Solaris Machine another way,
SQL> !df -g /oracle
/oracle (/dev/dsk/c1d0s3 ): 8192 block size 1024 frag size
Where /oracle is disk partition.

Another example,
SQL> !df -g | grep 'block size'
/ (/dev/dsk/c1d0s0 ): 8192 block size 1024 frag size
/devices (/devices ): 512 block size 512 frag size
/system/contract (ctfs ): 512 block size 512 frag size
/proc (proc ): 512 block size 512 frag size
/etc/mnttab (mnttab ): 512 block size 512 frag size
/etc/svc/volatile (swap ): 4096 block size 4096 frag size
/system/object (objfs ): 512 block size 512 frag size
/lib/libc.so.1 (/usr/lib/libc/libc_hwcap1.so.1): 8192 block size 1024 frag size
/dev/fd (fd ): 1024 block size 1024 frag size
/tmp (swap ): 4096 block size 4096 frag size
/var/run (swap ): 4096 block size 4096 frag size
/oradata1 (/dev/dsk/c1d0s4 ): 8192 block size 1024 frag size
/oracle (/dev/dsk/c1d0s3 ): 8192 block size 1024 frag size
/oradata2 (/dev/dsk/c1d0s5 ): 8192 block size 1024 frag size
/export/home (/dev/dsk/c1d0s7 ): 8192 block size 1024 frag size

2)Windows Machine.
If you use ntfs file system you can use
fsutil fsinfo ntfsinfo drivename: to get information of block size.

c:\>fsutil fsinfo ntfsinfo f:
NTFS Volume Serial Number : 0x1e345b64345b3e49
Version : 3.1
Number Sectors : 0x0000000004a852c0
Total Clusters : 0x0000000000950a58
Free Clusters : 0x00000000003ae433
Total Reserved : 0x0000000000000000
Bytes Per Sector : 512
Bytes Per Cluster : 4096 -- This is OS block size.
Bytes Per FileRecord Segment : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length : 0x000000000d72a000
Mft Start Lcn : 0x00000000000c0000
Mft2 Start Lcn : 0x00000000004a812c
Mft Zone Start : 0x0000000000800720
Mft Zone End : 0x000000000083b920

To get All possible size on windows machine use,
c:\ format /?
In the /A:size you will get the all possible size for both FAT and NTFS file system. Whenever you format a drive you can select default allocation unit as block size.

3)On HPUX issue like "vgdisplay -v /dev/vg01/lvol"


Related Documents

http://arjudba.blogspot.com/2008/06/choose-optimal-data-block-size-in.html
http://arjudba.blogspot.com/2008/06/advantages-and-disadvantages-of-using.html

Sunday, June 1, 2008

How to get Oracle Error Message from Database or OS

If you are on UNIX platform then from unix machine using unix command you can easily get error description, cause and action easily. You don't need to go to internet and then search error about it immediately. Suppose you got the error ORA-04043 and now you want to know the cause of the error and action of the error. From Unix machine (Linux, Solaris etc) you can easily get it by using oerr command. In order to use it For example, if you want to get cause and action of ORA-7300, then "ora" is the facility and "7300" is the error. So you should type "oerr ora 7300".

If you get LCD-111, type "oerr lcd 111", and so on.

Below is an example.

SQL> desc t;
ERROR:
ORA-04043: object t does not exist


SQL> !oerr ora 04043

04043, 00000, "object %s does not exist"
// *Cause: An object name was specified that was not recognized by the system.
// There are several possible causes:
// - An invalid name for a table, view, sequence, procedure, function,
// package, or package body was entered. Since the system could not
// recognize the invalid name, it responded with the message that the
// named object does not exist.
// - An attempt was made to rename an index or a cluster, or some
// other object that cannot be renamed.
// *Action: Check the spelling of the named object and rerun the code. (Valid
// names of tables, views, functions, etc. can be listed by querying
// the data dictionary.)

Similarly you can check other error message too.

Like,
bash-3.00$ oerr ora 600
00600, 00000, "internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
// *Cause: This is the generic internal error number for Oracle program
// exceptions. This indicates that a process has encountered an
// exceptional condition.
// *Action: Report as a bug - the first argument is the internal error number


However if you are not on UNIX platform you still can get your desired error message description.
In that case you have to use the function SQLERRM.
The error number passed to SQLERRM should be negative. Passing a zero to SQLERRM always returns the ORA-0000: normal, successful completion message. Passing a positive number to SQLERRM always returns the User-Defined Exception message unless you pass +100, in which case SQLERRM returns the ORA-01403: no data found message.

An Example:
------------------

SET SERVEROUT ON
prompt Please enter error numbers as negatives. E.g. -1
prompt
exec dbms_output.put_line('==> '||sqlerrm( &errno ) );
/

SQL> Enter value for errno: -7445
==> ORA-07445: exception encountered: core dump [] [] [] [] [] []

Related Documents

Types of Oracle Error Message

Thursday, April 10, 2008

Troubleshooting DbConsole Error - OC4J Configuration issue

Error Description:
emctl start dbconsole
fails with the exception:
EM Configuration issue. /u01/app/oracle/product/10.2.0_64/db_1/_

Solution of The Problem:
First we need to determine whether the server use dynamic IP or static IP. There are two different solutions for these two.

1)If Server is configured with dynamic IP Address:

a)In the Loopback adapter configure and assign a dummy static address.
b)Then in the "hosts" file, add an entry associated with this dummy static IP address and map that to the machine name associated with the system through the system properties.
c)Configure the loopback adapter to be the primary network adapter on the system.
d)Now, any call to get the IP address of the system will return the dummy static IP associated with the loopback adapter. In call to get the hostname associated with this dummy IP address will return the real machine name, since this was associated with the IP address in the hosts file.
e)Also, any call to get the hostname will also return the machine name since the loopback adapter is the primary network adapter.

Suppose in Windows,

a). In the SYSTEM DRIVE:\WINDOWS\system32\drivers\etc\hosts file the following entry should be present for the node :

127.0.0.1 localhost hostname.domainname hostname

b). Set this environment variable to the hostname of the machine, from a command prompt:

For 10.1,
cmd> set EMHOSTNAME=

For 10.2,
cmd> set ORACLE_HOSTNAME=

c). Start the dbconsole now from the same window
cmd> set ORACLE_HOME=ORACLE_HOME of the 10G database
cmd> set ORACLE_SID=SID of the 10G database
cmd> cd %ORACLE_HOME%\bin
cmd> emctl start dbconsole


d).If the existing files/directories in the %ORACLE_HOME%\oc4j\j2ee\OC4J_DBConsole_hostname_SID and %ORACLE_HOME%\hostname_SID have the IP address instead of the hostname then recreate DBControl.

2)If Server uses static IP address

a)Check the hosts file entry:
On Windows, the HOSTS file is under $WINDOWS\system32\drivers\etc
On Unix systems hosts file is under /etc

The file should have the IP address followed by the fully qualified hostname.domain name, and then a short hostname or alias.
For Example,

192.168.1.2 hostname.domainname hostname

b)Check hostname and IP Address:

On unix, $ hostname $ifconfig -a
On Windows >ipconfig /all

>ping 192.168.1.2
>ping hostname.domainname
>ping hostname
>nslookup 192.168.1.2
>nslookup hostname.domainname
>nslookup hostname


c). Check if directories

/_
/oc4j/j2ee/OC4J_DBConsole_


exist and have correct permissions for the same user who has installed the software.

If they does not exist then recreate dbcontrol.
You can do it by,
$emca -deconfig dbcontrol db -repos drop
$emca -config dbcontrol db -repos create

I have shown how to drop , create and recreate dbcontrol in topic,

How To Drop, Create And Recreate DB Control In 10g Database


d)Ensure ORACLE_HOME and ORACLE_SID is set properly.

Related Documentation:
How to create and recreate DBcontrol