-
Batch script to take database users backup in sql server
SQL Server Version:- SQL 2014 Create a batch file which will be scheduled on task scheduler. set backuplogfilename=%date:~-7,2%-%date:~-10,2%-%date:~-4,4%-0%time:~1,1%%time:~3,2%%time:~6,2%SQLCMD.EXE -S localhost -U sa -P “sa@123” -i “E:\users.sql” >> “E:\users_%backuplogfilename%.log”— save and exit Now schedule the above .bat file in task scheduler Create a sql file lets say users.sqlContent of users.sql USE masterGOIF OBJECT_ID (‘sp_hexadecimal’) IS NOT… Continue Reading
-
Mysql error-log monitoring using Shell script with mail alert
#!/bin/bashSERNAME=xyz.kmi.comSERPUBIP=192.168.72.50SERVER=`hostname`WEEKDAY=`date ‘+%w%H%M’`DATE_VAR=`date ‘+%Y_%m_%d’` Error_log_loc=/var/logegrep ‘Error’ $Error_log_loc/mysqld.log |sort -u > $Error_log_loc/mysqld_ALERTLOG.txtcat $Error_log_loc/mysqld.log >> $Error_log_loc/mysqld_archived.log cat /dev/null > $Error_log_loc/mysqld.log if [ -s “$Error_log_loc/mysqld.log” ] ; thencat $Error_log_loc/mysqld_ALERTLOG.txt | mail -s “URGENT -ERROR in Oracle Alert Log File for $SERNAME ($SERPUBIP) at `date` ” ssdas@gmail.comfi # Weekly alert log datestamp and compress (Sunday 00:15) sysdate=`date | awk ‘{… Continue Reading
-
How to migrate mysql users from one server to another?
Step 1: Get a List of MySQL Users from the source server [root@db01 tmp]# mysql -B -N -uroot -p -e “SELECT CONCAT(‘\”, user,’\’@\”, host, ‘\”) FROM user WHERE user != ‘debian-sys-maint’ AND user != ‘root’ AND user != ”” mysql > /tmp/mysql_all_users.txtEnter password: redhat[root@db01 tmp]# cat /tmp/mysql_all_users.txt‘CitLivehappy’@’%’‘brightonlands’@’%’‘brochure’@’%’‘carver’@’%’‘CitLivehappy’@’localhost’‘brightonlands’@’localhost’‘brochure’@’localhost’‘carver’@’localhost’ Step 2:- Obtain a List of User Privileges… Continue Reading
-
Oracle Alert log monitoring using shell script
Vi /backups/alertlog_monotor.sh #!/bin/bashexport ORACLE_SID=kmioradbexport ORAENV_ASK=NO. /home/oracle/.bash_profileSERNAME=oradb.kminfosystems.comSERPUBIP=192.168.72.50SERVER=`hostname` #### Sets the server name for the emailWEEKDAY=`date ‘+%w%H%M’` #### Sets the number value of the day of the weekDATE_VAR=`date ‘+%Y_%m_%d’` Alert_log_loc=/u01/app/oracle/diag/rdbms/kmioradb/kmioradb/trace/# Check for the existence of ORA- in the alert log… Continue Reading
-
Monitoring percona Error-log using shell script
vi /backups/alertlog_monotor.sh #!/bin/bashSERNAME=srv1.xyz.comSERPUBIP=192.168.72.50SERVER=`hostname` #### Sets the server name for the emailWEEKDAY=`date ‘+%w%H%M’` #### Sets the number value of the day of the weekDATE_VAR=`date ‘+%Y_%m_%d’` Error_log_loc=/data/mysqlegrep ‘Error’ $Error_log_loc/$SERNAME.err |sort -u > $Error_log_loc/$SERNAME_ALERTLOG.txtcat $Error_log_loc/$SERNAME.err >> $Error_log_loc/$SERNAME_Archived_ALERTLOG.txt cat /dev/null > $Error_log_loc/$SERNAME.err… Continue Reading
-
Different SQL Server Roles
Different SQL Server Roles:- Server Roles:- The Server Roles page lists all possible roles that can be assigned to the new login. The following options are available:bulkadmin:-Members of the bulkadmin fixed server role can run the BULK INSERT statement. dbcreator:-Members of the dbcreator fixed server role can create, alter, drop, and restore any database. diskadmin:-Members… Continue Reading
-
Register a Connected Server using 2012 SQL Server Management Studio
Register a Connected Server using 2012 SQL Server Management Studio :- By registering the server, you can save the connection information for servers that we access frequently. A server can be registered before connecting, or at the time of connectionfrom Object Explorer. To register a connected server:-Open up sql server management studio 2012.In Object Explorer,… Continue Reading
-
How to Install MongoDB on Ubuntu 14.04 ?
How to Install MongoDB on Ubuntu 14.04? Step #1: Setup a the Package DatabaseFirst we’ll import the MongoDB public key used by the package management system: # sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10 Then we’ll create a list file for MongoDB: # echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen’ | sudo tee /etc/apt/sources.list.d/mongodb.list Now reload the… Continue Reading
-
How to setup MariaDB (Master-Slave) Replication on CentOS/RHEL 6x & Ubuntu
Setup MariaDB (Master-Slave) Replication on CentOS/RHEL 6x & Ubuntu=================================================================== Our Testing Environment Consists of the Following Machines (Both are CentOS 6) : Master: 192.168.72.220 ser1.kmi.comSlave: 192.168.72.221 ser2.kmi.com Step: 1. Bind Hosts File (Both Server) : # vi /etc/hosts 192.168.72.220 ser1.kmi.com ser1192.168.72.221 ser2.kmi.com ser2 — Save & Quit (:wq) Step: 2. Stop Iptables & Disabled Selinux… Continue Reading
-
Oracle WebLogic Server (WLS) 11gR1 (10.3.6) Installation on RHEL 6
Download oracle weblogic server 10.3.6 from oracle site:-# wget http://download.oracle.com/otn/nt/middleware/11g/wls/1036/wls1036_generic.jar Also download java development kit(jdk):- # wget http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz Create the directories in which the Oracle weblogic software will be installed. Add users and groupsgroupadd -g 501 oinstallgroupadd -g 502 dba useradd -u 502 -g oinstall -G dba oraclepasswd oracle mkdir -p /u01/app/oracle/product/fmw11gmkdir -p /u01/app/oracle/config/domainsmkdir -p… Continue Reading

