Discover view sql server transaction log, include the articles, news, trends, analysis and practical advice about view sql server transaction log on alibabacloud.com
databases.-- The Instance name is RemoteServer. The local and remote databases submit or roll back the transaction at the same time.-- Note that four naming rules are used for executing distributed queries or calling stored procedures.
-- Prerequisite: the MSDTC Service on the local machine and the MSDTC Service on the remote machine must be enabled.-- The local machine and remote machine can ping each other-- Database ports can be telnet to each oth
to specify the name of the maintenance plan. Finish to start the log shipping creation.
Monitor
1. After the log shipping is created, the information associated with log shipping is stored in the 7 tables in msdb:
Log_shipping_plans
Log_shipping_plan_databases
Log_shipping_databases
Log_shipping_plan_history
Log_shipping_monitor
Log_shipping_primaries
Log
SQL Server lock mechanism (I) Overview (lock type and scope) SQL Server lock mechanism (ii) Overview (Lock compatibility and lockable resources) this article introduces the SQL Server lock mechanism (iii) Overview (lock and
employees with a salary of 5000, and the number of transaction a reading of all salaries is 5000 to 10.
Now
Transaction B Inserts a record of 5000 of the salary.
This is, transaction a reads again the employee with a salary of 5000, record is 11 person. Phantom reads are generated at this time.
The key to non-repeatable reads is to modify:The same condition,
actual database and backup copy to ensure consistency Click OK to start the backup backup is complete, you can view it, openunder SQL Server Management Studio, under Object Explorer, expand Backup devices under Server objects, right-click the device Select the Properties option, and see our backup on the Media content
, PersonName)Values ('1', 'name1 ')Insert Into Person (PersonId, PersonName)Values ('3', 'name3 ')Commit TransAction/*Select values include '1', 'name1', and '3', 'name3 ',This indicates that only the error in the second sentence has been canceled.*/
Method 1 for all rollback: Open XACT_ABORT
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Use TestDB
SET XACT_ABORT ON -- open
Begin
')
GO 2 rollback Cases --the simplest rollback
--The following statements can be executed separately, one line at a time
BEGIN TRAN --open transaction, set transaction start point
/*The command was successfully completed. */
SELECT * fromscore/*(0 rows affected) Description: Because there is no data in the table, the query returns the number of bars to 0.*/
INSERT intoScoreVALUES(101, -)--Insert da
shipping is enabled and configured by exiting the database properties ! 10. You can now see that the secondary database is created and is " restoring ..." Status, 4 related jobs are also created and running, and log shipping configuration is complete! 11. To view the current execution of log shipping, you can use the system to bring your own report to
Copy Code code as follows:
DECLARE @name VARCHAR (25)
DECLARE @SQL VARCHAR (1000)
DECLARE @logid INT
DECLARE sysdatabase_name CURSOR for SELECT name from master.dbo.sysdatabases
OPEN Sysdatabase_name
FETCH NEXT from Sysdatabase_name into @name
While @ @FETCH_STATUS = 0
BEGIN
IF (@name not in (' xxx ')-database name that does not require log shrinkage
BEGIN
DBCC LoginfoDBCC log (' Qssys ', type=2)GoSELECT * from Sys.fn_dblog (null,null)Select [Dirty pages],[minimum lsn],[checkpoint end],[chkpt Begin DB version],[checkpoint begin],operation,context,[log Record length],allocunitname from Fn_dblog (null,null)SELECT * FROM dbo. T_companyaccount with (NOLOCK)Operation: Operations done by the current LSNCURRENTLSN: Serial number uniquely identified in the
You often need to modify the data in the database through the stored procedure. You need to configure distributed transactions on the source and target database servers. The configuration process is cumbersome, distributed transactions are caused by both the operating system and SQL Server. After reading the article "SQL Serv
The batch log recovery mode of the SQL Server recovery model.
Do you want to know why the transaction log file is getting bigger and bigger? Transaction logs are sometimes larger than your actual database files, especially in the
rolled back'
ENDCatch Test commit and rollback transactions are OK. 3. Auxiliary statements -- -Delete table, restore self-increment starting from 1 truncate table testtable -- -display insert self-increment set identity_insert testtable on insert into testtable (testid,testname) values (32 , " 5 " ) identity_insert testtable off Attention: 1.set Identity_insert is only valid for the current session. 2.Set identity_insert table name on set, you must display the specified ID
Begin:Start transaction; # Be sure to have this '; ' number.Attention:MYSQL uses snapshot isolation, which means that a connection can be queried when it is modified.Example:CREATE TABLE T1 (X int);Insert into T1 (X) values (100);Connect A,Start transaction;Update T1Set X = 200;Connection B,Select X from T1; ------Return 100------------------------------------------------------------------------------------
The transaction log (Transaction logs) is a very important but often overlooked part of the database structure. Because it is not as active as the schema in the database, few people are concerned about the transaction log.
The transacti
SQL Server's TRUNCATE transaction rollback operation method, servertruncate
We generally think that TRUNCATE is an operation that cannot be rolled back. It will delete all data in the table and reset the Identity column.
If you perform the TRUNCATE operation in the transaction, you can roll back. Otherwise, it will not recover data from the
transaction log, instead of backing up (copying) the log to the backup device. Because the logs are not copied, you do not need to specify the backup device when using truncate_only. For example, the syntax for using the truncate_only option to back up the transaction logs of the primary database is as follows:Backup
Delete a message will cascade delete response information, then we need to use the transaction, the following SQL
Copy Code code as follows:
ALTER PROCEDURE [dbo]. [Proc_tb_leaveword_delete]
(
@leavewordID INT,
@record TINYINT OUTPUT
)
As
BEGIN
BEGIN TRY
BEGIN TRANSACTION
DELETE from Tb_leavewordid WHERE leavewordid= @leavewordID
DELETE from
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.