Category Archives: Database

All database related short tips.

WordPress sites backup shell script

WordPress sites backup shell script #! /bin/bash ## backup script for the wordpress site ## taking complete backup of website folder, database & apache configuration files ## itquery(at)gmail.com TIMESTAMP=$(date +”%F”) IPA=`hostname -I| awk ‘{print ($1)}’` BACKUP_DIR=”/backup/BKP_$IPA/$TIMESTAMP” #### Website folder path … Continue reading

Posted in Database, Shell script | Leave a comment

Find and replace character in SQL script

 Find and replace character in SQL script UPDATE TABLE SET LoginId = REPLACE( LoginId, ‘_’, ‘.’ ), SSO = REPLACE(SSO, ‘_’, ‘.’ ) WHERE LoginId IS NOT NULL

Posted in Database, Unix/Linux | Tagged | 1 Comment

SQL query output in CSV format (MySQL)

SQL query output in CSV format (MySQL). You can have your SQL Query saved as a file “QUERY.sql” SELECT FIELD1, FIELD2, FIELD3 … from TABLEName WHERE COLUMNName = ‘$VALUE’ INTO OUTFILE ‘/tmp/DataFile_output.csv’ FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES … Continue reading

Posted in Database, Shell script | Tagged | Leave a comment

Important Question and their Answers for MySQL database

Important Question and their Answers for MySQL database 1. Quest – How do you convert to a different table type? Answr – ie. ALTER TABLE TYPE = InnoDB; OR ALTER TABLE ENGINE InnoDB; Quest – Which storage engines support transactions … Continue reading

Posted in Database, Unix/Linux | Leave a comment

MySQL- Store table name in Camel case or Mixed case

MySQL- Store table name in Camel case or Mixed case  Stop mysql $/etc/init.d/mysqld stop Locate and edit my.cnf file In Linux/Unix OS $vi /etc/my.cnf In MS-Windows OS edit C:\Program Files\MySQL\Mysql Server\my.ini Add below line at the end of the file … Continue reading

Posted in Database, Unix/Linux | Leave a comment

Basics MYSQL

Below contains Some basic concepts of MYSQL Shutdown of mysql db: ====================== cd /opt/app/mysql/bin/ —-User has to be in mysql directory bin/mysqladmin -u root -p shutdown Startup of mysql db: ====================== cd /opt/app/mysql/bin/ —-User has to be in mysql directory … Continue reading

Posted in Database | Leave a comment

Oracle Backups

Broadly classifying Oracle database backup can be divided as below. 1. Cold Backup (offline) 2. Hot backup (online) 3. Logical Backup 4. RMAN —– 1. Cold Backup (offline) For this kind of backup DB has to be shutdown completely. Step … Continue reading

Posted in Database | Leave a comment

Shutting Down and Starting Up Your Oracle Database

If you’ve never worked as an Oracle Database Administrator before, some basics that you need to know are how to position to the correct database and how to shut down and start up your database. 1. Setting correct environment and … Continue reading

Posted in Database | Leave a comment

How to load a cvs format file data into oracle database

Many a times we get a request to load a csv formated data to load into the database. Make sure data stored in the csv file are in a proper format. Create a data.ctl file ex. ————— data.ctl ————— load … Continue reading

Posted in Database | Leave a comment