-
script to get all databases present on a server ?
Hi all,
I'm really new to creating scripts for MS SQL Server administration; but i need to do this :
create a script that will get all datbases names created on a specific server and then backup them all to 1 file per database.
I found that i could take the name of all my databases using :
SELECT name, filename FROM master.dbo.sysdatabases
and that backup could be done using such a command line :
BACKUP DATABASE [MYDATABASE_NAME] TO DISK = N'D:\Backups\DATABASES\DB_MYDATABASE_NAME.bak' WITH INIT , NOUNLOAD , NAME = N'Backup for MYDATABASE_NAME', NOSKIP , STATS = 10, NOFORMAT
Finally, the difficulty is to do a loop that would get all databases names, run the specific command and ignore if database name is TEMPDB of course.
Then being able to send an email with the log report into it would be great ;-))
thanks for your help
Florent, from France
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|