Skip to main content

How to take MS SQL Database Backup All At once | How to take all Database Backup from MS SQL Server


MS SQL is the most used database nowadays, we may have or maybe be in future, faced the issue of database backup, database backup with one by one single database is quite simple, you just have to right-click then go to Task then select backup and follow the instructions.


But suppose you have 100s of databases that you need to backup  now one by one process is way difficult because you can't do the selection process every time to take the backup this will take years, 


So how to take backup then?



Use the below script to take any number of database backups in any MS SQL database.


DECLARE @path VARCHAR(500)

DECLARE @name VARCHAR(500)

DECLARE @filename VARCHAR(256)


-- 1. Setting the backup path


SET @path = 'E:\Database_Backup_11022021'  


-- 2. Defining cursor operations

 

DECLARE db_cursor CURSOR FOR  

SELECT name 

FROM master.dbo.sysdatabases 

WHERE name  NOT in   ('Master') 


--3. Initializing cursor operations


OPEN db_cursor   

FETCH NEXT FROM db_cursor INTO @name   


WHILE @@FETCH_STATUS = 0   

BEGIN


-- 4. Defining the filename format

   

       SET @fileName = @path + @name + '' + '.BAK'  

       BACKUP DATABASE @name TO DISK = @fileName  


 

       FETCH NEXT FROM db_cursor INTO @name   

END   

CLOSE db_cursor   

DEALLOCATE db_cursor


end 


Do remember SET @path = 'E:\Database_Backup_11022021', this path is the Backup path where all the databases will get saved.



Comments

Popular posts from this blog

How to remove Admin/Manager from Realtime Devices?

All the Realtime devices have  Manager/admin lock option this is used to Restrict the unauthorized access of device options. But once you forget admin or admin is not available then you need to remove the admin. And if you are trying to access Menu too many times unauthorized then device get S elf Locked. O nce the device is self-locked then you will not be able to access the device menu, even the Authorized admin tries to access it. This means if the device is self-locked then no one can access device menu options not even authorized admin and then you will need to remove the admin either using default keys or from the device directly or using the software. Remove  Admin/Manager using Predefined Key Most of the Realtime Finger Print devices like T52/T60/C121/C110 etc if you want to remove admin then just follow the steps using predefined id and password..... Press Menu Button in the device. Once at the top it shows Manager Confirm type 24406083 a

How to change default login name & password in Realsoft 10.7?

In Realsoft desktop software the default login credentials are are rss so for the security purpose you can change the credentials. Follow the steps below to do the same. Login in software with default credentials. Now go to Administrator then Change Passwor d to change User Name and Password. Put the C urrent Login Credentials then put New Details then click on  Change. And here you are done changing the login credentials. Now what next to do??? After changing the password you won't be able to see your added Employee details, for that you will need to enable the credentials for that newly created user. So how to Enable credentials for Newly Added user? Follow us on. Youtube LinkedIn Facebook Instagram Twitter Just got to File then go to Setup . Put the default password as rss110092 . Edit & Enable Show all company then make it save . Once save go to Company Master and you will see you company name.

How to Reset / Delete all data from Realtime Devices Using Software ?

Sometime when your Realtime face device's memory is full and it starts showing Transaction Full and you want to clear the logs or If you want to refresh the device and delete any or all enrollments, All these can be done using software or from the device directly. Note:- Before deleting anything from the device, make sure you have already taken backup because once you deleted the data it will delete whole data till the current time and will not be able to recover. How to Take Realtime Device Data Backup? Delete Punch logs from any Realtime Devices using Realtime Attendance Software. Login with any Realtime  Attendance Software and C onnect Device using LAN or USB . Note:- None of the face devices will get connected using the USB cable. Go to data Transfer and Click on Delete Data From Machine , and it will delete all the Punching Logs in the device. Note:- If the software is below Realsoft 10.8 means if the software is 10.6 or 10.7 it will ask you