MSDE backup file is appending - backup

I have an MSDE 2000 database backup file which is appending rather than deleting or renaming. I am using this command:
BACKUP DATABASE [SPSDB] TO DISK = 'E:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\SPSbackup\spsdb.bak' with retaindays = 1
I am using a maintenance plan on my full SQL version databases, and they create a new file everyday with the date in the file name.
The backup file size creeps up on me if I don't monitor it. Is there a way to have MSDE make a uniue file with the daily backup job I created?
Thanks,
Chad

Take a look at http://msdn.microsoft.com/en-us/library/ms186865.aspx for the BACKUP command. Did you try using INIT option?
I noticed the question is very old, but maybe my answer can help somenone.

Related

Why Database backup size differs when backing up from Query and SSMS?

I am confused with the size of the file I backup with SSMS and Query.
If I create a file from SSMS in its default folder something like "C:\Program Files\Microsoft SQL Server\MSSQL14.NAMEDINSTANCE\MSSQL\Backup" the outfile say Db1.bak is about 198292 KB
Same database if I backup with the query "backup database Db1 to disk='D:\Db1.bak' the file size is just 6256 KB
Sometimes the other database say Db2 gives the same filesize i.e 6256 KB(Both Db1 and Db2 have identical(same) schemas just data in it are different.)
And backup with SSMS gives 33608 KB which seems satisfactory.
I also tried verifying all database in SSMS like this RESTORE VERIFYONLY FROM DISK = 'D:\BACKUP\Db1.bak'
GO and result gives valid in every database check.
I also tried deleting Db1 from SSMS and restoring the less KB file and checked some data of few tables (Not All) and it seems showing all data in tables properly but the filesize dissatisfies me.
Thank You.
I suspect that,like initially mentioned, you have compression on my
default, and using the GUI, with the settings is not making use of
that (and that if you selected to Compress in the GUI, you'd get a
similar size)
If the server option backup compression default is on, even if you don't mention it in your backup command, compression will be applied. So in both cases there would be compressed backup. But it's easy to see, just run this command for both backups:
restore headeronly
from disk = 'here_the_full_path_with_filename';
In the 5th column you'll get the flag if your backup is compressed.
But the cause of this difference is another one, and you'll see it when run restore headeronly: you made multiple backups to the same file.
You used backup command with noinit from SSMS, and the same file name, so now this file contains more than one backup, and restore headeronly will show them all.

Backup SQL Server database using WITH FORMAT

I'm having a bit of trouble understanding the purpose of the WITH FORMAT option of the SQL Server BACKUP DATABASE command.
Using the MSDN example:
USE AdventureWorks2012;
GO
BACKUP DATABASE AdventureWorks2012
TO DISK = 'Z:\SQLServerBackups\AdventureWorks2012.Bak'
WITH FORMAT,
MEDIANAME = 'Z_SQLServerBackups',
NAME = 'Full Backup of AdventureWorks2012';
GO
I understand this deletes any existing backups and creates a new one.
If I was to omit the WITH FORMAT line, and I already had a backup at Z:\SQLServerBackups\AdventureWorks2012.Bak, what does this mean to my backup?
Is it incremental or does it overwrite with a full one?
It's a full backup, essentially appended to the file if it exists already, you'll see a File number 2 reference when you run it, and you'll see the backup file double in size. Each backup is independent of each other and either can be restored.

Restore database in sql server

I have some sql server's backup file(format .bck). In my case, I do not know log file name.
So I can't use with move in restore command.
Is there anyway to restore database without move? If yes, please guide me.
I want to use like below one.
restore database testdb from disk = 'folderpath\aatest.bak'
You sure can know the log file name and use WITH MOVE. Use RESTORE FILELISTONLY to retrieve the list of database files (including log) from the backup first.

database restore failing with move

