Search the Blog

Thursday, June 23, 2022

SQL SERVER DBA

Working Environment Types

1- Production

2- QA

3- Development

Database Restore Types
1- Full Backup

2- Differential 

3- LOG BACKUP

Process
- with Standby– Read only Database will be restored

-with norecovery- when we required to restore the data of full and differential backup only

-with recovery- when we required to store the database till crash time


1- Norecovery- Full Not Access
2- Norecovery-  Differential not Access

3- Recovery- Log Backup Access

Info -MSDB database
RestoreFile
RestoreFileGroup
RestoreHistory


DATABASE BACKUP-

FULL-
Backup DATABASE SAWAN TO DISK=’SAWAN_FULL_BACKUP_07_06_2022.BAK’  WITH INIT



DIFFERNTIAL -

 Backup DATABASE SAWAN TO DISK=’SAWAN_DIFF_BACKUP_07_06_2022.BAK’  WITH DIFFERENTIAL,  INIT


LOG BACKUP-

BACKUP LOG SAWAN TO DISK=’SAWAN_LOG’ WITH NO_TRUNCATE


RESTORE
1- RESTORE DATABASE SAWAN FROM DISK=’’ WITH NORECOVERY


File Group Backup
Split
Mirrod
Copy only Backup


DR Plan
1-Loggshipping

2-Mirroring
3-Aloways On

4- Clustering

5-Replication
ITIL-SLA


Friday, May 6, 2022

SQL Important Scripts

 To create a new table and load the data directly


select  Param1

      ,Param2

      ,Param3

      ,Param4

      ,Param5

      ,Param6

      ,Param7

INTO New_Table_Name   FROM

 OLD_TABLE_NAME where month(created_on)=4


Monday, April 25, 2022

SQL SERVER database TYPES

 

SYSTEM_DATABASESAll system databases (master, msdb, and model)
USER_DATABASESAll user databases
ALL_DATABASESAll databases
AVAILABILITY_GROUP_DATABASESAll databases in availability groups
USER_DATABASES, -AVAILABILITY_GROUP_DATABASESAll user databases that are not in availability groups
Db1The database Db1
Db1, Db2The databases Db1 and Db2
USER_DATABASES, -Db1All user databases, except Db1
%Db%All databases that have “Db” in the name
%Db%, -Db1All databases that have “Db” in the name, except Db1
ALL_DATABASES, -%Db%All databases that do not have “Db” in the name

Translate