how to save website sessions to ms sql database for asp.net websites

If you are planing to use a load balancer, websites sessions may create some problems if load balancer does not support session management. In this case you can save the sessions to a ms sql database and fix the issue.  It’s simple to save session to database. You will need to create a database using …

Read more

change all stored procedure ownership in ms sql database

When you migrated MS SQL database to new server there is change that you may see error like “Stored Procedure not found”. Mainly this comes due to a change in dbo. Please make sure that the stored procedure is owned by the correct database user. If the user is different  you can correct it by …

Read more

How to install SSL certificate on Centos Web Panel

When we install SSL certificate on Centos Web Panel (CWP) the SSL certificate may not work using default installations. You may need to do some edits in Centos Web Panel (CWP)  apache configuration files. To install Certificate go to the SSL manager Security–> SSL Manager Use the SSL Generator to generate Key, CSR  and Selfsigned …

Read more

innodb-error-log-file-ib-logfile0-is-of-different-size

This error comes and mysql server is rebooted dues to a power failure of any unplanned shutdown. If you try to start mysql service you will get the same error in mysql error log. The solution is to go to the mysql data directory and move the logs ( ib_logfile0, ib_logfile1 etc) file to a temporary location. …

Read more

Convert MyISAM Tables to InnoDB

If you want to convert all MyISAM tables to InnoDB, following Script will do the smae. #!/bin/bash DBNAME=””; DBUSER=””; DBPASS=””; for t in $(mysql -u$DBUSER -p$DBPASS –batch –column-names=false -e “show tables” $DBNAME); do echo “Converting table $t”; mysql -u$DBUSER -p$DBPASS -e “alter table ${t} type=InnoDB” $DBNAME; echo “Repair table $t”; mysql -u$DBUSER -p$DBPASS -e “repair …

Read more

Kill process on MS SQL

#FIND ALL PROCESSES SELECT getdate() as “RunTime”, st.text, qp.query_plan, a.* FROM sys.dm_exec_requests a CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) as st CROSS APPLY sys.dm_exec_query_plan(a.plan_handle) as qp order by CPU_time desc #ABOVE QUERY WILL LIST ALL ITEMS WITH DATABASE ID AND TO FIND THE DATABSE NAME USE BELOW ONE SELECT name as Database_Name, database_id as Database_ID FROM sys.databases; #KILL …

Read more

Create Swap Memory on Centos

Check for Swap Space swapon -s Create and Enable the Swap File sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k ( create 512 K Swap ) sudo mkswap /swapfile The results display: Setting up swapspace version 1, size = 536866 kB Finish up by activating the swap file: sudo swapon /swapfile sudo nano /etc/fstab Paste in the …

Read more

Few Commands to Monitor Apache Connections

#Print connections to Apache and number of connections per IP # #Quick Count# netstat -anpt|grep httpd | wc -l ( All connections  count ) netstat -anpt|grep httpd|grep ESTABLISHED | wc -l ( Established count only ) #Detailed report# #List all connectiosn owned by Apache ( Dead connections as well )\ netstat -anpt|grep httpd  #Now we …

Read more

Alert when file is modified in Linux

This is one of the script I used many years ago. There are many other methods now, but just thought of adding it. I had a server where few files were modified by malware. I applied all security measures and in order to alert me in case file is modified again, I created below shell …

Read more

Add Secondary IP in Linux and Permanently Save

I am going to add the ip 1 192.168.8.1 on to to eth0 as eth0:1 cp /etc/sysconfig/network-scripts/ifcfg-eth0  /etc/sysconfig/network-scripts/ifcfg-eth0:1 Edit the file with new IP, device name and subnet.