History of database file and line changes

Hi all
I've dug around a wile, but found no solution to this problem.

I have a DB (10g) on which I have a series of tables which I would like to follow the changes.

Is an example of Table structure
ID (Sequence driven record Id)
Column_1
Column_2
..
Column_N
IS_CURRENT (0/1 value which is 1 only for the current record)
RESOURCE_ID (ID of the resource which I the record)
TIMESTAMP (SYSDATE when the record was created)
The process should be as follows

(1) new creation of elements:
-By using an insert statement
-a new ID is taken from the sequence
-records is inserted with IS_CURRENT = 1

(2) update article
UPDATE MyTable SET IS_CURRENT = 0 WHERE ID = XXXXX
INSERT INTO MyTable (ID, ................., IS_CURRENT, ......) VALUES (XXXXX, .............., 1, .......)
To avoid unnecessary history records the creation, I would like to check whether the properties of the "IS_CURRENT = 1' record has changed.
I can do for this SELECT COUNT usign with in which all the columns for recording, but I wondered if something more intelligent is there.
I checked if it was possible to use the comparison of ROWTYPE variables, but it is not possible.
Is it possible, after you have instantiated a ROWTYPE variable (the on input) to do something like
SELECT COUNT (*) FROM MaTable WHERE something = rowtype_variable?

Thanks for the support
Concerning
Andrea

Published by: user10374756 on 11-ott-2012 7.52

user10374756 wrote:
I have a DB (10g) on which I have a series of tables which I would like to follow the changes.
The process should be as follows

(1) new creation of elements:
-By using an insert statement
-a new ID is taken from the sequence

Good.

-records is inserted with IS_CURRENT = 1

Dangerous idea. Remember that multiple users may do so at the same time (or almost). And they will not notice the other session data, as long as it is not engaged.

(2) update article

Setting a DAY MyTable SET IS_CURRENT = 0 WHERE ID = XXXXX

This update will introduce a bottleneck in your application (point of serialization). Each session will have to wait the other session finished its update. And if it is implemented incorrectly, then you will still end up with two entries is_current = 1.

Tags: Database

