Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Sunday, March 25, 2012

Backup solution - question about transaction log

I've just inherited (i.e., our sys admin / DBA left the company) a fairly small SQL Server that's running 7 production databases. Most are quite small, but there are two which are about 40gb each. Traffic is quite low - ~30-40 users at one time doing your basic SELECT / UPDATE / INSERT stuff.

Anyway, I was going through some of the backups jobs and noticed that the transaction logs for each database were absolutely huge (in some cases bigger than the DB itself) which led me to think the log wasn't getting truncated.

The T-SQL being run in each case was

Currently, the transaction log for 6 DBs is backed up 3 times a day (and the 7th, "mission critical" DB is backed up every 15 minutes) with the following T-SQL:

BACKUP LOG <database> to <device> WITH NOINIT, NOFORMAT, NOSKIP, NOUNLOAD

5 of the 7 databases get a full backup twice a day, with the 2 larger ones getting a differential, with e.g.,

BACKUP DATABASE <database> TO <device> WITH NOINIT , NOUNLOAD , NAME = N'db', NOSKIP , STATS = 10, DESCRIPTION = N'db', NOFORMAT , MEDIANAME = N'db'DECLARE @.i INT
select @.i = position from msdb..backupset where database_name='db'and type!='F' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name='db')
RESTORE VERIFYONLY FROM <device> WITH FILE = @.i

This is then backed up to tape each night.

Looking through the documentation, those WITH commands are largely the default settings so I'm not sure why they're specified explicitly.

If I issue a

BACKUP LOG <database> to <device> WITH INIT, SKIP

then the log does get truncated. However, could someone explain the implications of that for me? As I understand it, INIT will overwrite any existing sets in the device, but considering that it will always backup anything that hasn't been committed then should it be a problem?

Alternatively could someone perhaps explain why the log wasn't getting truncated? It is my understanding that this should happen every time a full backup is completed... which is twice a day. Or does the Transaction log need to be manually shrunk every now and then?

Also, I understand the DECLARE... part in the last part of that DB backup SQL, but is it at all necessary?

Finally, does this backup strategy seem viable? Any thoughts and comments are appreciated!
Matt

By default in the backup database command if you do not specify anything it will append ,eg...

backup database xxxx to disk='F:\test\xxxx.bak' and check the bak file size

now again reissue the same command,

backup database xxxx to disk='F:\test\xxxx.bak' and once again check the bak file size.......it will be double the size

next time issue the same command using WITH INIT option,

backup database xxxx to disk='F:\test\xxxx.bak' WITH INIT now see the bak file size it will be the same size as in 1st case.........if you do not specify anything SQL server will use the default With NOINIT option..........so you need to specify them explicitly if you needed to overwrite........

the log gets truncated if you specify the command,

backup log dbname with truncate_only.........this command will be depreciated in future versions........once you issue this comand, all the committed transactions will be rolled forward and written to data file and uncommitted trans will be rolled back.......

since you have a mission critical db i suggest you go for Log shipping or Database mirroring in sql 2005.........instead of relying on your db backups.........if you have sufficient disk space go for full backup and if you feel the db is important and if you want to have db consistency you can have tran log backups and differential backups else not required........

|||Am I right about when the transaction log should get truncated - i.e., on a full database backup?|||

You are right, that the transaction log should be truncated after a full backup. However, note that the contents of the log will be truncated and the physical file will maintain its size. Therefore, you may see a large transaction log file although it won't be full. In order to reduce the size of the file, you'll need to run some form of SHRINKFILE operation.

HTH!

Sunday, March 11, 2012

Backup policy for a newbies?

Hi,
I always used SQL server as a developper. I never think about backup Restore
policy. Now a collegue is asking me the best solution. I had this issue when
I was a mainframe programmer, but now ...
I suggest him to do as followed ;monthly or weekly.
Full - Logs - Differential - logs - Differentials - ...
He just agree with my suggestion but let me knows that the logs backup are
growing and growing.
I am quite sure that the solution is to "inform" sql server 2005 that I have
kept a full or diffrential backup and he can scrash his log file and begin a
new one.
Am I wrong and if not, how say to msssql server 2005 that he can begein a
new log file and free the unnecessary space?
Thanks for your help.
Patrick
SQL Server do not work as many of the other products...

> I am quite sure that the solution is to "inform" sql server 2005 that I have
> kept a full or diffrential backup and he can scrash his log file and begin a
> new one.
What log file do you refer to? The file where you backup the log (like .bak) or the "active"
database log file (.ldf).
For the ldf file: No need to inform anything. SQL Server understands that you did a log backup and
will basically empty the ldf file. More information available at
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
For the backup file. SQL Server does not assumes anything. You control whether you want to overwrite
or append using the INIT or NOINIT parameter.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Patrick Sandron" <PatrickSandron@.discussions.microsoft.com> wrote in message
news:79555DF4-0A4E-496F-8736-4350AD2A93BB@.microsoft.com...
> Hi,
> I always used SQL server as a developper. I never think about backup Restore
> policy. Now a collegue is asking me the best solution. I had this issue when
> I was a mainframe programmer, but now ...
> I suggest him to do as followed ;monthly or weekly.
> Full - Logs - Differential - logs - Differentials - ...
> He just agree with my suggestion but let me knows that the logs backup are
> growing and growing.
> I am quite sure that the solution is to "inform" sql server 2005 that I have
> kept a full or diffrential backup and he can scrash his log file and begin a
> new one.
> Am I wrong and if not, how say to msssql server 2005 that he can begein a
> new log file and free the unnecessary space?
> Thanks for your help.
> Patrick
|||Hi
[url]http://vyaskn.tripod.com/sql_server_administration_best_practices.htm#Step1 [/url]
--administaiting best practices
"Patrick Sandron" <PatrickSandron@.discussions.microsoft.com> wrote in
message news:79555DF4-0A4E-496F-8736-4350AD2A93BB@.microsoft.com...
> Hi,
> I always used SQL server as a developper. I never think about backup
> Restore
> policy. Now a collegue is asking me the best solution. I had this issue
> when
> I was a mainframe programmer, but now ...
> I suggest him to do as followed ;monthly or weekly.
> Full - Logs - Differential - logs - Differentials - ...
> He just agree with my suggestion but let me knows that the logs backup are
> growing and growing.
> I am quite sure that the solution is to "inform" sql server 2005 that I
> have
> kept a full or diffrential backup and he can scrash his log file and begin
> a
> new one.
> Am I wrong and if not, how say to msssql server 2005 that he can begein a
> new log file and free the unnecessary space?
> Thanks for your help.
> Patrick

Backup policy for a newbies?

Hi,
I always used SQL server as a developper. I never think about backup Restore
policy. Now a collegue is asking me the best solution. I had this issue when
I was a mainframe programmer, but now ...
I suggest him to do as followed ;monthly or weekly.
Full - Logs - Differential - logs - Differentials - ...
He just agree with my suggestion but let me knows that the logs backup are
growing and growing.
I am quite sure that the solution is to "inform" sql server 2005 that I have
kept a full or diffrential backup and he can scrash his log file and begin a
new one.
Am I wrong and if not, how say to msssql server 2005 that he can begein a
new log file and free the unnecessary space?
Thanks for your help.
PatrickSQL Server do not work as many of the other products...
> I am quite sure that the solution is to "inform" sql server 2005 that I have
> kept a full or diffrential backup and he can scrash his log file and begin a
> new one.
What log file do you refer to? The file where you backup the log (like .bak) or the "active"
database log file (.ldf).
For the ldf file: No need to inform anything. SQL Server understands that you did a log backup and
will basically empty the ldf file. More information available at
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
For the backup file. SQL Server does not assumes anything. You control whether you want to overwrite
or append using the INIT or NOINIT parameter.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Patrick Sandron" <PatrickSandron@.discussions.microsoft.com> wrote in message
news:79555DF4-0A4E-496F-8736-4350AD2A93BB@.microsoft.com...
> Hi,
> I always used SQL server as a developper. I never think about backup Restore
> policy. Now a collegue is asking me the best solution. I had this issue when
> I was a mainframe programmer, but now ...
> I suggest him to do as followed ;monthly or weekly.
> Full - Logs - Differential - logs - Differentials - ...
> He just agree with my suggestion but let me knows that the logs backup are
> growing and growing.
> I am quite sure that the solution is to "inform" sql server 2005 that I have
> kept a full or diffrential backup and he can scrash his log file and begin a
> new one.
> Am I wrong and if not, how say to msssql server 2005 that he can begein a
> new log file and free the unnecessary space?
> Thanks for your help.
> Patrick|||Hi
http://vyaskn.tripod.com/sql_server_administration_best_practices.htm#Step1
--administaiting best practices
"Patrick Sandron" <PatrickSandron@.discussions.microsoft.com> wrote in
message news:79555DF4-0A4E-496F-8736-4350AD2A93BB@.microsoft.com...
> Hi,
> I always used SQL server as a developper. I never think about backup
> Restore
> policy. Now a collegue is asking me the best solution. I had this issue
> when
> I was a mainframe programmer, but now ...
> I suggest him to do as followed ;monthly or weekly.
> Full - Logs - Differential - logs - Differentials - ...
> He just agree with my suggestion but let me knows that the logs backup are
> growing and growing.
> I am quite sure that the solution is to "inform" sql server 2005 that I
> have
> kept a full or diffrential backup and he can scrash his log file and begin
> a
> new one.
> Am I wrong and if not, how say to msssql server 2005 that he can begein a
> new log file and free the unnecessary space?
> Thanks for your help.
> Patrick

Backup policy for a newbies?

Hi,
I always used SQL server as a developper. I never think about backup Restore
policy. Now a collegue is asking me the best solution. I had this issue when
I was a mainframe programmer, but now ...
I suggest him to do as followed ;monthly or weekly.
Full - Logs - Differential - logs - Differentials - ...
He just agree with my suggestion but let me knows that the logs backup are
growing and growing.
I am quite sure that the solution is to "inform" sql server 2005 that I have
kept a full or diffrential backup and he can scrash his log file and begin a
new one.
Am I wrong and if not, how say to msssql server 2005 that he can begein a
new log file and free the unnecessary space?
Thanks for your help.
PatrickSQL Server do not work as many of the other products...

> I am quite sure that the solution is to "inform" sql server 2005 that I ha
ve
> kept a full or diffrential backup and he can scrash his log file and begin
a
> new one.
What log file do you refer to? The file where you backup the log (like .bak)
or the "active"
database log file (.ldf).
For the ldf file: No need to inform anything. SQL Server understands that yo
u did a log backup and
will basically empty the ldf file. More information available at
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
For the backup file. SQL Server does not assumes anything. You control wheth
er you want to overwrite
or append using the INIT or NOINIT parameter.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Patrick Sandron" <PatrickSandron@.discussions.microsoft.com> wrote in messag
e
news:79555DF4-0A4E-496F-8736-4350AD2A93BB@.microsoft.com...
> Hi,
> I always used SQL server as a developper. I never think about backup Resto
re
> policy. Now a collegue is asking me the best solution. I had this issue wh
en
> I was a mainframe programmer, but now ...
> I suggest him to do as followed ;monthly or weekly.
> Full - Logs - Differential - logs - Differentials - ...
> He just agree with my suggestion but let me knows that the logs backup are
> growing and growing.
> I am quite sure that the solution is to "inform" sql server 2005 that I ha
ve
> kept a full or diffrential backup and he can scrash his log file and begin
a
> new one.
> Am I wrong and if not, how say to msssql server 2005 that he can begein a
> new log file and free the unnecessary space?
> Thanks for your help.
> Patrick|||Hi
http://vyaskn.tripod.com/ sql_serve...r />
.htm#Step1
--administaiting best practices
"Patrick Sandron" <PatrickSandron@.discussions.microsoft.com> wrote in
message news:79555DF4-0A4E-496F-8736-4350AD2A93BB@.microsoft.com...
> Hi,
> I always used SQL server as a developper. I never think about backup
> Restore
> policy. Now a collegue is asking me the best solution. I had this issue
> when
> I was a mainframe programmer, but now ...
> I suggest him to do as followed ;monthly or weekly.
> Full - Logs - Differential - logs - Differentials - ...
> He just agree with my suggestion but let me knows that the logs backup are
> growing and growing.
> I am quite sure that the solution is to "inform" sql server 2005 that I
> have
> kept a full or diffrential backup and he can scrash his log file and begin
> a
> new one.
> Am I wrong and if not, how say to msssql server 2005 that he can begein a
> new log file and free the unnecessary space?
> Thanks for your help.
> Patrick

Thursday, March 8, 2012

Backup permissions

Hi,
We use Data Protector from HP for enterprise backup solution. I don't want
that the backup team, backup SQL Server databases with a sysadmin Account.
So, i gave the HP NT Account used db_backupoperator rights in all databases.
The backup fails. I looked with profiler and i've an exception when the HP
tool tries to run dbcc showfilestats( 1 ). Why the backupoperator don't have
permissions to run dbcc ?
http://msdn.microsoft.com/library/d...br />
8odw.asp
Can i grant dbcc rights on that user ?
How can i resolve my problem? i will have always a strong account outside my
scoup.
Thanks in advance,
CMLCI have never used dbcc showfilestats. I have never even heard of dbcc
showfilestats. I could not find it within Books Online, so I am guessing
that it is one of those undocumented commands that should be used with
caution. By the way, I did find several hits when I Googled for it.
I doubt that you can grant execute rights on that DBCC. I spot checked a
few other DBCCs (that are documented within Books Online) and all of the
commands that I checked indicated that they were not transferrable.
I would encourage you to contact HP about their backup solution. Ask them
why they use an undocumented command. Also, encourage them to use standard
commands. Perhaps they could replace the DBCC call with a call to RESTORE
FILELISTONLY or RESTORE HEADERONLY.
Keith
"CMLC" <CMLC@.discussions.microsoft.com> wrote in message
news:1A38A305-4434-4CF1-BBD0-600A4D6801C4@.microsoft.com...
> Hi,
> We use Data Protector from HP for enterprise backup solution. I don't want
> that the backup team, backup SQL Server databases with a sysadmin Account.
> So, i gave the HP NT Account used db_backupoperator rights in all
databases.
> The backup fails. I looked with profiler and i've an exception when the HP
> tool tries to run dbcc showfilestats( 1 ). Why the backupoperator don't
have
> permissions to run dbcc ?
>
http://msdn.microsoft.com/library/d..._ga-gz_8odw.asp[v
bcol=seagreen]
> Can i grant dbcc rights on that user ?
> How can i resolve my problem? i will have always a strong account outside[/vbcol]
my
> scoup.
> Thanks in advance,
> CMLC
>

Backup permissions

Hi,
We use Data Protector from HP for enterprise backup solution. I don't want
that the backup team, backup SQL Server databases with a sysadmin Account.
So, i gave the HP NT Account used db_backupoperator rights in all databases.
The backup fails. I looked with profiler and i've an exception when the HP
tool tries to run dbcc showfilestats( 1 ). Why the backupoperator don't have
permissions to run dbcc ?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ga-gz_8odw.asp
Can i grant dbcc rights on that user ?
How can i resolve my problem? i will have always a strong account outside my
scoup.
Thanks in advance,
CMLCI have never used dbcc showfilestats. I have never even heard of dbcc
showfilestats. I could not find it within Books Online, so I am guessing
that it is one of those undocumented commands that should be used with
caution. By the way, I did find several hits when I Googled for it.
I doubt that you can grant execute rights on that DBCC. I spot checked a
few other DBCCs (that are documented within Books Online) and all of the
commands that I checked indicated that they were not transferrable.
I would encourage you to contact HP about their backup solution. Ask them
why they use an undocumented command. Also, encourage them to use standard
commands. Perhaps they could replace the DBCC call with a call to RESTORE
FILELISTONLY or RESTORE HEADERONLY.
--
Keith
"CMLC" <CMLC@.discussions.microsoft.com> wrote in message
news:1A38A305-4434-4CF1-BBD0-600A4D6801C4@.microsoft.com...
> Hi,
> We use Data Protector from HP for enterprise backup solution. I don't want
> that the backup team, backup SQL Server databases with a sysadmin Account.
> So, i gave the HP NT Account used db_backupoperator rights in all
databases.
> The backup fails. I looked with profiler and i've an exception when the HP
> tool tries to run dbcc showfilestats( 1 ). Why the backupoperator don't
have
> permissions to run dbcc ?
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ga-gz_8odw.asp
> Can i grant dbcc rights on that user ?
> How can i resolve my problem? i will have always a strong account outside
my
> scoup.
> Thanks in advance,
> CMLC
>

Backup permissions

Hi,
We use Data Protector from HP for enterprise backup solution. I don't want
that the backup team, backup SQL Server databases with a sysadmin Account.
So, i gave the HP NT Account used db_backupoperator rights in all databases.
The backup fails. I looked with profiler and i've an exception when the HP
tool tries to run dbcc showfilestats( 1 ). Why the backupoperator don't have
permissions to run dbcc ?
http://msdn.microsoft.com/library/de...ga-gz_8odw.asp
Can i grant dbcc rights on that user ?
How can i resolve my problem? i will have always a strong account outside my
scoup.
Thanks in advance,
CMLC
I have never used dbcc showfilestats. I have never even heard of dbcc
showfilestats. I could not find it within Books Online, so I am guessing
that it is one of those undocumented commands that should be used with
caution. By the way, I did find several hits when I Googled for it.
I doubt that you can grant execute rights on that DBCC. I spot checked a
few other DBCCs (that are documented within Books Online) and all of the
commands that I checked indicated that they were not transferrable.
I would encourage you to contact HP about their backup solution. Ask them
why they use an undocumented command. Also, encourage them to use standard
commands. Perhaps they could replace the DBCC call with a call to RESTORE
FILELISTONLY or RESTORE HEADERONLY.
Keith
"CMLC" <CMLC@.discussions.microsoft.com> wrote in message
news:1A38A305-4434-4CF1-BBD0-600A4D6801C4@.microsoft.com...
> Hi,
> We use Data Protector from HP for enterprise backup solution. I don't want
> that the backup team, backup SQL Server databases with a sysadmin Account.
> So, i gave the HP NT Account used db_backupoperator rights in all
databases.
> The backup fails. I looked with profiler and i've an exception when the HP
> tool tries to run dbcc showfilestats( 1 ). Why the backupoperator don't
have
> permissions to run dbcc ?
>
http://msdn.microsoft.com/library/de...ga-gz_8odw.asp
> Can i grant dbcc rights on that user ?
> How can i resolve my problem? i will have always a strong account outside
my
> scoup.
> Thanks in advance,
> CMLC
>

Saturday, February 25, 2012

Backup of mirrored databases using TSM

Hi,

I currently have 2 mirrored servers and would like to implement a backup solution using an existing TSM server. The first thing that comes to mind is using the TSM client or Litespeed by Quest, but I'd like to know the effects of performing backups on principal and mirrored servers first.

Will using one of these products cause errors or problems should the backup client try to backup a mirrored database? Can anyone make any recommendations on the effects of using TSM client or Litespeed for a mirrored environment?

Thanks.

That depends on how you would like to do the restore process. The restore process will dictate how you may want to do your backups and not the other way around. In our case we just use the native SQL Server agent to generate the backup files and have TSM to pick up the backup files. This is a disadvantage if your backing up terrabytes of data. In this case, LightSpeed will help decrease backup time.|||

Obviously, if you back up the principal while it is under heavy load, it will compete for resources. Backup tends to consume all available IO bandwidth, but not much CPU.

At the present time, you cannot back up a mirror database. Yes, I know, you want to, and we'll get to it, but not now.

Log backups will not interfere with mirroring as they would in a log-shipping environment, so that is not an issue.

Is there anything else you are concerned about?

|||

Sorry for the delay in my reply. Both of your suggestions were helpful and will consider all my options.
Thanks.

Backup of mirrored databases using TSM

Hi,

I currently have 2 mirrored servers and would like to implement a backup solution using an existing TSM server. The first thing that comes to mind is using the TSM client or Litespeed by Quest, but I'd like to know the effects of performing backups on principal and mirrored servers first.

Will using one of these products cause errors or problems should the backup client try to backup a mirrored database? Can anyone make any recommendations on the effects of using TSM client or Litespeed for a mirrored environment?

Thanks.

That depends on how you would like to do the restore process. The restore process will dictate how you may want to do your backups and not the other way around. In our case we just use the native SQL Server agent to generate the backup files and have TSM to pick up the backup files. This is a disadvantage if your backing up terrabytes of data. In this case, LightSpeed will help decrease backup time.|||

Obviously, if you back up the principal while it is under heavy load, it will compete for resources. Backup tends to consume all available IO bandwidth, but not much CPU.

At the present time, you cannot back up a mirror database. Yes, I know, you want to, and we'll get to it, but not now.

Log backups will not interfere with mirroring as they would in a log-shipping environment, so that is not an issue.

Is there anything else you are concerned about?

|||

Sorry for the delay in my reply. Both of your suggestions were helpful and will consider all my options.
Thanks.