Over the past week+ I have been learning a little more about SQL. Finally got a working script you can use to keep a backup of your databases.
This will create a folder C:\ROMServerBackups, in it will be a folder index by Year,Month,Day,Hour,Minute,Second
In that folder will be the five databases.
I have tested the backup in a virtual machine and it does appear to work just fine for me. And I see this forum isn't friendly to my TABs, I tried to keep it aligned and tidy so it makes sense and people can learn from my work.
Don't forget to click like, lets me know ppl find this useful.
This will create a folder C:\ROMServerBackups, in it will be a folder index by Year,Month,Day,Hour,Minute,Second
In that folder will be the five databases.
Code:
DECLARE [USER=2000162561]Newfolder[/USER] varchar(200)SELECT [USER=2000162561]Newfolder[/USER]='C:\ROMServerBackups\' + REPLACE(convert(nvarchar(20),GetDate(),120),':','-')
EXEC master.dbo.xp_create_subdir [USER=2000162561]Newfolder[/USER]
DECLARE @DB1 varchar(200)
DECLARE @DB2 varchar(200)
DECLARE [USER=875297]DB3[/USER] varchar(200)
DECLARE @DB4 varchar(200)
DECLARE @DB5 varchar(200)
SELECT @DB1 [USER=2000162561]Newfolder[/USER] + N'\ROM_Account.bak'
SELECT @DB2 [USER=2000162561]Newfolder[/USER] + N'\ROM_GlobalDB.bak'
SELECT [USER=875297]DB3[/USER] [USER=2000162561]Newfolder[/USER] + N'\ROM_ImportDB.bak'
SELECT @DB4 [USER=2000162561]Newfolder[/USER] + N'\ROM_World.bak'
SELECT @DB5 [USER=2000162561]Newfolder[/USER] + N'\ROM_WorldLog.bak'
BACKUP DATABASE ROM_Account TO DISK = @DB1 WITH INIT, NAME = N'ROM_Account', SKIP, STATS = 10
BACKUP DATABASE ROM_GlobalDB TO DISK = @DB2 WITH INIT, NAME = N'ROM_GlobalDB', SKIP, STATS = 10
BACKUP DATABASE ROM_ImportDB TO DISK = [USER=875297]DB3[/USER] WITH INIT, NAME = N'ROM_ImportDB', SKIP, STATS = 10
BACKUP DATABASE ROM_World TO DISK = @DB4 WITH INIT, NAME = N'ROM_World', SKIP, STATS = 10
BACKUP DATABASE ROM_WorldLog TO DISK = @DB5 WITH INIT, NAME = N'ROM_WorldLog', SKIP, STATS = 10
I have tested the backup in a virtual machine and it does appear to work just fine for me. And I see this forum isn't friendly to my TABs, I tried to keep it aligned and tidy so it makes sense and people can learn from my work.
Don't forget to click like, lets me know ppl find this useful.