I Have a Database with a transaction log file 31 Gb, and I have problem to
backup it.
I want decresea it but don't remember How.
LorenaHi,
It seems you have set recovery model for this database to FULL. In this
recovery model all the activity inside the
database is logged. So you have schedule a transaction log backup to clear
of the trasnaction logs. THis backup can
be used when a recovery is needed.
Show to set to simple
ALTER database <dbname> set recovery SIMPLE
How to clear the existing logs and shrink the file:-
Since the file is really huge, I recomment you to set the database to single
user model before doing the below steps.
-- Setting database single user.
Alter database <dbname> set single_user with rollback immediate
-- Truncate the transaction log
BACKUP log <dbname> with truncate_only
-- shrink the transacton log file
DBCC SHRINKFILE('logical_ldf_name',truncateon
ly)
After doing the above steps execute the below command to see the transaction
log size and usage.
DBCC SQLPERF(LOGSPACE)
-- Now set the database multi user
Alter database <dbname> set multi_user
Thanks
Hari
MCDBA
"Lorena" <Lorena@.discussions.microsoft.com> wrote in message
news:6B7189C4-2904-4000-BD28-1A89C8BA9866@.microsoft.com...
> I Have a Database with a transaction log file 31 Gb, and I have problem
to backup it.
> I want decresea it but don't remember How.
> Lorena
Showing posts with label transaction. Show all posts
Showing posts with label transaction. Show all posts
Wednesday, March 28, 2012
How Can I reduce my transacion log file?
How Can I reduce my transacion log file?
I Have a Database with a transaction log file 31 Gb, and I have problem to backup it.
I want decresea it but don't remember How.
Lorena
Hi,
It seems you have set recovery model for this database to FULL. In this
recovery model all the activity inside the
database is logged. So you have schedule a transaction log backup to clear
of the trasnaction logs. THis backup can
be used when a recovery is needed.
Show to set to simple
ALTER database <dbname> set recovery SIMPLE
How to clear the existing logs and shrink the file:-
Since the file is really huge, I recomment you to set the database to single
user model before doing the below steps.
-- Setting database single user.
Alter database <dbname> set single_user with rollback immediate
-- Truncate the transaction log
BACKUP log <dbname> with truncate_only
-- shrink the transacton log file
DBCC SHRINKFILE('logical_ldf_name',truncateonly)
After doing the above steps execute the below command to see the transaction
log size and usage.
DBCC SQLPERF(LOGSPACE)
-- Now set the database multi user
Alter database <dbname> set multi_user
Thanks
Hari
MCDBA
"Lorena" <Lorena@.discussions.microsoft.com> wrote in message
news:6B7189C4-2904-4000-BD28-1A89C8BA9866@.microsoft.com...
> I Have a Database with a transaction log file 31 Gb, and I have problem
to backup it.
> I want decresea it but don't remember How.
> Lorena
I want decresea it but don't remember How.
Lorena
Hi,
It seems you have set recovery model for this database to FULL. In this
recovery model all the activity inside the
database is logged. So you have schedule a transaction log backup to clear
of the trasnaction logs. THis backup can
be used when a recovery is needed.
Show to set to simple
ALTER database <dbname> set recovery SIMPLE
How to clear the existing logs and shrink the file:-
Since the file is really huge, I recomment you to set the database to single
user model before doing the below steps.
-- Setting database single user.
Alter database <dbname> set single_user with rollback immediate
-- Truncate the transaction log
BACKUP log <dbname> with truncate_only
-- shrink the transacton log file
DBCC SHRINKFILE('logical_ldf_name',truncateonly)
After doing the above steps execute the below command to see the transaction
log size and usage.
DBCC SQLPERF(LOGSPACE)
-- Now set the database multi user
Alter database <dbname> set multi_user
Thanks
Hari
MCDBA
"Lorena" <Lorena@.discussions.microsoft.com> wrote in message
news:6B7189C4-2904-4000-BD28-1A89C8BA9866@.microsoft.com...
> I Have a Database with a transaction log file 31 Gb, and I have problem
to backup it.
> I want decresea it but don't remember How.
> Lorena
How can I read the last commited record values while an other transaction is updating
The situation is like this:
I have a record in a table that I want to read and I want the last committed
version of it.
The problem is that another transaction is updating the record at the same
time in a verry long transaction. While this transaction is running I can
not read the record because it is locked. How can I read the current
commited values from this record without blocking?
I do not want to use READ UNCOMMITED isolation level because if the long
running transaction is rolled back than I would have read a uncommited
value.
This situation happens in a dotnet application using 2 SQLConnection classes
(and connections to the DB) to read and update the same record.
Thanks,
Sandor"Sandor Heese" <nospam@.hotmail.com> wrote in message
news:Ot2Iyf2HFHA.2156@.TK2MSFTNGP09.phx.gbl...
> The situation is like this:
> I have a record in a table that I want to read and I want the last
> committed version of it.
> The problem is that another transaction is updating the record at the same
> time in a verry long transaction. While this transaction is running I can
> not read the record because it is locked. How can I read the current
> commited values from this record without blocking?
> I do not want to use READ UNCOMMITED isolation level because if the long
> running transaction is rolled back than I would have read a uncommited
> value.
> This situation happens in a dotnet application using 2 SQLConnection
> classes (and connections to the DB) to read and update the same record.
>
First, why are you using 2 SqlConnections?
Second, no there is no way to read the last commited version of a locked
row. That is "snapshot isolation" and it's a new feature of SQL Server
2005. With SQL Server 2000 you must choose between reading the row after
it's commited, or read the dirty row.
David|||Thanks David for your comment.
I came to the same conclusion you did, but I did not want to beleave that it
was not possible :-)
I am using 2 connections because I can't do 2 transaction at the same time
over 1 SQLConnection.
In SQL Server 2005 this will be possible but not at the moment. (It is
always in the next version :-( )
Sandor
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:uUvhOo2HFHA.2564@.tk2msftngp13.phx.gbl...
> "Sandor Heese" <nospam@.hotmail.com> wrote in message
> news:Ot2Iyf2HFHA.2156@.TK2MSFTNGP09.phx.gbl...
> First, why are you using 2 SqlConnections?
> Second, no there is no way to read the last commited version of a locked
> row. That is "snapshot isolation" and it's a new feature of SQL Server
> 2005. With SQL Server 2000 you must choose between reading the row after
> it's commited, or read the dirty row.
> David
>
I have a record in a table that I want to read and I want the last committed
version of it.
The problem is that another transaction is updating the record at the same
time in a verry long transaction. While this transaction is running I can
not read the record because it is locked. How can I read the current
commited values from this record without blocking?
I do not want to use READ UNCOMMITED isolation level because if the long
running transaction is rolled back than I would have read a uncommited
value.
This situation happens in a dotnet application using 2 SQLConnection classes
(and connections to the DB) to read and update the same record.
Thanks,
Sandor"Sandor Heese" <nospam@.hotmail.com> wrote in message
news:Ot2Iyf2HFHA.2156@.TK2MSFTNGP09.phx.gbl...
> The situation is like this:
> I have a record in a table that I want to read and I want the last
> committed version of it.
> The problem is that another transaction is updating the record at the same
> time in a verry long transaction. While this transaction is running I can
> not read the record because it is locked. How can I read the current
> commited values from this record without blocking?
> I do not want to use READ UNCOMMITED isolation level because if the long
> running transaction is rolled back than I would have read a uncommited
> value.
> This situation happens in a dotnet application using 2 SQLConnection
> classes (and connections to the DB) to read and update the same record.
>
First, why are you using 2 SqlConnections?
Second, no there is no way to read the last commited version of a locked
row. That is "snapshot isolation" and it's a new feature of SQL Server
2005. With SQL Server 2000 you must choose between reading the row after
it's commited, or read the dirty row.
David|||Thanks David for your comment.
I came to the same conclusion you did, but I did not want to beleave that it
was not possible :-)
I am using 2 connections because I can't do 2 transaction at the same time
over 1 SQLConnection.
In SQL Server 2005 this will be possible but not at the moment. (It is
always in the next version :-( )
Sandor
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:uUvhOo2HFHA.2564@.tk2msftngp13.phx.gbl...
> "Sandor Heese" <nospam@.hotmail.com> wrote in message
> news:Ot2Iyf2HFHA.2156@.TK2MSFTNGP09.phx.gbl...
> First, why are you using 2 SqlConnections?
> Second, no there is no way to read the last commited version of a locked
> row. That is "snapshot isolation" and it's a new feature of SQL Server
> 2005. With SQL Server 2000 you must choose between reading the row after
> it's commited, or read the dirty row.
> David
>
How can I read the content of transaction log
How can I read the content of transaction log?How can I read the content of transaction log?
Use DBCC LOG to view Transaction log...
DBCC LOG
This command is used to view the transaction log for the specified database.
Syntax:
DBCC log ({dbid|dbname}, [, type={-1|0|1|2|3|4}])
where:
dbid or dbname - Enter either the dbid or the name of the database
type - is the type of output, and includes these options:
0 - minimum information (operation, context, transaction id)
1 - more information (plus flags, tags, row length, description)
2 - very detailed information (plus object name, index name, page id, slot id)
3 - full information about each operation
4 - full information about each operation plus hexadecimal dump of the current transaction log's row.
-1 - full information about each operation plus hexadecimal dump of the current transaction log's row, plus Checkpoint Begin, DB Version, Max XDESID
by default, type = 0
To view the transaction log for the master database, run the following command:
DBCC log (master)
to understand transaction log see this ...Link (http://www.windowsitlibrary.com/Content/77/21/1.html)|||Thanks :-)
Use DBCC LOG to view Transaction log...
DBCC LOG
This command is used to view the transaction log for the specified database.
Syntax:
DBCC log ({dbid|dbname}, [, type={-1|0|1|2|3|4}])
where:
dbid or dbname - Enter either the dbid or the name of the database
type - is the type of output, and includes these options:
0 - minimum information (operation, context, transaction id)
1 - more information (plus flags, tags, row length, description)
2 - very detailed information (plus object name, index name, page id, slot id)
3 - full information about each operation
4 - full information about each operation plus hexadecimal dump of the current transaction log's row.
-1 - full information about each operation plus hexadecimal dump of the current transaction log's row, plus Checkpoint Begin, DB Version, Max XDESID
by default, type = 0
To view the transaction log for the master database, run the following command:
DBCC log (master)
to understand transaction log see this ...Link (http://www.windowsitlibrary.com/Content/77/21/1.html)|||Thanks :-)
Subscribe to:
Posts (Atom)