Wednesday, August 29, 2012

"tail -f" with highlight


tail maillog -f | grep -E ": 550|: 554" | perl -p -e "s/(550|554)/\e[1;46;1m$&\e[0m/g;"


0all attributes off
1bold
32foreground green
40background black
Colors
This vector holds the colors used for SGR control sequences parameters 30 to 37 \(foreground colors) and 40 to 47 (background colors).
ParameterColor
3040black
3141red
3242green
3343yellow
3444blue
3545magenta
3646cyan
3747white

Thursday, August 16, 2012

Fix WSUS Internal DB if corrupted


sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query

ALTER DATABASE SUSDB SET SINGLE_USER WITH NO_WAIT

DBCC CHECKDB

go

If the about command cannot fix, try this one but will have data loss
DBCC checkdb ('SUSDB', repair_allow_data_loss)


Finally,
ALTER DATABASE SUSDB SET MULTI_USER WITH NO_WAIT
go

Friday, July 27, 2012

Backup Oracle on SLES using VMware Snapshot

/usr/sbin/pre-freeze-script
#!/bin/bash
/bin/su - oracle -c "echo $(date) >> /u01/app/oracle/snapshot.log"
/bin/su - oracle -c "/u01/app/oracle/product/11.2.0/xe/bin/sqlplus /nolog @/u01/app/oracle/suspend.sql >> /u01/app/oracle/snapshot.log"

/usr/sbin/post-thaw-script

#!/bin/bash
/bin/su - oracle -c "echo $(date) >> /u01/app/oracle/snapshot.log"/bin/su - oracle -c "/u01/app/oracle/product/11.2.0/xe/bin/sqlplus /nolog @/u01/app/oracle/resume.sql >> /u01/app/oracle/snapshot.log"

/u01/app/oracle/suspend.sql
connect / as sysdba;
ALTER SYSTEM SUSPEND;
exit;

/u01/app/oracle/resume.sql
connect / as sysdba;
ALTER SYSTEM RESUME;
exit;
/u01/app/oracle/.bash_profile
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export PATH=$ORACLE_HOME/bin:$PATH



Thursday, July 26, 2012

Oracle Enable ArchiveLog and change processes

connect / as sysdba;

shutdown;
startup mount

alter system set processes=150 scope=spfile;
alter database archivelog;

alter database open;

Backup Domino on Linux using VDR or Veeam

1. Install VMware-Tools (I think it should be installed but unlucky still a lots out there do not know how to install on Linux)
2. Create a script /usr/sbin/pre-freeze-script

#!/bin/bash

# Just a log with date, you can remove it
echo $(date) >> /var/log/snapshot.log

# Assume Domino Service is installded and started by user "domino", we drop all connection and flush all database cache
/bin/su - domino -c "cd /local/notesdata/;/opt/ibm/lotus/bin/server -c \"drop all\";/opt/ibm/lotus/bin/server -c \"dbcache flush\""


# Some forks saying we should do a sync before backup, run it with no harm...

/bin/sync

3. chmod 755 /usr/sbin/pre-freeze-script


4. In VMware vSphere, take a snapshot of your Domino Server, uncheck "Snapshot the virtual machine's memory" as it will not run the script is memory is taken and check "Quiesce guest file system".


Check if /var/log/snapshot.log has date recorded and better connect your Domino Console and see if the connection has been dropped when taking snapshot (to prove the script has been run correctly).

Wednesday, July 25, 2012

Remove logwatch mail on RHEL with Domino

If you don't really care and want to use logwatch, easiest way, remove /etc/cron.daily/0logwatch
OR
If you care about logwatch, go  /usr/share/logwatch/default.conf/logwatch.conf and config those mail settings