+ 1

How to take DB backup using cmd

I want to know how make new folder for locating .back file using query

1st Apr 2017, 1:05 PM
Manikandan N
Manikandan N - avatar
2 Respostas
+ 3
Oracle: exp login/password@db file=filename.dmp log=filename.txt
28th Feb 2019, 12:35 PM
Андрей Чачин, Andrew Chachin
Андрей Чачин, Andrew Chachin - avatar
+ 2
for sql server 2008+ Enable cmd if is needed: -- allow advanced options to be changed EXEC sp_configure 'show advanced options',1; GO -- update currently conf val for advanced options RECONFIGURE; GO -- enable xp_cmdshell EXEC sp_configure 'xp_cmdshell', 1; GO -- update currently value for cmd shell RECONFIGURE; GO SCRIPT FOR CREATE SUBDIR AND BACKUP: When is feature activated you need to check if the directory exists. -- declare table for directory check results DECLARE @t TABLE(file_exists int, is_directory int, parent_exists int) -- insert results of check INSERT INTO @t(file_exists, is_directory, parent_exists) EXEC master.dbo.xp_fileexists 'C:\exampledirectory' -- if not exists create dir IF (SELECT is_directory FROM @t) = 0 BEGIN EXEC master.dbo.xp_create_subdir 'C:\exampledirectory' END BACKUP DATABASE MyExampleDatabase TO DISK = 'C:\exampledirectory' GO
5th Apr 2017, 7:04 AM
Matej Hlavaj
Matej Hlavaj - avatar