Posts

Showing posts from May, 2021

SQL Server DB Refresh

Image
SQL Server DB Refresh SQL Server DB Refresh from  SQL Server 2008 to SQL Server 2008  - Article Note: For SQL Server 2005 to SQL Server 2008/2012, Post DB Refresh, Please change DB Compatibility level to latest version. @ Production SQL Server Instance **************************** @ Production Database: ******************* STEP-1 :   Perform the production database full backup with COPY_ONLY. --TSQL SCRIPT: BACKUP DATABASE ProdDB TO DISK = 'E:\Source\MSSQL\BACKUPS\ProdDB_FULL_BKP_DEC262015_12.40PM.BAK' WITH COPY_ONLY STEP- 2 : Move this backup file to Development Server using the below command. Go to RUN. Type the command ----   \\DestinationServerName\E$\MSSQL\BACKUPS @ Development SQL Server Instance ******************************* --Perform full backup if required as per the application team confirmation --Also check whether we have enough space in Backup Drive (example: E:\MSSQL\Backups) STEP- 3 :   Perform the development database full backup normally. --No need of copy_on

Syntaxes for Restore

 restore filelistonly from disk = 'E:\RAVIDBA\FULL\AdventureWorks2012_full_backup_20210529_120800.bak ' select * from sys.sysaltfiles restore database [AdventureWorks2012]  from disk = 'E:\RAVIDBA\FULL\AdventureWorks2012_full_backup_20210529_120800.bak'  with replace , recovery ; restore database [RAVIDBA]  from disk ='E:\RAVIDBA\FULL\AdventureWorks2012_full_backup_20210529_120800.bak' with move 'AdventureWorks2012'  to 'D:\MYSQLSERVER\MSSQL11.RAVISQLSERVERDBA\MSSQL\DATA\RAVIDBA.mdf',  move 'AdventureWorks2012_log'  to 'D:\MYSQLSERVER\MSSQL11.RAVISQLSERVERDBA\MSSQL\LogDB\RAVIDBA_log.ldf' , replace, recovery , stats = 5 ;