Similar Questions

  • A virus has attacked my computer and erased my MSN database files and when I try to reinstall, my MSN Installer does not work. I was unable to fix it.

    A virus has wiped out my MSN database files and I am unable to remove MSN and work again. I'll have to go through Internet Explorer instead of my MSN account. I want my MSN e-mail account to be relocated instead of having to use Hotmail (which I hate). I get the MSN on the Internet Explorer home page, but it's the only thing I get. I tried to reinstall MSN, but the installer is too corrupted and I don't know how to fix it. Any help would be greatly appreciated! Thank you!

    Hi Ellabelle1,

    To support more specialized on this issue, please contact the MSN Support

    MSN support

    Thanks and greetings
    Ajay K
    Microsoft Answers Support Engineer
    ***************************************************************************
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • 9.2.0.6 moving database files and redologs using the dd command.

    Hi all,

    I need to know if someone have take a cold copy of database (data file and redologs) using the unix dd command.
    The problem is related to the value to be assigned to "bs" in the DD.

    For the data file, I know to do the same thing of block_size for the tablespace. I'm not sure of the value to assign to "bs" to the redologs.

    Any suggestions are appreciated.
    Thanks in advance

    Adriano

    PS. I'm pass raw partitions of the data files and of redologs from HP - UX 11.11 RISC on SYMM8830 for HP-IA64 using lvm on HP XP24000 with veritas.

    Published by: adriano.ba on October 17, 2008 12:23

    as to the "bs" to command "dd"?

    DD if = of = bs = 1000M

    If your raw device is in GBs, you can give a higher as 1024M... Sometimes the operating system does not have higher values as 1 GB... in this case, you can give all the values as 1024 K, 100 M, 500 M... Like this...

  • How to set the table rows spacing and line changing automatically if is limit

    Greetings,

    I use JDeveloper 11.1.2.4. By default, if you set (or not) the table width and the line is its width, it will create a scroll down bar.

    Is what I want to do, if the text inside each row its greatest width, to change the line inside his line. TO

    more to explain it, I'll demonstrate a small table below:

    MESSAGE ID

    1 Hello Philip

    2 Hello Philip

    3 How are yo

    u today?

    4 tries...

    This way, if the text in the column 'message' is the largest say width 40, to increase his height of line automatically if the text

    fits inside 1 row without creating a scroll bar.

    Thanks in advance for any help.

    Have you attempted to assign noWrap = "false" on af:column?

    Dario

  • Open my html file and cannot change it

    When I open my file Flash html, in design-time view all get them is a grey box containing the symbol Flash in the middle and no html tool.

    I want to connect some of my buttons but if I switch mode live I get html tools but I can't always access them to create links.

    How can I get my html page so that I can make my links?

    Forrest

    Your next button can still do.  But it has to be programmed in Flash.  Flash files are not natively supported by Dreamweaver.  You'll need to export in order to put on a Web site in Dreamweaver.

    The only way that Dreamweaver can do for you is if you create a button in Dreamweaver that performs this action for you outside of the Flash area.  Then this button can link to another page or Flash file.  But if the button is located in the Flash file then it should be edited with Flash.

  • Change the database file [DFL]

    Hello

    I'm looking for a way that may alter the *.ldf database file, some customers do not put the Signal_endcoding_types in the FLA file. I need a way to save the 'coding' in the file with labview UI. I found a few old FLA file API, but I tried, it seems to me that they only works on older versions. My fla file version is LIN_protocol_version = "2.0"; LIN_language_version = "2.1"; could someone tell me if there is a way that can achieve my goal.

    Thanks in advance

    Best regards

    Melo

    You want to edit the FLA file?  Because if so there is nothing that neither currently offers that will work for you.  If you want to use the FDL in XNet and you want to change the settings imported from the FLA so you can use the XNet API to achieve this.  When you use XNet you import the FLA (or other database files) and then you can modify the database, but is not edit the FLA.  This changes the database using the XNet, which began with the importation of the DFL.

    Recently, there has been updates of XNet which allow you to export a database, but I think they don't support that export to a database BOX.  So with CAN you can import a DBC XNet, change it using the database, editing tools, and then export it to a DBC should have the changes you made.

  • Backup Oracle database files

    Quick question... If I put the data base oracle in Archivelog mode, can I use such as Symantec or ARCServe Backup software to back up the directory where all database files to include archiveredo newspapers? It would be an acceptable means of backup of the database without using RMAN? Reason I ask is if incase we have a total breakdown of the system, I would like to rebuild the server, install Oracle with the same instance name and installation directory, and simply restore the database files and be operational. Thanks to produce for your help.

    974680 wrote:
    Quick question... If I put the data base oracle in Archivelog mode, can I use such as Symantec or ARCServe Backup software to back up the directory where all database files to include archiveredo newspapers? It would be an acceptable means of backup of the database without using RMAN? Reason I ask is if incase we have a total breakdown of the system, I would like to rebuild the server, install Oracle with the same instance name and installation directory, and simply restore the database files and be operational. Thanks to produce for your help.

    The right way to achieve your goal would be to use rman to back up the database, and then use other tools to backup the backups that have been created by rman.

  • Prepare disks for ASM (data files and FRA)

    I intend to place data files on a disc 1 (sd1) and disk2 (PSD) when the backup of files (FRA) on disk3 (SDC). Here's how I'd do:

    For data files
    Disk1 is divided into a single primary partition (with native Linux what ID 83 not formatted system)
    Disk2 is also divided into a single primary partition (with native Linux ID 83 system not formatted)

    oracleasm createdisk vol1/dev/sda1
    oracleasm createdisk vol2/dev/sdb1

    CREATE DISKGROUP DATA EXTERNAL vol1, vol2 REDUNDANCY;


    For backup FRA

    Disk3 is partitioned into four primary partitions: / Boot (ext3), / (ext3), swap (swap) and /u01 (ext3)

    The FRA will be put under the/U01 and then attend the ASM:

    oracleasm vol3/dev/sdc4 createdisk
    CREATE DISKGROUP DATA EXTERNAL vol3 REDUNDANCY;

    Now, the problem. (1) the/U01 has already be formatted in ext3; (2) Oracle (DBMS) software will also be place under/U01

    It will be a problem?


    Otherwise, I can put FRA on the same drive as the data files, i.e. on disk1 and disk2. In this case, I need to partition the disk 1 in two primary parititions sda1 and sda2 (native Linux system ID 83 not formatted), one for data files and another for FRA (do the same for disk2). The downside is that the data file and the file recovery will be on the same hard drive.


    Please offer some suggestions.


    Thank you

    Scott

    PS: in the environment of production, all the disc 1, 2 and 3 will be on hardware RAID 1.

    RAID 1 will protect you only a device failure. It won't protect you partition, the file damage system or user errors; It will be in the image of the errors and problems like any other data.

    So what happens if you delete by mistake / U01 or some other accident happens and you loose that partition? With your current setup, you will lose everything and will not be able to restore or recover the database. Put tablespaces FRA and DB on the same physical device is certainly a very bad idea, whether or not it is a RAID.

    ASM is not a software RAID 1 mirror. It ensures redundancy of data based on file extensions and knows about files of Oracle database, which is a very good thing. You probably do not want to specify 'external redundancy.

    In a production system, you'll certainly want to mux the critical data and to store the DB controlfiles, redo logs and finally archivelogs on media separate physically in order to avoid the single point of failures wherever possible. You can use partitions and volumes in ASM, but they should be separate physical drives, otherwise you will bypass the ASM data redundancy. You must also have a solid strategy for RMAN backup. The FRA is supposed to store backupsets RMAN, copies of the image, the important archivelogs and multiplexes of the copies of the database files and should therefore always on a separate physical disk.

    Unless you simply play, I strongly suggest that review you your current configuration.

    Published by: Dude on June 29, 2012 04:55

  • Files and Confusion

    I have about 14 000 pictures on LR 2.3. I use a Mac Pro with Leopard OS. Periodically, when I wasn't really awake, I downloaded files on my CF card in a file and not changed the setting to "a file", so I get the files in a subdirectory dated not reimbursed under my target directory. Sometimes, when I try to drag and drop them to the rear in the target directory, they will. Sometimes they have not. How can I be sure to get them in the target directory each time and how do I get rid of the directory under vacuum?

    To move the files that you must be enter the part of the image of the thumbnail not the framework. A folder can be deleted by clicking on the sign under which appears on the header bar of the folders on the left hand side. You should also be aware that Lightroom only deletes records that are really empty. If anything is not in a folder Lightroom poster so a message to prevent and remove the folder from the catalog, but it will always remain on your hard drive.

  • Where (drive, folder, file name) are database files that store information to catalog such as tags and changed the dates in the 13 elements?


    I want just the datebae file which contains the data of the backup catalog.  I can't find it in the 13 elements but could not in 10 items.  Is it hidden in a secret file with a secret name?  Why?

    The catalog is a file containing the main database (catalog.pse13db), the cache of thumbnails (thumb.5.cache) and other files and subfolders. To save a catalog, you save the entire catalog with its subfolders. Note that if you do not save the thumbnail cache (which is the largest element in the catalog), it will be rebuilt automatically.

    In all versions of elements, Win or Mac, you can find its location on the menu: help/information system.

    By default, it is in a folder hidden in Windows.

    Why? I don't know, but you can tell Windows Explorer to show hidden files. It is up to you; I always do.

    The catalog must always be in the default location? Not at all. You can move it elsewhere. For example, you can maintain your catalogue and your picture library on an external drive. Then, watch as catalog manager being "custom position".

    What follows is not in your question, but I assume you are asking only for backup purposes. If you have an external backup system, you must include the catalog folder. It is not enough if you want to restore to another computer or a drive, because the original is dead. The catalog stores the location of the image files with respect to the path, but also for the internal serial number of the drive. Change drive means that all the files appear 'disappeared' or 'disconnected' and you will have to run a procedure to "reconnect". Reconnection is necessary if you are using the internal backup/restore process in the Organizer.

    Using Backup, Restore to move the catalog | Organizer | Elements 6 or later version

    If you are not in the case of an accident, but you simply want to update (enclosed updated version PES), the integrated system is ideal.

    Other backup systems have their advantages. I use SyncToy Windows after each session of significant change and the backup of the organiser at regular intervals.

  • During startup, I get an error message that the registry database cannot find a file and modify registry to delete the reference to the file in the registry. How can I do this?

    Original title: Registery Error Message

    During startup, I get an error message that the registry database cannot find a file and modify registry to delete the reference to the file in the registry.  How can I do this?

    Hello

    • What were the changes made before the problem occurred?

    I recommend you perform the clean boot.
     
    Configuration of your system in a clean boot state helps determine if third-party applications or startup items are causing the problem. If so, you need to maybe contact the manufacturer of the program for updates or uninstall and reinstall the program.
     
    See the following article in the Microsoft KB for more information on how to solve a problem by performing a clean boot in Windows Vista or Windows 7:
     
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135 
     
    Note: After troubleshooting, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

  • Want to change the WordPad default values for font size and line spacing

    I use WordPad quite heavily because it is simple and fast.  But the new version of W - 7 seems to not allow you to change the default values for the font, size and line spacing.  The default values are not suitable for a large part of what I do and I'd like to find a way of quickly and easily, either make the changes permanent or change this to open with a single click of mouse or at most two.  Any suggestions?

    It is the "best" solution to workaround.  After you change your Default.rtf custom, simply move it to your system32 directory and add the "Default.rtf" at the end of the location of your target on the property sheet for your file WordPad.exe.

    Every time that you open its default location in the directory c:\program files\windows NT\Accessoires WordPad.exe, it defaults to now your Default.rtf custom.

  • How to recover a database containing only the DBF and CTL files and any other information?

    Hello

    I have the following situation: a customer sent a group of files, he said be a "backup" of an old database, which is more in line (he doesn´t use our software more). However, he needs recover data in this database. The person at the company that generates these files doesn´t work more, so we don t have the following information:

    -Version, connection details, service names, user names, or tablespace databases.

    We just said that these files have been saved on a DVD, and is the only source that remaining.

    The files he sent are:

    ctrl\cf_satp_01.CTL

    ctrl\cf_satp_02.CTL

    ctrl\cf_satp_03.CTL

    dad\df_satp_dad_01.dbf

    idx\df_satp_idx_01.dbf

    rbs\df_satp_rbs_01.dbf

    redo\redo_g10_m1.dbf

    redo\redo_g11_m1.dbf

    redo\redo_g12_m1.dbf

    sap\df_satp_sap_01.dbf

    spo\df_satp_spo_01.dbf

    sys\df_satp_sys_01.dbf

    tmp\df_satp_tmp_01.dbf

    Is there a way to access this data? Or if I can say our costumer that sorry... sit and cry... your data is lost forever...

    I m unaware of backups of database Oracle, having worked with discharges every time a need something like this, so apologies if the answer is obvious.

    Sorry for the poor English too!

    Thank you

    Luiz Fernando Meier

    How has taken this backup? Cold or hot (online)?

    If online, then the backup is unrecoverable.

    If offline then it is possible to get it back. You must know the database version and the platform of the source.

    You need the version of the base to know which version ORACLE_HOME, you use, if you need to upgrade the database once restored.

    You need the OS platform to see what type of endian is your data files, because that limits also what OS you can restore.

    Kind regards

  • Read a record of file and write to the database.

    Hello

    I read a file using a file adapter and write to the database using DBAdapter table. In BPEL, I used activity to receive the entry from the file and call activity to call dbadapter.in between receive and call I used activity activity of transformation of transformation.the problem is that, after deployment it.i get following error two errors:

    (1) no recoverable system failure:
    < bpelFault > < faultType > 0 < / faultType > < bindingFault xmlns = "http://schemas.oracle.com/bpel/extension" > < a name = "summary" part > < summary > Exception is is produced when the link has been invoked. Exception occurred during invocation of the JCA binding: "JCA binding run reference"insert"operations have to: connection problem component binding JCA.". JCA Binding component is unable to create an outgoing connection of JCA (CCI). ReadWriteDB:WriteDB [WriteDB_ptt::insert (MydbCollection)]: The JCA Binding component could not establish an outbound connection of JCA CCI due to the following problem: BINDING. Error of JCA - 12510 JCA adapter localization resources. Unable to locate the adapter of JCA resource through the element of the binding file .jca & lt; factory connections / > The JCA Binding component is unable to startup of the resource adapter specified in the & lt;-factory connections / > element: location = 'EI, DB, null. The reason is most likely that 1) the resource adapter RAR file has not been deployed successfully to the WebLogic application server or 2) the "& lt;" jndi name > ' element in weblogic - ra.xml has not been defined in eis/DB/null. In the latter case, you need to add a new factory of connections from WebLogic JCA (deploy a RAR). Please fix this and then relaunch the Application Server, please make sure that the JCA connection factory and dependent connection factories have been set up with a sufficient limit for maximum connections Please also make sure that the physical connection to the EIS server is available and the backend itself accepts connections. ". The called JCA adapter threw an exception of resource. Please review the error message above carefully to determine a resolution. < Summary / > < / part > < part name = "detail" > < details > error location JCA resource adapter. Unable to locate the adapter of JCA resource through the element of the binding file .jca & lt; factory connections / > The JCA Binding component is unable to startup of the resource adapter specified in the & lt;-factory connections / > element: location = 'EI, DB, null. The reason is most likely that 1) the resource adapter RAR file has not been deployed successfully to the WebLogic application server or 2) the "& lt;" jndi name > ' element in weblogic - ra.xml has not been defined in eis/DB/null. In the latter case, you need to add a new factory of connections from WebLogic JCA (deploy a RAR). Please fix this and then restart the application server < / details > < / part > < part name = "code" > < code > 12510 < / code > < / piece > < / bindingFault > < / bpelFault >

    2 non recoverable system fault):
    Exception occurred when the link was invoked. Exception occurred during invocation of the JCA binding: "JCA binding run reference"insert"operations have to: connection problem component binding JCA.". JCA Binding component is unable to create an outgoing connection of JCA (CCI). ReadWriteDB:WriteDB [WriteDB_ptt::insert (MydbCollection)]: The JCA Binding component could not establish an outbound connection of JCA CCI due to the following problem: BINDING. Error of JCA - 12510 JCA adapter localization resources. Cannot find the adapter in JCA resources via the element of the binding .jca file <-factory connections / > The JCA Binding component is unable to startup of the resource adapter that is specified in the <-factory connections / > element: location = 'EI, DB, null. The reason is most likely that 1) the resource adapter RAR file has not been deployed successfully to the application server WebLogic or 2) the element '< jndi name >' in weblogic - ra.xml has not been set to eis/DB/null. In the latter case, you need to add a new factory of connections from WebLogic JCA (deploy a RAR). Please fix this and then relaunch the Application Server, please make sure that the JCA connection factory and dependent connection factories have been set up with a sufficient limit for maximum connections Please also make sure that the physical connection to the EIS server is available and the backend itself accepts connections. ". The called JCA adapter threw an exception of resource. Please review the error message above carefully to determine a resolution.

    Please suggest how to solve.

    Thank you

    Tejas

    Check your source data and your connection adapter db adpater deployments factory.
    Check if you have configured all steps of http://docs.oracle.com/cd/E15523_01/integration.1111/e10231/life_cycle.htm#BABBEDBF.
    Also, in your file .jca in your jdeveloper have named the location of connection-factory as "ist/DB/draw ' if so change it to one that you have created in the db adapter deployments.

  • The query results reel in a file and the number of lines in a different file

    Hello

    I would like to export only the result of my query to a file. I am able to do this with several sql, but I want the number of selected lines in a different file than the output "log".

    For example:

    -------------------------------------
    Select 'TEST' for the DOUBLE;

    TEST

    + 1 row selected. +

    -------------------------------------

    So 'TEST' should be included in the results file and ' 1 selected line"to a different log file.

    Is it possible to achieve this sql * more.

    Thank you for your time

    Rodriguez,

    Hi, Rodriguez,

    Welcome to the forum!

    Here's one way:

    COLUMN     row_cnt_col  NOPRINT     NEW_VALUE row_cnt
    
    --  You may or may not want the following settings.
    --  The 2-file output works with or without them.
    SET     FEEDBACK     OFF
    SET     VERIFY          OFF
    
    SPOOL     dept.txt
    
    SELECT     deptno, dname
    ,     COUNT (*) OVER ()     AS row_cnt_col
    FROM     scott.dept
    ;
    
    SPOOL     OFF
    
    SPOOL     dept.log
    
    SELECT     &row_cnt     AS total_rows_found
    FROM     dual;
    
    SPOOL     OFF
    

    The first SPOOL file, dept.txt, looks like this:

    `   DEPTNO DNAME
    ---------- --------------
            10 ACCOUNTING
            20 RESEARCH
            30 SALES
            40 OPERATIONS
    

    The second SPOOL file, dept.log, looks like this:

    TOTAL_ROWS_FOUND
    ----------------
                   4
    

    Taking your example, only the first query should change:

    SELECT     'TEST'               AS output
    ,     COUNT (*) OVER ()     AS row_cnt_col
    FROM     dual
    ;
    

    The second query and all the stuff set up is exactly the same.

    Published by: Frank Kulash, 27 September 2012 09:38

Maybe you are looking for

  • Tecra M7 memory upgrade question

    Hello everyone, I would like to upgrade the RAM on my Tecra M7, which came with 1 GB and is supposed to get a free site available. Since the system's maximum memory is 4 GB, I guess you can use up to 2GB stick into each slot. My question is: can I ha

  • Inbox suddenly empty icloud

    At approximately 17:20 01/21/16, of my icloud email account Inbox suddenly emptied itself without provocation. I was looking at my Inbox on my phone when it happened. A second, it contains messages, the other, they are all gone. I checked icloud.com

  • How can I get Windows 7 to search for locations that are not indexed when I have no indexed locations?

    I recently discovered what may be a bug or a serious error in the Windows 7 search engine, I'm not really sure of that.  Heck, it could be just that the options are formulated in a misleading way, and I don't realize.  Anyway slice you it, I have no

  • Dialog box is not displayed in CC2014

    HelloThe dialog box is not displayed in CC2014, but previous versions, works very well for me. Associated codes are below, can you please guide me to solve this problem.showDialog()function showDialog() {}App.Selection = NothingEnum.NOTHING;app.findG

  • Custom review info on drag and drop slides

    Hi allI want to do a personal study on a drag-and-drop slide.However, it seems not that I can get cpInReviewMode to trigger the visibility on my subject to review.Added the action advanced on enter. With the help of C9, latest patch.Try advanced acti