January 4, 2018 at 10:59 am
HI,
We have 100 databases and need to take tail back up. I'm trying to generate sql script for all 100 databases. Can you please advise?
BACKUP LOG DB1 TO DISK = N'Z:\DR\Taillog_Backup\DB1.trn'
WITH NORECOVERY
GO
I'm just getting name but not sure how to include the path
SELECT 'Backup log '''+NAME+'''' FROM sys.databases
January 4, 2018 at 11:45 am
gary1 - Thursday, January 4, 2018 10:59 AMHI,
We have 100 databases and need to take tail back up. I'm trying to generate sql script for all 100 databases. Can you please advise?BACKUP LOG DB1 TO DISK = N'Z:\DR\Taillog_Backup\DB1.trn'
WITH NORECOVERY
GOI'm just getting name but not sure how to include the path
SELECT 'Backup log '''+NAME+'''' FROM sys.databases
You just need to keep building the string.
SELECT 'BACKUP LOG ' + QUOTENAME(name) + ' TO DISK = N''Z:\DR\Taillog_Backup\' + name + '.trn''
WITH NORECOVERY
GO'
FROM sys.databases
January 4, 2018 at 3:12 pm
Luis Cazares - Thursday, January 4, 2018 11:45 AMgary1 - Thursday, January 4, 2018 10:59 AMHI,
We have 100 databases and need to take tail back up. I'm trying to generate sql script for all 100 databases. Can you please advise?BACKUP LOG DB1 TO DISK = N'Z:\DR\Taillog_Backup\DB1.trn'
WITH NORECOVERY
GOI'm just getting name but not sure how to include the path
SELECT 'Backup log '''+NAME+'''' FROM sys.databases
You just need to keep building the string.
SELECT 'BACKUP LOG ' + QUOTENAME(name) + ' TO DISK = N''Z:\DR\Taillog_Backup\' + name + '.trn''
WITH NORECOVERY
GO'
FROM sys.databases
Thanks so much.
How to put the GO statement in next line?
January 4, 2018 at 3:41 pm
I'd add a where clause to the query to filter out any databases that happen to be using the simple recovery model.
January 4, 2018 at 3:52 pm
Lynn Pettis - Thursday, January 4, 2018 3:41 PMI'd add a where clause to the query to filter out any databases that happen to be using the simple recovery model.
I used this:
SELECT 'BACKUP LOG ' + QUOTENAME(primary_database) + ' TO DISK = N''Z:\DR\Taillog_Backup\' + primary_database + '.trn''
WITH NORECOVERY
GO'
FROM msdb.dbo.log_shipping_primary_databases
January 4, 2018 at 11:21 pm
Lynn Pettis - Thursday, January 4, 2018 3:41 PMI'd add a where clause to the query to filter out any databases that happen to be using the simple recovery model.
+1 and also a clause filtering for ONLINE.
...
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply