Saturday, 11 January 2020

Backup and restore in sql server command


Backup with copy only
+++++++++++++++++

backup database BR_EINVOICE_CONNECTOR25  to
disk =N 'F:\BKup01\MSSQL11.SQLD\MSSQL\Backup\ManualBackups\BR_EINVOICE_CONNECTOR25_1.bak',
disk =N 'F:\BKup01\MSSQL11.SQLD\MSSQL\Backup\ManualBackups\BR_EINVOICE_CONNECTOR25_2.bak',
disk =N 'F:\BKup01\MSSQL11.SQLD\MSSQL\Backup\ManualBackups\BR_EINVOICE_CONNECTOR25_3.bak',
WITH  COPY_ONLY,compression,stats=10;

or

BACKUP DATABASE [BR_eInvoice_COLD_SEARCH] TO 
DISK = N'L:\Bkup01\MSSQL11.SQLX\MSSQL\Backup\ManualBackups\Xnet_content_NAEU1_1.bak'
WITH  COPY_ONLY, NOFORMAT, NOINIT,  NAME = N'BR_eInvoice_COLD_SEARCH-Full Database Backup',
SKIP, NOREWIND, NOUNLOAD, COMPRESSION,  STATS = 10
GO


backup normally


backup database BR_eInvoice_COLD_SEARCH  to disk='F:\BKup01\MSSQL11.SQLD\MSSQL\Backup\ManualBackups\BR_eInvoice_COLD_SEARCH_1.bak'
with compression,stats=10;





Restore comman in sql server 


restore database [Contacts] from disk = 'J:\AZRWUS2UIS_SQLD\BAckup\ManualBackups\Contacts_1.bak'
with replace,stats=10,norecovery,
move 'Contacts_Data' to 'I:\MSSQL_SQLI\MSSQL11.SQLD\MSSQL\DATA\Contacts_Data.mdf',
move 'Contacts_Log' to 'I:\MSSQL_SQLI\MSSQL11.SQLD\MSSQL\DATA\Contacts_Log.ldf'

for logshipping restore
++++++++++++++

restore database [BR_eInvoice_COLD_SEARCH] from disk = 'F:\BKup01\MSSQL11.SQLD\MSSQL\Backup\ManualBackups\BR_eInvoice_COLD_SEARCH_1.bak'
with replace,stats=10,norecovery,
move 'BR_eInvoice_COLD_SEARCH' to 'I:\MSSQL_SQLI\MSSQL11.SQLD\MSSQL\DATA\BR_eInvoice_COLD_SEARCH.mdf',
move 'BR_eInvoice_COLD_SEARCH _log' to 'I:\MSSQL_SQLI\MSSQL11.SQLD\MSSQL\DATA\BR_eInvoice_COLD_SEARCH_1.ldf',
standby='I:\MSSQL_SQLI\MSSQL11.SQLD\MSSQL\DATA\BR_eInvoice_COLD_SEARCH.tuf'




No comments:

Post a Comment

Featured post

duplicate db from standy to other server

 Duplicate Testuat   $ export ORACLE_SID=Testuat3 $ sqlplus '/as sysdba' Testuat3 SQL> alter system set cluster_database=FALSE sc...