My Google Plus Page

Electricity Bill Calculator

Electricity Bill Calculator

Electricity Bill Cost Calculator. Electricity Usage Consumption Calculator.

Select Country:  
Typical Appliance:
Power Consumption:
Hours Of Use Per Day: Hrs/Day
One Unit Cost (1 kWh ):
 
Electricity Cost Per Day:  
Electricity Cost Per Month:  
Electricity Cost Per Year:  

Note:- 1 Unit = 1 kwh (Kilo Watt Hour)

HTML tutorial

EBC-Ads

Social Message

Social Message
Social Message Useful Health Tips

Wednesday, July 20, 2016

Microsoft SQL Server Databases Stuck in Restoring State

Microsoft SQL Server Databases Stuck in Restoring State


Overview

The RESTORE ... WITH RECOVERY option puts the database into a usable state, so users can access a restored database. 


This is likely caused by the restore script adding the WITH NO RECOVERY parameter to make the database ready for a transaction log apply after the restore. The database is now waiting for the latest transaction log file.
You can either:
  1. Apply the latest transaction log (Using RESTORE LOG... WITH RECOVERY)... or
  2. Restore the database again, but this time using WITH RECOVERY ... or
  3. Force the database out of restoring mode by executing: RESTORE DATABASE YourDb WITH RECOVERY
Before you do this, please make sure you understand the implications of these options. You may cause data loss if you are not careful.

Run below commands in SQL Query windows

RESTORE DATABASE AdventureWorks WITH RECOVERY

Optional more Recovery commands:-
Restore full backup WITH RECOVERY
RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK'
WITH RECOVERY
GO


Recover a database that is in the "restoring" state


RESTORE DATABASE AdventureWorks WITH RECOVERY
GO


Restore multiple backups using WITH RECOVERY for last backup


RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK'
WITH NORECOVERY
GO
RESTORE LOG AdventureWorks FROM DISK = 'C:\AdventureWorks.TRN'
WITH RECOVERY
GO


Thursday, March 24, 2016

How to Reduce File System Size on Linux

How to Reduce File System Size on Linux


Before starting, it is always good to backup the data, if something goes wrong. Easily restore from backup.

To Reduce a logical volume / file system there are 5 steps needed to be done very carefully.
While extending a volume we can extend it while the volume under mount status (online) but for reduce we must need to unmount the file system before reducing.

Fallow the below 5 steps


  • unmount the file system for reducing.
  • Check the file system after unmount.
  • Reduce the file system.
  • Reduce the Logical Volume size than Current size.
  • Recheck the file system for error.
  • Remount the file-system back to stage.


Step 1:

mohan@root# lvs

  LV      VG           Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home vg_test01 -wi-ao 431.79g
  lv_root vg_test01 -wi-ao  50.00g
  lv_swap vg_test01 -wi-ao  17.72g

mohan@root# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
                       50G  4.9G   42G  11% /
tmpfs                 7.8G   88K  7.8G   1% /dev/shm
/dev/sda1             485M   35M  425M   8% /boot
/dev/mapper/vg_test01-lv_home
                      426G  199M  404G   1% /home

mohan@root# umount -v /home
/dev/mapper/vg_test01-lv_home umounted

Step 2:

mohan@root# e2fsck -ff /dev/mapper/vg_test01-lv_home
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_test01-lv_home: 11/28303360 files (0.0% non-contiguous), 1827094/113190912 blocks

Step 3:

mohan@root# resize2fs /dev/mapper/vg_test01-lv_home 250G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_test01-lv_home to 65536000 (4k) blocks.
The filesystem on /dev/mapper/vg_test01-lv_home is now 65536000 blocks long.


Step 4:

mohan@root# lvreduce -L -250G /dev/mapper/vg_test01-lv_home
  WARNING: Reducing active logical volume to 181.79 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 181.79 GiB
  Logical volume lv_home successfully resized

Step 5


mohan@root# mount /home (or) mount -f /home
mohan@root# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
                       50G  4.9G   42G  11% /
tmpfs                 7.8G   88K  7.8G   1% /dev/shm
/dev/sda1             485M   35M  425M   8% /boot
/dev/mapper/vg_test01-lv_home
                       50G  4.9G   42G  11% /home


Successfully reduced /home file system size.



Sunday, March 20, 2016

Cisco Network Time Protocol (NTP) and Change Time format to Indian Standard (IST)


Cisco Network Time Protocol (NTP) and Change Time format to IST Indian Standard

NTP (Network Time Protocol) is used to allow network devices to synchronize their clocks with a central source clock. For network devices like routers, switches or firewalls this is very important because we want to make sure that logging information and time stamps have the accurate time and date.

MOHAN-SUNDARAM#show clock
*14:09:12.784 UTC Sun Mar 18 2016 --> Incorrect timezone.

How to Change Time / Date format to IST Indian Standard, Try below commands

MECT-D-Block-SW#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

MECT-D-Block-SW(config)#clock timezone UTC +5 30

MOHAN-SUNDARAM(config)#do show clock
*15:12:59.784 UTC Sun Mar 20 2016

How to Configure Cisco Switch / Firewall  NTP Server:-

MOHAN-SUNDARAM(config)#do show clock
*15:12:59.784 UTC Sun Mar 20 2016  -->  Still showing incorrect time and Clock unsynchronized.

MOHAN-SUNDARAM#show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
reference time is 00000000.00000000 (05:30:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 50.12 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000000000 s/s
system poll interval is 8, never updated.

Try below step by step commands.

Step 1:

Use Google DNS Server.

MOHAN-SUNDARAM(config)#ip name-server 8.8.8.8

Step 2:

Synchronize using clock with the public NTP server.

MOHAN-SUNDARAM(config)#ntp server pool.ntp.org
Translating "pool.ntp.org"...domain server (8.8.8.8) [OK]


Above we see the show ntp associations command that tells us if our clock is synchronized or not. The ~ in front of the IP address tells us that we configured this server but we are not synchronized yet. You can see this because there is no * in front of the IP address and the “st” field (stratum) is currently 3.


Step 3:

MOHAN-SUNDARAM(config)#do show ntp associations

  address         ref clock       st   when   poll reach  delay  offset   disp
*~123.108.200.124 125.62.193.121   3      4     64     1 46.982   1.985 188.53
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured


Step 4:

MOHAN-SUNDARAM(config)#do show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
reference time is 00000000.00000000 (05:30:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 50.12 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000000000 s/s
system poll interval is 8, never updated.


The router tells us that we are unsynchronized and that there is no reference clock.
we will just wait a couple of minutes and take a look at these commands again.


MOHAN-SUNDARAM(config)#do show ntp status

Clock is synchronized, stratum 4, reference is 123.108.200.124
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
reference time is DA994010.8C49BBE0 (20:58:16.548 UTC Sun Mar 20 2016)
clock offset is 1.9850 msec, root delay is 356.06 msec
root dispersion is 4047.21 msec, peer dispersion is 188.53 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000000 s/s
system poll interval is 64, last update was 28 sec ago.

Step 5:

NTP Server time updated successfully.

MOHAN-SUNDARAM#show clock detail
*14:39:41.930 UTC Sun Mar 20 2016
Time source is NTP



Saturday, February 20, 2016

Windows 10 Hangs when creating a new folder and hangs again when Renaming Folder

Windows 10 Hangs when creating a new folder and hangs again when Renaming Folder


Click Windows Start Click "File Explorer " option - Click "View" option – Click "Options" and then "Change folder and search options"


Under Privacy:


Deselect “Show frequently use folders in Quick access.”
Deselect “Show recently used folders in Quick access.”
Then click on “Clear” and OK to save your preferences.





Sunday, February 14, 2016

MySQL Database Installation Using RPM Package on Redhat & Other Linux

MySQL Database Installation Using RPM Package on 

Redhat & Other Linux 


Download below RPM Packages below MySQL Site.

http://dev.mysql.com/downloads/mysql/

[root@SERVER11 ~]# ls -ltr
-rwxrwxr-x. 1 root root   3806848 Feb  5 10:59 mysql-community-devel-5.7.10-1.el6.x86_64.rpm
-rwxrwxr-x. 1 root root  23788680 Feb  5 11:21 mysql-community-client-5.7.10-1.el6.x86_64.rpm
-rwxrwxr-x. 1 root root 140055132 Feb  5 11:41 mysql-community-server-5.7.10-1.el6.x86_64.rpm
-rwxrwxr-x. 1 root root   2229848 Feb  5 12:04 mysql-community-libs-5.7.10-1.el6.x86_64.rpm
-rw-r--r--. 1 root root    332252 Feb  5 12:29 mysql-community-common-5.7.10-1.el6.x86_64.rpm

Install RPM Packages:

[root@SERVER11 ~]# rpm -ivh mysql-community-common-5.7.10-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]
[root@SERVER11 ~]# rpm -ivh mysql-community-libs-5.7.10-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
[root@SERVER11 ~]# rpm -ivh mysql-community-client-5.7.10-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
[root@SERVER11 ~]# rpm -ivh mysql-community-server-5.7.10-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.10-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]

MySQL stop / start Service:

[root@SERVER11 ~]# service mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@SERVER11 ~]# service mysqld start
Starting mysqld:                                           [  OK  ]
[root@SERVER11 ~]# service mysqld status
mysqld (pid  3138) is running...

Get Temp. MySQL Password:

[root@SERVER11 ~]# grep 'temporary password' /var/log/mysqld.log
2016-02-05T07:28:43.322922Z 1 [Note] A temporary password is generated for root@localhost: e%clot#eT4he

[root@SERVER11 ~]# mysql -uroot -p
Enter password: Type Above Temp. password "e%clot#eT4he"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.10

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Reset the password:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mohan@123';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@SERVER11 ~]# mysql -uroot -p
Enter password: Type New Password "mohan@123"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

Check MySQL Service Running Status Commands:

[root@SERVER11 ~]# ps -eaf | grep mysql

root      2942     1  0 12:59 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql     3138  2942  0 12:59 pts/0    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root      3249  2279  0 13:05 pts/0    00:00:00 grep mysql
[root@SERVER11 ~]#







RESETTING THE ROOT PASSWORD FOR MYSQL RUNNING ON RHEL OR CENTOS LINUX

RESETTING THE ROOT PASSWORD FOR MYSQL RUNNING ON RHEL OR CENTOS LINUX

Perform below steps:-


Started MySQL in safe mode

[root@SERVER11 ~]# mysqld_safe --skip-grant-tables &
[1] 24544
60205 20:13:17 mysqld_safe Logging to '/var/log/mysqld.log'.
160205 20:13:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

 Logged in using root

[root@SERVER11 ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Reset the MySQL password

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mohan@123';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED BY 'mcas@123'' at line 1
mysql> select host, user from user;
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from  user;
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+
| Host      | User | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections |
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+
| localhost | root |                                           | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            |          |            |             |              |             0 |           0 |               0 |                    0 |
| SERVER11  | root | *7C7AE13C8C5C7D4E771E8C62907618D43FA4F30E | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            |          |            |             |              |             0 |           0 |               0 |                    0 |
| 127.0.0.1 | root |                                           | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            |          |            |             |              |             0 |           0 |               0 |                    0 |
| localhost |      |                                           | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            |          |            |             |              |             0 |           0 |               0 |                    0 |
| SERVER11  |      |                                           | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            |          |            |             |              |             0 |           0 |               0 |                    0 |
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+
5 rows in set (0.00 sec)

mysql> truncate table user;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to root@localhost identified by 'mohan@123' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> select host, user from user;
+-----------+------+
| host      | user |
+-----------+------+
| localhost | root |
+-----------+------+
1 row in set (0.00 sec)

mysql> quit
Bye

 Stop MySQL in safe mode

[root@SERVER11 ~]# service mysqld stop
Stopping mysqld:                                           [  OK  ]

 Start MySQL

[root@SERVER11 ~]# service mysqld start
Starting mysqld:                                           [  OK  ]


Log in using the new password

[root@SERVER11 ~]# mysql -u root -pmohan@123
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye




Rehat Linux My SQL Installation

Rehat 5 / 6 Linux My SQL Installation

While Installing Redhat Linux Operating system select MySQL Database option. After that try below steps.


[root@SERVER11 /]# service mysqld start

Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h SERVER11 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                 [  OK  ]


[root@SERVER11 /]# service mysqld status
mysqld (pid  6501) is running...



Friday, February 12, 2016

Redhat Linux Stop Firewall Service

Redhat Linux Stop Firewall Service


Temporary stop firewall service.


[root@SERVER11 ~]# service iptables stop

iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]


Permanent stop firewall service.

[root@SERVER11 ~]# chkconfig iptables off


Check firewall service Running Status.

[root@SERVER11 ~]# service iptables status
iptables: Firewall is not running.




Sunday, January 31, 2016

Clear Cache in Linux

Clear Cache in Linux


Step :1 

Clear PageCache Try This command.

mohan# sync; echo 1 > /proc/sys/vm/drop_caches

Step :2

Clear dentries and inodes Try This command.

mohan# sync; echo 2 > /proc/sys/vm/drop_caches

Step :3

Clear PageCache, dentries and inodes Try This command.

mohan# sync; echo 3 > /proc/sys/vm/drop_caches 


Step :4

Check Free Memory status Command

mohan# free -m


Linux Split and Join Manage Large Files

 Linux Split and Join Manage Large Files



Linux split and join commands are very helpful when you are manipulating large files (zip,gzip,tar..etc)


Step 1: Linux split file Commands

mohanlinux#split -b 4000m mohansundaram.tar.gz "mohansundaram-part"

Note:-
-b 4000m - 4GB Split Size
mohansundaram.tar.gz - Large file name
mohansundaram-part - split file name start with this name

Step 2:

mohanlinux#ls -ltr
-rw-rw-r-- 1 mohan sundaram 40000 Jan 31 21:35 mohansundaram-partxaa
-rw-rw-r-- 1 mohan sundaram 40000 Jan 31 21:35 mohansundaram-partxab
-rw-rw-r-- 1 mohan sundaram 40000 Jan 31 21:35 mohansundaram-partxac


Step 3:Linux  Join / Merge file Commands

mohanlinux#cat mohansundaram-partxa* > mohansundaram.tar.gz