Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

SQL Server transaction log backup procedure using batch file. Expand / Collapse
Author
Message
Posted Sunday, June 16, 2013 4:36 AM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Sunday, March 30, 2014 12:37 AM
Points: 64, Visits: 232
I think when i perform transaction log backup it will be in format:

backup log databasename to disk='Path.trn'

When we perform regular log backup like in 15 mins OR 5 mins basis then what i observed is always transaction log file is smaller in size.

Append will work in full backup.

thnx.......reply
Post #1463937
Posted Sunday, June 16, 2013 4:48 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 21, 2014 6:12 AM
Points: 191, Visits: 634
Append will work in transaction log too using the WITH NOINIT. The default is also append. You must be looking at something different. Easy way to see it:
 create table dird (colA char(100))

BACKUP LOG ReplicationDB to disk='D:\tlog.bak'

with t1 as (select 'aaa' colA union all select 'aaa' union all select 'aaa' union all select 'aaa' union all
select 'aaa' union all select 'aaa' union all select 'aaa' union all select 'aaa' union all
select 'aaa' colA union all select 'aaa'),
t2 as (select t.colA from t1 t, t1 b),
t3 as (select t.colA from t2 t, t2 a, t2 b)
insert into dird select * from t3

BACKUP LOG ReplicationDB to disk='D:\tlog.bak'

delete from dird

BACKUP LOG ReplicationDB to disk='D:\tlog.bak'

with t1 as (select 'aaa' colA union all select 'aaa' union all select 'aaa' union all select 'aaa' union all
select 'aaa' union all select 'aaa' union all select 'aaa' union all select 'aaa' union all
select 'aaa' colA union all select 'aaa'),
t2 as (select t.colA from t1 t, t1 b)
insert into dird select * from t2

BACKUP LOG ReplicationDB to disk='D:\tlog.bak'

The size of the tlog backup continues to increase. Even though the last one only inserts 100 rows.



Dird // Junior DBA
11g OCA
10.5 newbie
Post #1463940
Posted Sunday, June 16, 2013 4:52 AM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Sunday, March 30, 2014 12:37 AM
Points: 64, Visits: 232
when i perform transaction log backup which is in format:

backup log databasename to disk='path.trn'


When we perform transaction log backup regularly it size get smaller and in full backup we do "with init" i.e. overwrite OR 'with noinit" i.e. append.

My main motto is in express edition how to schedule transaction log backup using Windows task scheduler which will be scheduled and using batch file in which all command will be present.


thnx...........reply
Post #1463941
Posted Sunday, June 16, 2013 5:29 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 21, 2014 6:12 AM
Points: 191, Visits: 634
I have already given you everything to handle a 15 minute transaction log backup. Just specify WITH NOINIT and see how it goes.


Dird // Junior DBA
11g OCA
10.5 newbie
Post #1463943
Posted Sunday, June 16, 2013 5:39 AM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Sunday, March 30, 2014 12:37 AM
Points: 64, Visits: 232
If any problem occurs i will post u msg in this post only.

thnx......Dird
Post #1463945
Posted Sunday, June 16, 2013 5:44 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 21, 2014 6:12 AM
Points: 191, Visits: 634
OK. good luck


Dird // Junior DBA
11g OCA
10.5 newbie
Post #1463946
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse