Welcome to Sign in | Help
in Search

2 intrebari interesante.

Last post 04-15-2010, 7:00 PM by xmldeveloper. 8 replies.
Sort Posts: Previous Next
  •  04-14-2010, 3:10 PM 8189

    2 intrebari interesante.

    Am primit aceste 2 intrebari privitoare la MS SQL Server 2008 R2 Ent si n-am stiut ce sa raspund:

    1. Daca se poate anula o tranzactie comisa fara restaurare din bck,snapshot,etc. ?
    2. Daca se poate face o interogare direct din baza de date a unor fisiere text externe , fara o incarcare prealabila intr-o tabela ?


    Multumesc.

    MCSE;MCITP
  •  04-14-2010, 3:23 PM 8190 in reply to 8189

    Re: 2 intrebari interesante.

    1. Nu, tocmai asta înseamnă să faci COMMIT la o tranzacţie. Dar se poate face alta tranzactie care să anuleze ceea ce a făcut prima (dacă a făcut un INSERT, atunci să facă un DELETE; dacă a făcut un UPDATE, atunci să facă un alt UPDATE cu valorile vechi, etc).

    2. Da, folosind funcţia OPENROWSET, vezi http://msdn.microsoft.com/en-us/library/ms190312.aspx.

    Răzvan
  •  04-14-2010, 4:16 PM 8191 in reply to 8190

    Re: 2 intrebari interesante.

    2 ---> sau printr-o procedura CLR care poate analiza textul.
    Altfel, full text search pe coloane care contin documente in varbinary(max).
  •  04-14-2010, 4:24 PM 8192 in reply to 8190

    Re: 2 intrebari interesante.

    1.Am inteles ca in Oracle se poate de asta am intrebat .

    2.Acum mi-am amintit si eu de openrowset , uitasem :P .

    Merci mult.

    MCSE;MCITP
  •  04-14-2010, 5:08 PM 8193 in reply to 8192

    Re: 2 intrebari interesante.

    1. Conform documentatiei Oracle,  comportamentul tranzactional este similar cu cel al SQL Server. Doua cazuri speciale sunt Savepoints, cand se poate marca un punct intr-o tranzactie la care se poate reveni si tranzactiile "nested".
    In cazul urmator:

    -- Transaction 1
    BEGIN TRAN
    ...
    -- Transaction 2
    BEGIN TRAN
    ...
    -- Commit 1
    COMMIT TRAN
    ...

    primul COMMIT TRAN nu face nimic concret asa ca orice ROLLBACK TRAN va avea ca efect anularea tuturor modificarilor efectuate de la inceputul primei tranzactii.

    2. OPENROWSET, linked server si OPENQUERY, OLE automation etc. Evident cea mai simpla metoda este OPENROWSET.

    Cristian Andrei Lefter, SQL Server MVP
    MCT, MCSA, MCDBA, MCAD, MCSD .NET,
    MCTS, MCITP - Database Administrator SQL Server 2005
    http://sqlserver.ro
  •  04-14-2010, 5:22 PM 8194 in reply to 8193

    Re: 2 intrebari interesante.

    Si SQL server are conceptul de Savepoint ? Si in caz afirmativ cum se face ?

    Merci.

    MCSE;MCITP
  •  04-14-2010, 5:26 PM 8195 in reply to 8192

    Re: 2 intrebari interesante.

    Nu cunosc Oracle, dar nu prea îmi vine să cred că se poate face ROLLBACK la o tranzacţie comisă. Probabil cine a zis asta se referea la altceva:
    a) în Oracle, este default SET IMPLICIT_TRANSACTIONS ON, ceea ce înseamnă că dacă faci un UPDATE simplu, el nu este comis direct, aşa că poţi să verifici rezultatele, apoi să dai ROLLBACK sau COMMIT, după caz
    b) era vorba de o nested transactions (eventual de un savepoint într-o tranzacţie la un nivel superior)
    c) cu vreo sculă de citit transaction log-ul, se execută altă tranzacţie care anulează efectele primei tranzacţii (aşa cum spuneam în mesajul iniţial). Cred că asta se numeşte FlashBack în Oracle (vezi şi îmbunătăţirile din Oracle 11g), iar în SQL Server poate fi realizat cu scule third-party de gen ApexSQL Log sau Redgate SQL Log Rescue.
  •  04-14-2010, 7:45 PM 8197 in reply to 8194

    Re: 2 intrebari interesante.

    Jourjaque:
    Si SQL server are conceptul de Savepoint ? Si in caz afirmativ cum se face ?

    Merci.


    Vezi BOL ---> ROLLBACK TRANSACTION
  •  04-15-2010, 7:00 PM 8200 in reply to 8194

    Re: 2 intrebari interesante.

    1. Am avut azi o discutie cu George Pristavu DPE Lead la Microsoft Romania (pentru cine nu stie George vine de la Oracle) si mi-a spus ca e posibil sa se discute despre tehnologia Flashback

    Flashback Transaction

    Large-scale database applications rely on complex sequences of transactions, to ensure atomicity and consistency of a group of inserts, updates, or deletes. In the event of a ‘bad’ transaction, the administrator must trail back-in-time to see what changes were effected by the transaction and ascertain any dependencies (e.g. transactions that modified the same data after the ‘bad’ transaction), to ensure that undoing the transaction preserves the original, good state of the data and any related data. Performing this type of transaction analysis can be laborious, especially for very complex applications.

    With Flashback Transaction, a single transaction, and optionally, all of its dependent transactions, can be flashed back with a single PL/SQL operation or by using an intuitive EM wizard to identify and flashback the problem transactions. Flashback Transaction relies on the availability of undo data and archived redo logs for the given transaction and its dependents, to backout the changes.

    The Oracle Database architecture leverages the unique technological advances in the area of database recovery due to human errors. Oracle Flashback Technology provides a set of new features to view and rewind data back and forth in time. The Flashback features offer the capability to query historical data, perform change analysis, and perform self-service repair to recover from logical corruptions while the database is online. With Oracle Flashback Technology, you can indeed undo the past!

    Oracle9i introduced Flashback Query to provide a simple, powerful and completely non-disruptive mechanism for recovering from human errors. It allows users to view the state of data at a point in time in the past without requiring any structural changes to the database.

    Oracle Database 10g extended the Flashback Technology to provide fast and easy recovery at the database, table, row, and transaction level. Flashback Technology revolutionizes recovery by operating just on the changed data. The time it takes to recover the error is now equal to the same amount of time it took to make the mistake. Oracle 10g Flashback Technologies includes Flashback Database, Flashback Table, Flashback Drop, Flashback Versions Query, and Flashback Transaction Query.

    Flashback technology can just as easily be utilized for non-repair purposes, such as historical auditing with Flashback Query and undoing test changes with Flashback Database. Oracle Database 11g introduces an innovative method to manage and query long-term historical data with Flashback Data Archive. This release also provides an easy, one-step transaction backout operation, with the new Flashback Transaction capability.


    In SQL Server se pot obtine functionalitati aproximativ similare prin Database Snapshots si Point in Time Revovery (restaurare de transaction log). Functionalitate similara insa nu identica.



    Cristian Andrei Lefter, SQL Server MVP
    MCT, MCSA, MCDBA, MCAD, MCSD .NET,
    MCTS, MCITP - Database Administrator SQL Server 2005
    http://sqlserver.ro
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems