Friday, December 21, 2007
How does one truncate a transaction log file in MS SQL
USE <DB NAME>
DBCC SHRINKFILE (<Log Logical Name>, 20) -- where 20 = 20 MB
How Drop Tablespace and Recover Oracle Database When Accidentally Delete Datafile
- Run SQL*Plus.
- Connect to database as SYSDBA with this query:
CONNECT / AS SYSDBA Mount the database instead of starting it up:
STARTUP MOUNT;- Issue the following command to bring the missing datafile offline so that Oracle won’t trying to connect and access the datafile anymore:
ALTER DATABASE DATAFILE '<datafile name with complete path>' OFFLINE DROP;
Repeat the command for every datafiles that unaccounted for. - Now start the database proper:
ALTER DATABASE OPEN; - As the tablespace has damaged, drop it to recreate from fresh backup.
DROP TABLESPACE <tablespace name> INCLUDING CONTENTS; - Ensure the other datafiles for the tablespace has been deleted, if not, remove them manually from the operating system.
- Continue with the recovery process.
More Info
Tuesday, December 18, 2007
Deleting files in tar file
tar --delete --file=<tarfile> <file name>
To Delete file using wildcards from tar file
tar --wildcards --delete --file=<tarfile> <file name>
To Delete specific file from tar file
tar --delete --file=<tarfile> <path/to/that/file/in/tarfile/filename>
Friday, November 23, 2007
Making Micrphone work in Ubuntu 7.04
Please look at these links for that
Debugging Sound Problems
In case all look ok do this.
a) Open terminal
b) type 'alsamixer'
c) Use left right arrow keys to select and up and down to adjust.
d) Adjust, Front Mic, Mic Boost and Input Source.
e) Select tab and adjust Front Mic, Mic Boost and Capture.
f) Press esc to quit.
Try skype or other recording tools to test.
Gud Luck.
More Info here
How TO: Getting Microphone to work
Monday, September 10, 2007
HPUX Mem Info C Code
/*
* @(#)$Header: memdetail.c,v 1.1 2001/05/03 15:35:00 nsr1521 Exp $
*
* determine detailed current memory utilized and print.
*
* No warranty is expressed or implied.
* Your mileage may vary.
*
* Contact: srobertson@bcbs-ga.com
*
*/
static char ident[] = "@(#)$Revision: 1.1 $";
#define KB 1024
#include <unistd.h>
#include <sys/param.h>
#include <sys/pstat.h>
main() {
struct pst_static sbuf;
struct pst_dynamic dbuf;
struct pst_vminfo vbuf;
double page_size, sys_mem;
double phys_mem, used_phys_mem, avail_mem;
double total_virtual_mem, active_virtual_mem, avail_virtual_mem;
double total_real_mem, active_real_mem, avail_real_mem;
double total_swap_dev, used_swap_dev, avail_swap_dev;
double total_swap_mem, used_swap_mem, avail_swap_mem;
/* get static information about the system */
if (pstat_getstatic(&sbuf, sizeof(sbuf), (size_t)1, 0) != -1)
{
phys_mem = sbuf.physical_memory;
page_size = sbuf.page_size;
}
else
perror("pstat_getstatic()");
/* get dynamic information about the system */
if (pstat_getdynamic(&dbuf, sizeof(dbuf), (size_t)1, 0) != -1)
{
avail_mem = dbuf.psd_free;
total_virtual_mem = dbuf.psd_vm;
active_virtual_mem = dbuf.psd_avm;
total_real_mem = dbuf.psd_rm;
active_real_mem = dbuf.psd_arm;
}
else
perror("pstat_getdynamic()");
/* get VM information about the system */
if (pstat_getvminfo(&vbuf, sizeof(vbuf), (size_t)1, 0) != -1)
{
sys_mem = vbuf.psv_sysmem;
total_swap_dev = vbuf.psv_swapspc_max;
avail_swap_dev = vbuf.psv_swapspc_cnt;
total_swap_mem = vbuf.psv_swapmem_max;
avail_swap_mem = vbuf.psv_swapmem_cnt;
}
else
perror("pstat_getvminfo()");
/* calculate used physical memory */
used_phys_mem = phys_mem - avail_mem;
/* calculate avail virtual memory */
avail_virtual_mem = total_virtual_mem - active_virtual_mem;
/* calculate avail real memory */
avail_real_mem = total_real_mem - active_real_mem;
/* calculate used swap on device */
used_swap_dev = total_swap_dev - avail_swap_dev;
/* calculate used swap on memory */
used_swap_mem = total_swap_mem - avail_swap_mem;
(void)printf("%-15s\t%6s\t%6s\t%6s\t%6s\n",
"Memory Stat","total","used","avail","%used");
(void)printf("%-15s\t%6.1f\t%6.1f\t%6.1f\t%5.0f%%\n",
"physical",
(phys_mem * page_size) / (KB * KB),
(used_phys_mem * page_size) / (KB * KB),
(avail_mem * page_size) / (KB * KB),
used_phys_mem * 100 / phys_mem);
(void)printf("%-15s\t%6.1f\t%6.1f\t%6.1f\t%5.0f%%\n",
"active virtual",
(total_virtual_mem * page_size) / (KB * KB),
(active_virtual_mem * page_size) / (KB * KB),
(avail_virtual_mem * page_size) / (KB * KB),
active_virtual_mem * 100 / total_virtual_mem);
(void)printf("%-15s\t%6.1f\t%6.1f\t%6.1f\t%5.0f%%\n",
"active real",
(total_real_mem * page_size) / (KB * KB),
(active_real_mem * page_size) / (KB * KB),
(avail_real_mem * page_size) / (KB * KB),
active_real_mem * 100 / total_real_mem);
(void)printf("%-15s\t%6.1f\t%6.1f\t%6.1f\t%5.0f%%\n",
"memory swap",
(total_swap_mem * page_size) / (KB * KB),
(used_swap_mem * page_size) / (KB * KB),
(avail_swap_mem * page_size) / (KB * KB),
used_swap_mem * 100 / total_swap_mem);
(void)printf("%-15s\t%6.1f\t%6.1f\t%6.1f\t%5.0f%%\n",
"device swap",
(total_swap_dev * page_size) / (KB * KB),
(used_swap_dev * page_size) / (KB * KB),
(avail_swap_dev * page_size) / (KB * KB),
used_swap_dev * 100 / total_swap_dev);
return;
}
Wednesday, September 05, 2007
Linux Process and System Memory Info
PIDINDEX="4"
APAL3BIN="apal3_test3"
EXECUTION_DATE=`date +%Y%m%d%H%M%S`
echo $EXECUTION_DATE >> $FILENAME
echo "==============" >> $FILENAME
echo "System Mem Info : " >> $FILENAME
echo "==================" >> $FILENAME
cat /proc/meminfo >> $FILENAME
echo >> $FILENAME
echo "System Memory Info : " >> $FILENAME
echo "=====================" >> $FILENAME
free -mto >> $FILENAME
echo >> $FILENAME
echo "System Swap Info : " >> $FILENAME
echo "===================" >> $FILENAME
cat /proc/swaps >> $FILENAME
echo >> $FILENAME
echo "APAL5 Process Info : " >> $FILENAME
echo "====================" >> $FILENAME
APAL3_PID=`ps -ale | grep [" "]$APAL3BIN$ | tr -s " " | cut -f $PIDINDEX -d " "`
echo "APAL3_PID : "$APAL3_PID >> $FILENAME
cat /proc/$APAL3_PID/status >> $FILENAME
echo >> $FILENAME
echo "APAL5 Thread Info : " >> $FILENAME
echo "====================" >> $FILENAME
ps -eLf | grep $APAL3_PID >> $FILENAME
echo >> $FILENAME
echo "Kernel Message : " >> $FILENAME
echo "=================" >> $FILENAME
dmesg | grep -n kernel >> $FILENAME
echo "************************************************************" >> $FILENAME
echo >> $FILENAME
Tuesday, September 04, 2007
Max threads per process
To view
To Edit
echo
Tuesday, July 24, 2007
GCC 4.1.2 GCC 4.1.2 Install Intructions
http://hpux.cs.utah.edu/hppd/cgi-bin/wwwtar?
/hpux/Gnu/gcc-4.1.2/gcc-4.1.2-src-11.11.tar.gz+gcc-4.1.2/
HPUX.Install+text
ANSI C patches details
http://hpux.connect.org.uk/hppd/answers/4-4.html
Tuesday, June 26, 2007
Adding .flv MIME type in IIS
2) Under HTTP Headers Tab, select "File Types" under the MIME Map section and select "New Type"
3) Type ".flv" as the associated extension and "video/x-flv" as the content type.
4) Select "OK" and you're ready to fly!
Tuesday, June 19, 2007
Oracle 9i Install Guide for Linux (Ubuntu 7.04) - 32bit
Oracle 9i Install Guide for Linux (Ubuntu 7.04) - 32bit
Pre Install Steps
1) Get JRE 1.3.1 (jre1.3.1_20)
1.a) Install this at /opt/jre1.3.1_20
1.b) cd /opt/jre1.3.1_20/bin
1.c) ln -s java jre
1.d) cd /opt/jre1.3.1_20/bin/i386/native_threads
1.e) ln -s java jre
2) Apply patch for Oracle 9i
2.a) unzip p3006854_ 9204_LINUX.zip
2.b) cd 3006854
2.c) sudo sh rhel3_pre_install.sh
3) Set Kernel Parameters
3.a) sudo vim /etc/sysctl.conf
3.b) Add -
kernel.sem = 250 32000 100 128
kernel.shmmax = 2147483648
kernel.shmmni = 128
kernel.shmall = 2097152
kernel.msgmnb = 65536
kernel.msgmni = 2878
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 6500
3.c) execute "sysctl -p" or reboot system to apply above settings
4) Create Oracle account
4.a) groupadd dba
4.b) usradd -g dba oracle
5) Setting Oracle Enviroment *
5.a) sudo mkdir /u01
5.b) sudo mkdir /u01/app
5.c) sudo mkdir /u01/app/oracle
5.d) sudo chown oracle:dba /u01/app/oracle
5.e) sudo vim /etc/profile
5.f) ORACLE_BASE=/u01/app/oracle
ORACLE_SID=WOORAU
export ORACLE_BASE ORACLE_SID
ORACLE_HOME=/home/oracle/OraHome1
export ORACLE_HOME
export PATH:$PATH:$ORACLE_HOME/bin
6) Get Oracle 9i from www.oracle.com
6.a) Login as user oracle
6.b) mkdir Oracle9i
6.c) cd Oracle9i
6.d) Copy all the 3 files here as downloaded
6.e) gunzip ship_9204_linux_disk1.cpio.gz
6.f) gunzip ship_9204_linux_disk2.cpio.gz
6.g) gunzip ship_9204_linux_disk3.cpio.gz
6.h) cpio -idmv <>7) Fix JRE PATH
7.a) sudo vim Disk1/install/linux/oraparam.ini
7.b) JRE_LOCATION=/opt/jre1.3.1_20
8) Run Installer
8.a) ./runInstaller
8.b) edit the JRE_LOCATION setting in the $ORACLE_BASE/oui/oraparam.ini
sudo vim $ORACLE_BASE/oui/oraparam.ini
8.c) JRE_LOCATION=/opt/jre1.3.1_20
Post Install
9) Creating Listner and Database
Installer will create Listener, Database and set Apache server. In case this is not done at that tim we can use these tools to achieve the same.
9.a) For Database use dbca tool in $ORACLE_HOME/bin.
9.b) For creating Listner and Local Service use netca in $ORACLE_HOME/bin.
10) Start and stop script.
10.a) Oracle start script
sqlplus /nolog <<>
* - Additional Settings Fedora Core 2,3,4 only
LD_ASSUME_KERNEL=2.4.1
THREADS_FLAG=native
Note -
In case of error while running runInstaller edit it and change
if [[ ($RHVER = $Check1) || ($RHVER = $Check2) ]];
then
export LD_ASSUME_KERNEL=2.4.19
fi
to
#if [[ ($RHVER = $Check1) || ($RHVER = $Check2) ]];
#then
# export LD_ASSUME_KERNEL=2.4.19
#fi
VCEESetup
Note: If you are using Microsoft Visual Studio Professional, there is no need to apply any of the steps listed below.
The following install packages are required:
ISO | IMG | |
Microsoft Visual C++ 2005 Express Edition | download | download |
Microsoft ® Windows Server® 2003 R2 Platform SDK | download | download |
Steps:
1. Microsoft VCEE
1.1. Install Microsoft Visual C++ 2005 Express Edition
1.2. Start the IDE and follow the instructions from the start page.
2. Platform SDK
2.1. Install Microsoft Windows Server 2003 R2 Platform SDK
2.2. Follow the instructions to add your source, include and library paths (Tools->Options->Projects and Solutions->VC++ Directories) and modify corewin_express.vsprops file.
2.3. Add the additional include directory : $(platformsdkdir)\\Include\\atl, where $(platformsdkdir) is where your SDK is installed. You can set an environment variable in vsvars32.bat to reflect that.
2.4. Modify the following in the atlbase.h (the file should reside in $(platformsdkdir)\\Include\\)
Starting at line 287 in the original file:
/*
PVOID __stdcall __AllocStdCallThunk(VOID);
VOID __stdcall __FreeStdCallThunk(PVOID);
#define AllocStdCallThunk() __AllocStdCallThunk()
#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
#pragma comment(lib, "atlthunk.lib")
*/
#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(), 0, sizeof(_stdcallthunk))
#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
2.5. It is a very good idea to try to create and build a simple Win32 project in order to verify that all the modifications undertaken are in place.
3. Service Packs
Tuesday, June 12, 2007
JRE for HPUX 11.11
http://www.hp.com/cgi-bin/products1/unix/java/mailform_hm.pl/download_jre_5.0.08_pa-risc.html
OR
wget http://ftp.hp.com/pub/gsy/jre15_15008_pa.tar.Z
OR
wget ftp://ftp.hp.com/pub/gsy/jre15_15008_pa.tar.Z
Friday, June 08, 2007
Using port forwarding with PuTTY
Using port forwarding with PuTTY
This page briefly describes how to use port forwarding using the PuTTY SSH client. Port forwarding is useful when you need to use certain services which are normally only available within the institute.
Suppose you want to setup your PC at home to use our internal proxy server.
First, start PuTTY, specify the host you want to connect to, e.g. shell.cs.uu.nl and the SSH protocol:
Then, click the "Tunnels" tab and specify local port, remote host and port and click the [Add] button:
Finally, press the [Open] button to start the session:
You can, of course, save your settings in the first tab (Session) before you press the [Open] button.
The above example is the equivalent to the UNIX 'ssh' command:
It will forward the local port 3128 to host 'proxy', port 3128, via the SSH connection. PuTTY is an SSH client, so it will still spawn a terminal window. When you're finished using your forwarded connection(s) you can close this window.ssh -L 3128:proxy:3128 your_username_here@shell.cs.uu.nl
Setting up a PDF printer in CUPS (in my case in Slackware)
mkdir /usr/lib/cups/pdf
vim /usr/lib/cups/pdf/ps2pdf.cups
i
Then highlight the following script with the mouse, and middle-click into the terminal session with vim open.
#!/bin/sh
# Convert PostScript to PDF.
umask 002
OPTIONS=""
while true
do
case "$1" in
-*) OPTIONS="$OPTIONS $1" ;;
*) break ;;
esac
shift
done
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: `basename $0` [options...] input.ps [output.pdf]" 1>&2
exit 1
fi
infile=$1;
if [ $# -eq 1 ]
then
outfile=$1
else
outfile=$2
fi
# Doing an initial 'save' helps keep fonts from being flushed between pages.
exec gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
-sOutputFile=$outfile $OPTIONS -c save pop -f $infile
exec chmod a+r $outfile
chmod 755 /usr/lib/cups/pdf/ps2pdf.cups
2. Create the backend
The next bit of our PDF printer driver goes into /usr/lib/cups/backend
The back-end directory holds several binary executables that take care of varied printing methods, e.g. parallel, usb, ...
We're now going to add a shell-script that handles pdf-files!
vim /usr/lib/cups/backend/pdf
i
#!/bin/sh
#
umask 002
PDFBIN=/usr/lib/cups/pdf/ps2pdf.cups
FILENAME=
# filename of the PDF File
PRINTTIME=`date +%Y-%m-%d_%H.%M.%S`
# no argument, prints available URIs
if [ $# -eq 0 ]; then
if [ ! -x "$PDFBIN" ]; then
exit 0
fi
echo "direct pdf \"Unknown\" \"PDF Creator\""
exit 0
fi
# case of wrong number of arguments
if [ $# -ne 5 -a $# -ne 6 ]; then
echo "Usage: pdf job-id user title copies options [file]"
exit 1
fi
# get PDF directory from device URI, and check write status
PDFDIR=${DEVICE_URI#pdf:}
if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; then
echo "ERROR: directory $PDFDIR not writable"
exit 1
fi
# generate output filename
OUTPUTFILENAME=
if [ "$3" = "" ]; then
OUTPUTFILENAME="$PDFDIR/unknown.pdf"
else
if [ "$2" != "" ]; then
OUTPUTFILENAME="$PDFDIR/$2-$PRINTTIME.pdf"
else
OUTPUTFILENAME="$PDFDIR/$PRINTTIME.pdf"
fi
echo "PDF file: $OUTPUTFILENAME placed in: $PDFDIR" >> $LOGFILE
fi
# run ghostscript
if [ $# -eq 6 ]; then
$PDFBIN $6 $OUTPUTFILENAME >& /dev/null
else
$PDFBIN - $OUTPUTFILENAME >& /dev/null
fi
exit 0
And as before, this script needs to be made executable, too.
chmod 755 /usr/lib/cups/backend/pdf
3. Download and install distiller.ppd
The printer definition file for distiller is freely available from the adobe-website, if you have a windows-installation handy follow steps 1 to 5 of the instructions...
If you don't: there's some other sites on the web that hold just the ppd rather than an installer. Google is your friend.
Once you have downloaded it add it to your CUPS' printer-model
directory:
cp distiller.ppd /usr/share/cups/model/distiller.ppd
and then, the second to last step:
4. Create the printer object
To be able to use all the pre-requisits that held us up ....
lpadmin -p PDF -v pdf:/directory/of/your/choice/ -E -P /usr/share/cups/model/distiller.ppd
5. Re-start CUPS
Now that all the set-up and installation is done, we need to let the CUPS daemon know about the new printer, too.
To achieve that we restart the daemon.
/etc/rc.d/rc.cups restart
And if all went well we should now have a printer-object that will create PDFs for us.
Tuesday, June 05, 2007
Increading ASP Buffer Limit in IIS 5.0
cd C:\Inetpub\AdminScripts
adsutil set w3svc/aspbufferinglimit 500000000
iisreset
Monday, April 30, 2007
Using cygwin to view a remote xwindow
1) start cygwin vask shell
2) type startx
3) in the x~ window that appears, type:
xhost
where
4) connect to machine using nortel
5) check the IP address of this machine in the nortel connection (e.g. 143.5.x.x)
6) launch a terminal window and connect a terminal window to Host machine ie JOE, REPETE
7) type export DISPLAY=
8) you can now run the x application on the remote machine and all going well, it should appear on the local box (try xclock)
Saturday, April 14, 2007
PHP Compile process in HPUX and Linux
b) run
./configure --enable-libgcc --with-apxs2=/opt/hpws/apache/bin/apxs --with-oracle=/opt/oracle/rtcis/product/9.2.0 --with-oci8=/opt/oracle/rtcis/product/9.2.0 --with-dom -with-zlib
This builds the PHP with support of Oracle (tested with 8i and 9i), XML and Zlib.
c) vi ./libtool
search for deplibs_check_method and replace that with deplibs_check_method="pass_all"
d) make
e) Module build. :)