I am trying to restore a database backup but getting error:
Restore failed for Server 'ASIF-VAIO'.
(Microsoft.SqlServer.SmoExtended)
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: File 'C:\Program Files\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\uwa.mdf' is claimed by
'Aston_Fresh_log'(2) and 'Aston_Fresh'(1). The WITH MOVE clause can be
used to relocate one or more files. (Microsoft.SqlServer.Smo)
When restoring, you need to be sure to
pick a new database name that doesn't already exist (unless you want to overwrite that pre-existing database)
you tick the Overwrite option in the Options tab page and define valid and new file names for the .mdf and .ldf file so that you don't accidentally overwrite another database on your system:
This post has some excellent answers but I don't believe my solution was covered here, or I didn't understand the answer/comment.
However, when I encountered this error I was restoring a database with 2 indexes (Primary and Index). The issue was that when restoring it had created two .ndf files, one for each index, but had named them the same thing.
So essentially I had two "Restore As" files restoring to "D:\MSSQLDATA\DatabaseName.ndf.
To overcome this I had to change one of the file names, so for example I changed
Index | D:\MSSQLDATA\DatabaseName.ndf
Primary | D:\MSSQLDATA\DatabaseName1.ndf
having unique file names fixed this for me.
This worked for me : giving a different name to each MDF and LDF file in the script section.
MOVE N'R_Data'
TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Build51_Testing_db1.mdf',
MOVE N'R_audit'
TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Build51_Testing_db2.mdf',
etc...
Originally suggested by Alberto Morillo
I know it's long since the last answer, but I happened to search in google for solution for this problem.
What did it for me, was scripting the restore (changing file name did not do the trick) and manually changing the filenames in code
RESTORE DATABASE [DB_NAME]
FILE = N'[name]',
FILE = N'[name1]',
FILE = N'[name2]'
FROM DISK = N'[file_path]'
WITH FILE = 1m
MOVE N'[name]' TO N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\\[name].mdf',
MOVE N'[name1]' TO N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\\[name1].mdf',
MOVE N'[name2]' TO N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\\[name2].mdf',
MOVE N'[logname]' TO N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\\[logname].ldf'
NOUNLOAD,
REPLACE,
STATS = 10
GO
Regards
If you have this issue and it's not the above, try under the Restore Options > Files, check the Relocate all files to folder checkbox.
In my case, there was already a .mdf and .ldf file in my \DATA folder, so I had to create two new files:
New-Item C:\path\to\sql\DATA\NewDatabase.mdf
New-Item C:\path\to\sql\DATA\NewDatabase_log.ldf
And then in the SQL manager you need to select those new files when restoring the database.
In my case, the database has 2 mdf files. And the error came, because I'm trying to restore both mdf files as the same name.
Just rename the second mdf file, under "Restore As".

SQL Server 2005 backup and restore

I have two backup files
1) is named 'backup.sql' with a bunch of SQL defining TABLES
2) is named 'backup' with a bunch of encoded data, which I believe are the ROWS
I need to restore these TABLES + ROWS, but all I am able to figure out is how to restore the tables.
Any tips on dealing with these files? It's the first time I ever deal with SQL Server.
The backup process would not create a file with actual SQL statements, it would create a binary file. So #1 is not a backup file (it's probably a script someone saved to re-create the schema).
I would try to use SQL Server Management Studio to restore the second file and see what happens. I don't think it will allow you to restore an invalid file, but I would take some basic precautions like backing up the system first.
What is the extension for the 'backup' file? Is the filename backup.bak? If you have a backup file created by sql server then it 'should' contain the logic to create both the tables and restore the data, but it could depend on how the backup was created.
---Edit
It is possible for a .SQL file to contain data values as well as the logic to create the tables/columns for a database. I used to run backups of a MySql database in this way a long time ago...it just is not seen very often with SQL server since it has built in backup/restore funcationality.
Seems unlikely they would export all the rows from all tables into CSV file, and given you said it looks encrypted, it's making me think that's your actual backup file.
try this, save a copy of the "backup" file, rename it to backup.bak and run this from SQL Server Management Studio
restore filelistonly from disk='C:\backup.bak'
(assuming your file is saved on the root of the C: drive)
Any results/errors?