The syntax help in the SQL Server links are very difficult for me to read. I
got an error with a similar command "near INIT". I see now that WITH
parameters should be comma separated. The syntax should be:
osql -Usa -P -n -Q "Backup Database pdticket To Disk =
'E:\mssql7\backup\pdticket.bak' WITH SKIP, INIT"
I use Windows Integrated Authentication (rather than SQL logins), so the
command I used was similar to:
osql -S MyServer\MyInstance -E -d Master -Q "BACKUP DATABASE MyDatabase TO
DISK = 'C:\MyFolder\MyTest.bak' WITH SKIP, INIT"
I also have a named instance. I connect to the Master database to perform
backups. When I tested the above repeatedly the date/time changed, but not
the size. I have not had this problem in the past because I name my backups
after the date/time of the backup, so a new backup is created each time. I
need to delete old ones periodically, but I want to have at least several
backups.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Microsoft Newsosql -Usa -P -n -Q "Backup Database pdticket To Disk =
'E:\mssql7\backup\pdticket.bak' WITH SKIP INIT"
It's still appending (my DB gets bigger every time I run the command).
Any other ideas?
Clayton
Post by Richard Mueller [MVP]First, the INIT option must be included in the SQL statement, so it must
be in the quoted string. Next, this is a "General With Option" so you
osql -Usa -P -n -Q "Backup Database pdticket To Disk =
'E:\mssql7\backup\pdticket.bak' WITH SKIP INIT"
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Microsoft NewsHey guys,
osql -Usa -P -n -Q "Backup Database pdticket To Disk =
'E:\mssql7\backup\pdticket.bak'" SKIP INIT
As you can see, I have addedd *SKIP* and *INIT* but it still appends.
Any other ideas?
TIA,
Clayton
Post by Richard Mueller [MVP]Post by Microsoft Newsosql -Usa -P -n -Q "Backup Database pdticket To Disk =
'E:\mssql7\backup\pdticket.bak'"
Our problem is that the above script *appends* and we want to
*overwrite* the DB every night. Can someone tell me what I need to do
to change the script to *overwrite*?
TIA,
Use the INIT option to overwrite. The default is NOINIT, which appends.
http://msdn.microsoft.com/en-us/library/ms186865(SQL.90).aspx
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--