-
How to find out Different SQL Server Property?
SELECTSERVERPROPERTY(‘MachineName’) AS HostName,SERVERPROPERTY(‘InstanceName’) AS InstanceName,SERVERPROPERTY(‘Edition’) AS EditionInfo,SERVERPROPERTY(‘EditionId’) AS EditionID,SERVERPROPERTY(‘ProductVersion’) AS ProductVersion,SERVERPROPERTY(‘ProductLevel’) AS ProductType,SERVERPROPERTY(‘EngineEdition’) AS EngineEdition,SERVERPROPERTY(‘ResourceLastUpdateDateTime’) AS ResourceLastUpdateDateTime,SERVERPROPERTY(‘IsClustered’) as IsClustered Description:-MachineName:- It shows the hostname of the machine.InstanceName:- It shows instance name if it is not default.In case of default it returns Null.Edition :- It SQL Server edition installed on machine.EditionId:- It shows Edition IdProductVersion:- It… Continue Reading
-
Shell script for Mysql Database Backup
# mkdir /backups/db_backup/ # vi /backups/mysqlbackup.sh #!/bin/bashexport path1=/backups/db_backupdate1=`date +%y%m%d_%H%M%S`/usr/bin/find /backups/db_backup/* -type d -mtime +30 -exec rm -r {} \; 2> /dev/nullcd $path1/mkdir $date1USER=”root”PASSWORD=”redhat123″OUTPUTDIR=”$path1/$date1″MYSQLDUMP=”/usr/bin/mysqldump”MYSQL=”/usr/bin/mysql”HOST=”localhost”databases=`$MYSQL –user=$USER –password=$PASSWORD –host=$HOST \-e “SHOW DATABASES;” | tr -d “| ” | grep -v Database`echo “` for db in $databases; do echo $db if [ “$db” = “performance_schema” ]… Continue Reading
-
Different recovery models in SQL Server
Different recovery models in SQL Server:-There are 3 recovery model present in SQL Server.1.Full2.Simple3.Bulk-Logged. 1.Full:- If a database is in “Full” recovery model, it keeps all transaction data in the transaction log until either a transaction log backup occurs or the transaction log is truncated.This way all the transactions that are issued in SQL Server… Continue Reading
-
User creation in Mysql where dbname consist hyphen
We can create a user that consists of no special character at ease. mysql> create user ‘abc’@’localhost’ identified by ‘redhat’; But to create a user for a database which consists of special character we follow this:- mysql> grant all privileges on `Emp-Kolkata`.* to soumya@’localhost’ identified by ‘redhat’; mysql> grant all privileges on `Emp-Kolkata`.* to soumya@’%’ identified… Continue Reading
-
Shell script for Webfile Backup for webserver
# mkdir /backups/web_backup/ # vi /backups/webbackup.sh #!/bin/bash export path1=/backups/web_backupsdate1=`date +%y%m%d_%H%M%S` /usr/bin/find /backups/web_backups/* -type d -mtime +3 -exec rm -r {} \; 2> /dev/null mkdir $path1/$date1 cp -r /var/www/html $path1/ cd $path1/html for i in */; do /bin/tar -zcvf “$path1/$date1/${i%/}.tar.gz” “$i”; done if [ $? -eq 0 ] ; thencdrm -r /backups/web_backups/htmlfidone :wq (save & exit) Now… Continue Reading
-
Oracle Restore point and its usage
Database version:- Oracle 11g R2 What is restore point?A CREATE RESTORE POINT statement creates a restore point, which is a name associated with an SCN of the database pointing to the time of the creation of the restore point.A restore pointcan be used to flashback a table or the database back to the time of… Continue Reading
-
How STARTUP works in oracle database
Startup consists of 3 phases. First of all, in order to issue the startup command you must be logged into an account that has sysdba or sysoper privileges such as the SYS account.When oracle tries to open a database using startup command it goes through 3 phases. 1.NOMOUNT2.MOUNT3.OPEN 1. NOMOUNT Stage:- When we issue the… Continue Reading
-
RECOVER DATABASE USING BACKUP CONTROLFILE fails due to no archivelog present
Scenario:- So here i am producing a test case where I will need to recover the database but the last archivelog is not present in system which required for the database recovery. Database Version:- Oracle 11g R2Database SID:- prim First before the doing the activity i’am taking a full database backup along with archivelogs. [oracle@server1… Continue Reading
-
How to take Full, Differential & Transaction log backup & restore it using T-SQL
Full backup:- USE “TESTDB”GOBACKUP DATABASE “testdb”TO DISK = ‘E:\TESTDB02101.BAK’GO Differential backup or incremental backup:- Prerequisites:-Creating a differential database backup requires that a previous full database backup exist. If the selected database has never been backed up,run a full database backup before creating any differential backups. For more information, see Create a Full Database Backup (SQL… Continue Reading
-
How to find out tablespaces with free space < 15%
SQL> set pagesize 300SQL> set linesize 100SQL> column tablespace_name format a15 heading ‘Tablespace’SQL> column sumb format 999,999,999SQL> column extents format 9999SQL> column bytes format 999,999,999,999SQL> column largest format 999,999,999,999SQL> column Tot_Size format 999,999 Heading ‘Total Size(Mb)’SQL> column Tot_Free format 999,999,999 heading ‘Total Free(Kb)’SQL> column Pct_Free format 999.99 heading ‘% Free’SQL> column Max_Free format 999,999,999 heading… Continue Reading

