ms sql increases the required space in different restore tests - sql-server

I tried to restore a DB backup, the bak file is 65GB and restore requires 450GB.
The DB already exists in my sql.
There is not enough space on the disk (290GB), so i tried to drop my existing DB, create DB with a minimun initial space for its files. Now free space is 730GB.
I try to restore and now it requires 1TB!
Why?!
I didn't expect that to increase the space required. how can i solve?

Related

How to reduce log file size of MS SQL database

How to reduce log file size of MS SQL database. The requirement is to reduce log file of the version control server's DB, Shrinking is not an option in our case.
How to reduce log file size of MS SQL database
Shrinking is the only option here, but you need to clear out the log by backing it up first. Otherwise, there won't be any free space to shrink. After you shrink it once, you can keep it from getting blown out by either
Backing up your transaction logs more regularly. How often depends on your RPO
Setting the database to Simple Mode. This is only suggested if your RPO is large enough to where your FULL BACKUPs and DIFFERENTIALS would cover it.

SQL Server Copy database to different server

I'm trying to take a copy of a database into another server. I usually been making backup, copy the backup file to another server and restore it. But the backup is 90GB, and the space left after copying the backup to the destination folder is only 26GB. As you probably understand by now I'm not able to restore the database as it doesn't have enough space. So my question is is possible to restore database by replacing backup file? Any other suggestions? Increasing the disc space is not an option as this is just a testing server and the space will be enough after restoring. Thank you
Depending on your SQL Server version have you tried enabling compressing during backup. You would be surprised by how small the backup file can get after compression. Also if your database is set to SIMPLE recovery you could look to reduce the log file size before you backup.
You can find some steps on how to enable compression during backup here
https://sqlbak.com/blog/how-to-configure-backup-compression/

Could not allocate a new page for database because of insufficient disk space in filegroup

while running a program in SAS conected to SQL-server 2008 I am getting this ERROR in the log:
Execute error: ICommand::Execute failed. : The statement has been terminated.:
Could not allocate a new page for database 'databse' because of insufficient disk space in
filegroup 'CURRENT01'. Create the necessary space by dropping objects in the filegroup,
adding additional files to the filegroup, or setting autogrowth on for existing files in
the filegroup.
I am looking to similar problems and I can not really see the solution.
I am quite sure we have enough space in the database.
is it maybe anything related with the work? I am quite new with SQL server.
Thank you, in advance, for your help.
Check the settings of data file(s) in that file group. Most likely their upper size limit is capped in which case it does not matter if you have free space.
You can find these settings with Management Studio: right click the database -> Properties -> Files -> Column Autogrowth/Max Size.
You should also check that the database files are on the disk drive where you expect them to be.
For Errors like this, your database is taking disk space and not the space available to DB, this happens when you are doing bulk Insert operation (Mostly).
You can see it by clicking the database -> Properties -> Files -> Database - space available and size.
Try Dropping some tables and then release the space.

Insufficient disk space when restoring a small backup

I'm trying to restore a database from 32MB backup. I have 6GB available on my disk. When I'm trying to restore the backup it shows the insufficient disk space error. How is it possible that a 32MB backup requires more than 6GB of disk space?
Probably because the backup is compressed, or because there is a very large log file that doesn't need to be part of the backup itself, or because the data file itself has been cleaned out - the backup is only comprised of pages that contain data. But when restored, it still has to expand the data file to its original size, even if most of it is empty.
Show us what the size column says when you run:
RESTORE FILELISTONLY FROM DISK = '[path]\whatever.bak';
I had the same issue, I had a 800 MB database backup file which needed 320 GB free space to be restored in destination computer.
Turned out it was just because of database log file, to make sure log file is what caused the matter, right click on intended databse and click on properties, after that in General tab check Size of the database, if it's huge, go to the Files tab and navigate to the path of tfiles.
I ran Shrink command on database and on files through interface but it didn't help, following query saved me eventually:
ALTER DATABASE DataBase_Name SET RECOVERY SIMPLE;
GO
DBCC SHRINKFILE(DataBase_Name_log, 200);
GO
ALTER DATABASE DataBase_Name SET RECOVERY FULL;
GO
It means you have to run query on the database, then create a back file once again.
NB: As you see in the query above, Database recovery mode should be on Simple before SHRINKFILE be executed.
It's always good to double-check which disk you're restoring the mdf and the ldf to, maybe you're creating the files in a full disk, it could happen.
Other than that, I'd suggest restoring that backup in another place, have the files SHRINKed, and backing up it again for a desperate measure.
The other answers explain the reason for the error message but do not provide a solution to the problem. I had the same problem and this is the solution I found.
Plug in an external hard drive with a massive amount of space available, then move the .mdf and .ldf files to the external hard drive. This script can be used to move the files while restoring:
RESTORE DATABASE [MyDb] FROM DISK = N'C:\Data\Backup\MyDb_FULL.bak' WITH FILE = 1, MOVE N'MyDb' TO N'E:\Data\MyDb.mdf', MOVE N'MyDb_log' TO N'E:\Data\MyDb_log.ldf', NOUNLOAD, REPLACE, STATS = 5
Once the database restores successfully to the external drive, you have the option of shrinking the files and then moving them to your hard drive or wherever else you want them to be.

Abnormal termination of backup process due to the lesser available space in the hardisk for the backup file

I am using SQL Server 2000, Data stored in the database is Photo data and text data. I want to take backup of my database but i have a problem of abnormal termination of backup process due to the lesser available space in the hardisk for the backup file. I truncate the log file to create space but still the available space is lesser. How i can take backup of my database? Any answers will be appreciated.
I suggest a free utility named SqlBackupAndFTP (I'm not involved with them)
The backups are zipped so you can save space on disk.
Also, you can schedule and copy backups to a lan or remote site.
It's free for a maximum of two databases

Resources