![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
On my development machine: database_size = 17.4 Mb unallocated_space = 1.9 Mb data + index_size tables = 16.2 Mb So the log files are 1.2 Mb On my production machine: database_size = 18.9 Mb unallocated_space = 2.4 Mb data + index_size tables = 4.3 Mb So the log files are 14.6 Mb This is a big differences, does this come that my provider has reserved so much empty space for the log files? How do I shrink the database in a way that I can still do backup and recovery. |
|
How do I get a listing of the names (+sizes) of all the log files including transaction logs. |
#4
| |||
| |||
|
|
You don't. 19 MB is an extremely small database, and there is no reason to shrink it. How do I get a listing of the names (+sizes) of all the log files including transaction logs. sp_helpdb <yourdb>. |
#5
| |||
| |||
|
|
Dear Sir, On 26 feb, 00:27, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote: You don't. 19 MB is an extremely small database, and there is no reason to shrink it. How do I get a listing of the names (+sizes) of all the log files including transaction logs. sp_helpdb <yourdb>. OUTPUT: name db_size owner dbid created status compatibility_level db_satoconor 18.94 MB sa 61 Sep 26 2008 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=611, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics, IsFullTextEnabled 90 name fileid filename filegroup size maxsize growth usage db_satoconor 1 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor.mdf PRIMARY 18624 KB Unlimited 1024 KB data only db_satoconor_log 2 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor_log.LDF 768 KB 2147483648 KB 10% log only Can I shrink, the 19 Mb DB to 5 Mb that is required for the data, this way: DBCC SHRINKFILE DB_SATOCONOR.MDF TRUNCATEONLY, without losing data and still be able to do backup and recovery? This is important because I only got 100 Mb webspace, including the DB, at my hosting provider so every MB counts! Kind regards, Johan van der Galien. |
#6
| |||
| |||
|
|
Shrink does not affect your backup options and will not cause data loss. But don't specify the TRUNCATEONLY option. |
|
-- Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi gali... (AT) zonnet (DOT) nl> wrote in message news:3ad956bd-f235-47c7-a506-66c1f38458cf (AT) v38g2000yqb (DOT) googlegroups.com... Dear Sir, On 26 feb, 00:27, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote: You don't. 19 MB is an extremely small database, and there is no reason to shrink it. How do I get a listing of the names (+sizes) of all the log files including transaction logs. sp_helpdb <yourdb>. OUTPUT: name db_size owner dbid created status compatibility_level db_satoconor 18.94 MB sa 61 Sep 26 2008 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=611, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics, IsFullTextEnabled 90 name fileid filename filegroup size maxsize growth usage db_satoconor 1 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor.mdf PRIMARY 18624 KB Unlimited 1024 KB data only db_satoconor_log 2 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor_log.LDF * 768 KB 2147483648 KB 10% log only Can I shrink, the 19 Mb DB to 5 Mb that is required for the data, this way: DBCC SHRINKFILE DB_SATOCONOR.MDF TRUNCATEONLY, without losing data and still be able to do backup and recovery? This is important because I only got 100 Mb webspace, including the DB, at my hosting provider so every MB counts! Kind regards, Johan van der Galien.- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - |
#7
| |||
| |||
|
|
Shrink does not affect your backup options and will not cause data loss. But don't specify the TRUNCATEONLY option. |
|
-- Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi gali... (AT) zonnet (DOT) nl> wrote in message news:3ad956bd-f235-47c7-a506-66c1f38458cf (AT) v38g2000yqb (DOT) googlegroups.com... Dear Sir, On 26 feb, 00:27, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote: You don't. 19 MB is an extremely small database, and there is no reason to shrink it. How do I get a listing of the names (+sizes) of all the log files including transaction logs. sp_helpdb <yourdb>. OUTPUT: name db_size owner dbid created status compatibility_level db_satoconor 18.94 MB sa 61 Sep 26 2008 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=611, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics, IsFullTextEnabled 90 name fileid filename filegroup size maxsize growth usage db_satoconor 1 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor.mdf PRIMARY 18624 KB Unlimited 1024 KB data only db_satoconor_log 2 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor_log.LDF 768 KB 2147483648 KB 10% log only Can I shrink, the 19 Mb DB to 5 Mb that is required for the data, this way: DBCC SHRINKFILE DB_SATOCONOR.MDF TRUNCATEONLY, without losing data and still be able to do backup and recovery? This is important because I only got 100 Mb webspace, including the DB, at my hosting provider so every MB counts! Kind regards, Johan van der Galien.- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - |
#8
| |||
| |||
|
|
Shrink does not affect your backup options and will not cause data loss. But don't specify the TRUNCATEONLY option. |
|
-- Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi gali... (AT) zonnet (DOT) nl> wrote in message news:3ad956bd-f235-47c7-a506-66c1f38458cf (AT) v38g2000yqb (DOT) googlegroups.com... Dear Sir, On 26 feb, 00:27, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote: You don't. 19 MB is an extremely small database, and there is no reason to shrink it. How do I get a listing of the names (+sizes) of all the log files including transaction logs. sp_helpdb <yourdb>. OUTPUT: name db_size owner dbid created status compatibility_level db_satoconor 18.94 MB sa 61 Sep 26 2008 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=611, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics, IsFullTextEnabled 90 name fileid filename filegroup size maxsize growth usage db_satoconor 1 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor.mdf PRIMARY 18624 KB Unlimited 1024 KB data only db_satoconor_log 2 G:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA \db_satoconor_log.LDF 768 KB 2147483648 KB 10% log only Can I shrink, the 19 Mb DB to 5 Mb that is required for the data, this way: DBCC SHRINKFILE DB_SATOCONOR.MDF TRUNCATEONLY, without losing data and still be able to do backup and recovery? This is important because I only got 100 Mb webspace, including the DB, at my hosting provider so every MB counts! Kind regards, Johan van der Galien.- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - |
#9
| |||
| |||
|
|
Are you doing transaction log backups? If not, the transaction log cannot release the used log portion because it's still in-use. |
#10
| |||
| |||
|
|
I tried: DBCC SHRINKFILE(db_satoconor,6) and it still stays at around 19 Mb! I am curious why a mdf file that contains only about 4 Mb data stays so recalcitrant at around 18 Mb? There is somehow a lot of empty space reserved in the file? How can I get rid of the empty space? And get my DB back to around 5 MB as it should be?! |
![]() |
| Thread Tools | |
| Display Modes | |
| |