Skip to main content

Posts

Using ssh as proxy to bypass firewall, or use existing server to connect to internet

Prerequisite 1.        You have ssh access to a server, the server has public internet access 2.        On Windows, You can change proxy settings on your web browser or any program you want to access to internet, Or 3.        On Linux, You can compile c program Tech explains: ssh has a feature to enable socks 5 proxy server   on your own local machine when you connect to the server. Then on the local machine, configure proxy settings will let you use the internet access (or intranet access) on that server. There’s also a program on Linux which can use http, socks4 or/and socks5 proxy to proxy any program. For example, you want to FTP to internet but the FTP program didn’t provide proxy settings, then you can use this program to do the proxy in the background for you. Steps (for Windows): 1.        Connect to you server using ssh with below syntax:  ...

Linux/Unix which command equivalent on Windows

"which" command on Linux can help locate executable files, somethings we need same function on windows. Here's how: if you're using Windows 7, there's a building command "where", so if you want to find where is "notepad.exe" for Microsoft Word, just fire up and command window and type: where notepad.exe you'll get something like: C:\>where.bat notepad.exe C:\WINDOWS\system32\notepad.exe C:\WINDOWS\notepad.exe on Windows XP, there's no build-in command, so create a batch file called where.bat with below content: @echo off for %%i in (%1) do if not ""=="%%~$PATH:i" echo %%~$PATH:i now, run where notepad.exe you'll get something like: C:\>where.bat notepad.exe C:\WINDOWS\system32\notepad.exe you can save the file in windows directory, so you can use it anywhere Attention: only executable list in environment variable PATH can be found just like the way Linux/Unix works.

Write a Message to the Oracle Alert Log

This tip comes from Marco Gilbert, DBA at MRQ, in Ste-Foy, Quebec, Canada. If you want to write a message to the alert log, you can use the undocumented KSDWRT procedure of the DBMS_SYSTEM package. This procedure has two parameters, the first one must be "2" to write to the alert file, the second one is the message you want to write. Here is an example: execute sys.dbms_system.ksdwrt(2,to_char(sysdate)|| ' -- '); (1=Trace, 2=alert, 3=both).

Oracle listener startup failure

Problem: when trying to restart Oracle 11g listener, got below error: TNS-12560: TNS:protocol adapter error TNS-00507: Connection closed Linux Error: 29: Illegal seek checked sqlnet.ora, listener.ora and ORACLE_HOME etc. environment variables, no incorrect/abnormal settings found checked TCP/IP port usage by "lsof -i:1521" and "netstat -anp |grep 1521|grep LISTEN", didn't find any application listen on it. checked /etc/hosts, seems normal #more /etc/hosts 10.11.5.32 host.some.domain host ::1 localhost6.localdomain6 localhost6 #127.0.0.1 localhost.localdomain localhost <===== this is the root cause, but didn't think about it at first checked /etc/nsswitch.conf and /etc/resolv.conf, normal tried to start Oracle 10g listener on same machine, "lsnrctl start" finished without error, but listener was not running: TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: ...