Thursday, December 18, 2008

Rebuild MSSQL 2005 Server's master database

With the installation CD in the CD drive (D:), execute the following command:

start /wait d:\setup.exe /qn INSTANCENAME=MSSQLSERVER REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=passwd

passwd should be the passwd for the sa user.

Thursday, September 18, 2008

PCP - Show open ports and PIDs on Solaris

Ayer me encontré este script que me pareció muy bueno para Solaris.

El sitio del autor es: http://www.unix.ms/pcp/

#!/usr/bin/ksh
#
# PCP (PID con Port)
# v1.07 20/05/2008 sam@unix.ms
#
# If you have a Solaris 8, 9 or 10 box and you can't
# install lsof, try this. It maps PIDS to ports and vice versa.
# It also shows you which peers are connected on which port.
# Wildcards are accepted for -p and -P options.
#
# The script borrows Eric Steed's excellent "getport.sh" script.
#
if [ $# -lt 1 ]
then
echo >&2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK)"
exit 1
fi
while getopts :p:P:a opt
do
case "${opt}" in
p ) port=${OPTARG};;
P ) pid=${OPTARG};;
a ) all=all;;
[?]) # unknown flag
echo >&2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK) "
exit 1;;
esac
done
shift `expr $OPTIND - 1`
if [ $port ]
then
# Enter the port number, get the PID
#
port=${OPTARG}
echo "PID\tProcess Name and Port"
echo "_________________________________________________________"
for proc in `ptree -a grep -v ptree awk '{print $1};'`
do
result=`pfiles $proc 2> /dev/null grep "port: $port"`
if [ ! -z "$result" ]
then
program=`ps -fo comm -p $proc tail -1`
echo "$proc\t$program\t$port\n$result"
echo "_________________________________________________________"
fi
done
elif [ $pid ]
then
# Enter the PID, get the port
#
pid=$OPTARG
# Print out the information
echo "PID\tProcess Name and Port"
echo "_________________________________________________________"
for proc in `ptree -a grep -v ptree grep $pid awk '{print $1};'`
do
result=`pfiles $proc 2> /dev/null grep port:`
if [ ! -z "$result" ]
then
program=`ps -fo comm -p $pid tail -1`
echo "$proc\t$program\n$result"
echo "_________________________________________________________"
fi
done
elif [ $all ]
then
# Show all PIDs, Ports and Peers
#
echo "PID\tProcess Name and Port"
echo "_________________________________________________________"
for pid in `ptree -a grep -v ptree sort -n awk '{print $1};'`
do
out=`pfiles $pid 2>/dev/null grep "port:"`
if [ ! -z "$out" ]
then
name=`ps -fo comm -p $pid tail -1`
echo "$pid\t$name\n$out"
echo "_________________________________________________________"
fi
done
fi
exit 0

Tuesday, September 16, 2008

Apache in Solaris 10

Does not configure Apache 1

/etc/apache
/etc/init.d/apache


The web server is Apache2

/var/apache2
/etc/apache2


Copy /etc/httpd-std.conf to /etc/httpd.conf

If you want the server to listen in a port different than 80, you could use the following directive:

Listen 192.168.1.1:8181

Where 192.168.1.1 is the IP of the server and 8181 is the port.

Then enable the server with svcadm enable apache2

Check the logs at /var/apache2/logs/error_log and /var/apache2/logs/acess_log

To Kill a Mockingbird


Today I bought To Kill a Mockingbird.

Friday, September 5, 2008

Algunos comandos para lidiar con procesos en Solaris

ps - informa sobre el estado de los procesos

# ps -ef grep java

-e Devuelve información sobre cada proceso en ejecución.
-f Genera un listado con todas las columnas.

La tubería con grep filtra por los que contienen java.

svcs - informa sobre el estado de los servicios

# scvs -p less

-p Lista los procesos asociados con cada instancia de servicio.

La tubería con less para poder buscar y ver las líneas múltiples.

pargs - imprime los argumentos de un proceso, variables de entorno.

# pargs

fuser - muestra los PID de los procesos que están usando los archivos que se especifican como argumento.

# fuser ...

pfiles - muestra los archivos abiertos por un determinado proceso.

# pfiles ...

# prstat - equivalente a top (más o menos).

# prstat

Friday, July 18, 2008

Cambiar el hostname en Solaris 10

Cambiar el hostname en los siguientes archivos:

/etc/nodename
/etc/hostname.*interface
/etc/inet/hosts
/etc/inet/ipnodes

Renombrar el directorio debajo de /var/crash.

# cd /var/crash
# mv oldname newname

Ejecutar el comando dumpadm -s /var/crash/

Ejecutar el comando hostname

Reiniciar el servidor.

Configurar la red en Solaris 10

Configurar la red en Solaris 10:

1. Añadir el nombre del host a /etc/nodename.
2. Añadir el nombre y la IP a /etc/hosts.
3. Añadir el hostname que se añadió a /etc/hosts al archivo /etc/hostname.interface. Donde interface es el nombre de la interfaz de red.

Por ejemplo, el contenido de mi /etc/hostname.bge0 es solaris-devx.

4. Añadir la información correspondiente a /etc/resolv.conf.
5. Añadir la IP del gateway (default router) a /etc/defaultrouter.
6. Reiniciar el servicio mediante svcadm restart svc:/network/physical:default.