Write-lock the complete database

Hello,
One of my transactions changes many records in the database and often I need 30 and
more tries, until the transaction is done without deadlocks.
Is there a chance to simply write-lock the database (and block other transaction) until this
expensive transaction has finished?
Is this impossible?
Thank you very much
Josef

Hi Josef,
I would suggest starting by reviewing the information in chapters 9 and 14 in the Reference Guide ("Berkeley DB Transactional Data Store Applications", "The Locking Subsystem"):
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/toc.html
and specifically the following links:
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/read.html
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/deadlock.html
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/tune.html
If your application behavior allows for multiple-reader/single writer access to the database then you might want to consider setting up with CDS (Concurrent Data Store); this is presented in chapter 8 in the Reference Guide ("Berkeley DB Concurrent Data Store Applications").
The above documentation should help you resolve this; if not, provide more information on how your application performs work (i.e. how many threads are writing concurrently, if you're using transactional cursors for writing, if you enclose reads in transactions, if you read records, analyze them and subsequently update them, what flags are set for transactions, databases, etc).
Regards,
Andrei

Similar Messages

  • SQL to search a field in the complete database

    Hi,
    I would like to know whether is it possible to search for a particular field name from the complete database?
    Say, for example, I would like to search for the field value 'oxford' present anywhere in the database and in any of the tables and in any columns.
    If possible, could any one help me with the sql to perform this please?
    Thanks
    Shivram Rajamanickam

    Ok...
    searching for a values in all tables in a schema
    ...

  • Sql to find the complete database usage including redo and temp

    can i get a sql or script through which i can find the complete usage statistics of the complete database which includes temp and redo log space.

    can i get a sql or script through which i can find
    the complete usage statistics of the complete
    database which includes temp and redo log space.Define 'usage statistics'. Sounds like you mean disk space usage. There are several DBA_* views such as DBA_DATA_FILES, DBA_TEMP_FILES, etc. See the Reference Manual at http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm. I leave the rest as an exercise for the student.

  • Pkgchk command gives a message "Couldn't lock the package database"

    Hi All,
    I have observed that whenever my script file executes pkgchk command on Solaris 10 it gives the error message "Couldn't lock the package database". This was not the case with Solaris 9.
    I would like to know if this is a bug with Solaris 10 ? Does it impact on functionality ? Is there anyway to stop this message getting displayed ?
    Thanks.
    Regards,
    Hemil

    I think the error is referring to the /var/sadm/install/contents file. It may be because you have a confused packaging command still running, like pkgadd or pkgrm. In any case, this is not the right forum. For Solaris 10 problems you should contact Sun Support, though install-discuss at opensolaris.org might help.

  • Searching a particular Row/Coloumn on the complete Database

    Is that possible to search a Row/Coloumn
    like coloumn name encounter : IF i need to know how many table have the same coloumn in the DATABASE.

    thanks for the response.
    But to run the query we need to have user_tab_cols as a table in the databse.
    I work as a support specialist for a helthcare S/W company eClinicalworks EMR
    we have our DB named 'mobiledoc'
    i need the info on that DB as to how many table have the column or row named encounterid

  • Why does pacman lock the database during downloads?

    Something that's always irked me about pacman is the fact that it locks the package database during the download stages of package installation, before anything has actually been installed/committed. Is there a reason for this, and if not, would a suggestion/patch be acceptable?
    Here's the scenario I'm encountering right now:
    * Downloading large package in background
    * Need to upgrade flash player (YouTube no longer accepts an older version I suppose, and lolcats are a necessity)
    * I cannot do this quick upgrade due to the lock pacman has on the database while downloading said large package
    Last edited by itsbrad212 (2012-03-24 00:36:31)

    krigun wrote:
    Sounds reasonable, but the following scenario may or may not be a problem:
    You have package A B and C installed:
    Run pacman -Syu (huge download, all three packages updated)
    Simultaneously, you execute pacman -R A (basically modify the pacman DB)
    Package A updated (reinstalled) by first process
    Not sure how pacman is built, but it probably locks and reads the DB when started, and then does it's thing without worries. In any case, it does support resuming downloads, so you could just end the long running process, install whatever, and resume.
    I think it's the same with apt-get.
    That's an interesting point, although I'm guessing the package manager could check to make sure that all packages that it wants to update are present on the system right after it locks the db, and if for some (rare) reason that one is missing, skip it.
    hadrons123 wrote:
    What is that large package which you think is that big?
    I think locking is present in all package managers in all distributions and it is  a good Idea, so that someone can't install and uninstall a package at different terminals at the same time, and end up with a messed up package manager .
    Well in this case, it is eclipse (>200 MB), but there are a variety of other large packages in the repositories. What may be small to you may seem massive to those with slower connections.
    How could it become messed up? I'm not proposing the database lock be eliminated, but rather wait until the actual installation process begins before locking it. It's no skin off anybody's ass if someone simply downloads packages simultaneously.

  • Error: You do not have sufficient access to perform a lock on this database

    Hi,
    Can anyone help on this.
    When user try to load data through Excel it throws the following error "You do not have sufficient access to perform a lock on this database"
    We are using Essbase 6.5.
    We have tried following options
    FIX1:
    In Microsoft Excel, under ESSBASE -> OPTIONS, under the MODE tab, the check box UPDATE MODE is checked.
    When the UPDATE MODE check box is selected retrievals will automatically lock the corresponding database area with each retrieval. Disable Update Mode to stop locking blocks automatically. In update mode, the Send command (which updates the server with data values from the spreadsheet) does not automatically unlock data after the send.
    1. Launch Microsoft Excel
    2. Select ESSBASE -> OPTIONS
    3. Select the MODE tab
    4. Uncheck "Update Mode" to return to normal mode
    This error is seen when trying to lock and send data via the Hyperion Essbase Spreadsheet Add-in into that fall within a replicated target partition definition
    1. Go to HYPERION APPLICATION MANAGER -> DATABASE -> PARTITIONMANAGER
    2. Select the relevant partition
    3. Select EDIT
    4. On the CONNECT TAB, select SETTINGS and tick the option THETARGET PARTITION CAN BE UPDATED
    Also gave write access to that user.
    Can anyone give another possible solutions.
    With thanks,
    babu

    Hi Raja,
    Check this out../
    Weird problem regarding Essbase Excel plug in
    It might help
    Regards
    Amarnath

  • How can we lock the table?? how can we lock the record

    Hi
    how can we lock the complete table?? how can we lock the record ?/
    Thanks
    Rama

    Lock objects are used to lock the database table while making the modifications on the database table.
    you can create your own lock objects using SE11.
    if you create lock objects on any table system will create two function modules.
    1.ENQUEUE....
    2.DEQUEUE.....
    first one is used to lock the table
    second one used to removing lock on the table.
    lock Table
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    Unlock Table
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    check this link :
    http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    _SCOPE = 1: The lock is not sent to the update program. The lock is removed when the transaction is ended.
    _SCOPE = 2: The lock is sent to the update program. The update program is responsible for removing the lock. The dialog program which requested the lock no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
    _SCOPE = 3: The lock
    Re: lock objects
    Reward if this helps.

  • Exporting complete database

    i need to export the complete database tables, procedures, functions, triggers etc from one computer to another.
    i'm using Oracle XE.
    and i have to import it to another computer (also using oracle XE)
    any suggestions on how to do that?_
    i have more than 16 tables and 12 procedures and huge amounts of data.so i cannot just move on.

    Revisited:
    In my case I am on
    Apex 4.1 - 10Gex (Centos 5.2 - 32 bit) and want to migrate applications and data to
    Apex 4.1 - 11Gex (Centos 6.3 - 64 bit)
    1) Should I do anything different than suggested above?
    [ I know... CentOS is not a 'Required OS':
    ...from the 11Gex R2 docs...
    •Oracle Enterprise Linux 4 Update 7
    •Oracle Enterprise Linux 5 Update 2
    •Red Hat Enterprise Linux 4 Update 7
    •Red Hat Enterprise Linux 5 Update 2 ]
    It is basically RHEL 6.3... I have successfully used CentOS 5.2 with 10Gex even though the 'requirements' for 10Gex are RHEL 3 and RHEL4...
    ya see - In order to go to 11Gex, I need a 64-bit OS...
    2) I have scheduled DB backups to disk using RMAN -
    Can I use those, from 10Gex to 'restore' in 11Gex?
    If so - how would I go about setting up the files in what directories - and what edits would be needed in configuration?
    (over and above placing everying in 11Gex where is resides in 10Gex - defaults)
    Thanks
    Rich

  • Can multiple threads write to the database?

    I am a little confused from the statement in the documentation: "Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time."
    1. Can multiple threads write to the "Simple Data Store"?
    2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
    3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
    #include "stdafx.h"
    #include <stdio.h>
    #include <windows.h>
    #include <db.h>
    static DB *db = NULL;
    static DB_ENV *dbEnv = NULL;
    DWORD WINAPI th_write(LPVOID lpParam)
    DBT key, data;
    char key_buff[32], data_buff[32];
    DWORD i;
    printf("thread(%s) - start\n", lpParam);
    for (i = 0; i < 200; ++i)
    memset(&key, 0, sizeof(key));
    memset(&data, 0, sizeof(data));
    sprintf(key_buff, "K:%s", lpParam);
    sprintf(data_buff, "D:%s:%8d", lpParam, i);
    key.data = key_buff;
    key.size = strlen(key_buff);
    data.data = data_buff;
    data.size = strlen(data_buff);
    db->put(db, NULL, &key, &data, 0);
    Sleep(5);
    printf("thread(%s) - End\n", lpParam);
    return 0;
    int main()
    db_env_create(&dbEnv, 0);
    dbEnv->open(dbEnv, NULL, DB_CREATE | DB_INIT_MPOOL | DB_THREAD, 0);
    db_create(&db, dbEnv, 0);
    db->open(db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0);
    CreateThread(NULL, 0, th_write, "A", 0, 0);
    CreateThread(NULL, 0, th_write, "B", 0, 0);
    CreateThread(NULL, 0, th_write, "B", 0, 0);
    CreateThread(NULL, 0, th_write, "C", 0, 0);
    th_write("C");
    Sleep(2000);
    }

    Here some clarification about BDB Lock and Multi threads behavior
    Question 1. Can multiple threads write to the "Simple Data Store"?
    Answer 1.
    Please Refer to http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
    A Data Store (DS) set up
    (so not using an environment or using one, but without any of the DB_INIT_LOCK, DB_INIT_TXN, DB_INIT_LOG environment regions related flags specified
    each corresponding to the appropriate subsystem, locking, transaction, logging)
    will not guard against data corruption due to accessing the same database page and overwriting the same records, corrupting the internal structure of the database etc.
    (note that in the case of the Btree, Hash and Recno access methods we lock at the database page level, only for the Queue access method we lock at record level)
    So,
    if You want to have multiple threads in the application writing concurrently or in parallel to the same database You need to use locking (and properly handle any potential deadlocks),
    otherwise You risk corrupting the data itself or the database (its internal structure).
    Of course , If You serialize at the application level the access to the database, so that no more one threads writes to the database at a time, there will be no need for locking.
    But obviously this is likely not the behavior You want.
    Hence, You need to use either a CDS (Concurrent Data Store) or TDS (Transactional Data Store) set up.
    See the table comparing the various set ups, here: http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
    Berkeley DB Data Store
    The Berkeley DB Data Store product is an embeddable, high-performance data store. This product supports multiple concurrent threads of control, including multiple processes and multiple threads of control within a process. However, Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time. The Berkeley DB Data Store is intended for use in read-only applications or applications which can guarantee no more than one thread of control updates the database at a time.
    Berkeley DB Concurrent Data Store
    The Berkeley DB Concurrent Data Store product adds multiple-reader, single writer capabilities to the Berkeley DB Data Store product. This product provides built-in concurrency and locking feature. Berkeley DB Concurrent Data Store is intended for applications that need support for concurrent updates to a database that is largely used for reading.
    Berkeley DB Transactional Data Store
    The Berkeley DB Transactional Data Store product adds support for transactions and database recovery. Berkeley DB Transactional Data Store is intended for applications that require industrial-strength database services, including excellent performance under high-concurrency workloads of read and write operations, the ability to commit or roll back multiple changes to the database at a single instant, and the guarantee that in the event of a catastrophic system or hardware failure, all committed database changes are preserved.
    So, clearly DS is not a solution for this case, where multiple threads need to write simultaneously to the database.
    CDS (Concurrent Data Store) provides locking features, but only for multiple-reader/single-writer scenarios. You use CDS when you specify the DB_INIT_CDB flag when opening the BDB environment: http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envopen.html#envopen_DB_INIT_CDB
    TDS (Transactional Data Store) provides locking features, adds complete ACID support for transactions and offers recoverability guarantees. You use TDS when you specify the DB_INIT_TXN and DB_INIT_LOG flags when opening the environment. To have locking support, you would need to also specify the DB_INIT_LOCK flag.
    Now, since the requirement is to have multiple writers (multi-threaded writes to the database),
    then TDS would be the way to go (CDS is useful only in single-writer scenarios, when there are no needs for recoverability).
    To Summarize
    The best way to have an understanding of what set up is needed, it is to answer the following questions:
    - What is the data access scenario? Is it multiple writer threads? Will the writers access the database simultaneously?
    - Are recoverability/data durability, atomicity of operations and data isolation important for the application? http://docs.oracle.com/cd/E17076_02/html/programmer_reference/transapp_why.html
    If the answers are yes, then TDS should be used, and the environment should be opened like this:
    dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
    (where ENV_HOME is the filesystem directory where the BDB environment will be created)
    Question 2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
    Answer 2.
    Definitely yes, You can see data loss and/or data corruption.
    You can check the behavior of your testcase in the following way
    1. Run your testcase
    2.After the program exits
    run db_verify to verify the database (db_verify -o test.db).
    You will likely see db_verify complaining, unless the thread scheduler on Windows weirdly starts each thread one after the other,
    IOW no two or ore threads write to the database at the same time -- kind of serializing the writes
    Question 3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
    Answer 3.
    In Your case the TDS should be used, and the environment should be opened like this:
    dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
    (where ENV_HOME is the filesystem directory where the BDB environment will be created)
    doing this You have proper deadlock handling in place and proper transaction usage
    so
    You are protected against potential data corruption/data loss.
    see http://docs.oracle.com/cd/E17076_02/html/gsg_txn/C/BerkeleyDB-Core-C-Txn.pdf
    Multi-threaded and Multi-process Applications
    DB is designed to support multi-threaded and multi-process applications, but their usage
    means you must pay careful attention to issues of concurrency. Transactions help your
    application's concurrency by providing various levels of isolation for your threads of control. In
    addition, DB provides mechanisms that allow you to detect and respond to deadlocks.
    Isolation means that database modifications made by one transaction will not normally be
    seen by readers from another transaction until the first commits its changes. Different threads
    use different transaction handles, so this mechanism is normally used to provide isolation
    between database operations performed by different threads.
    Note that DB supports different isolation levels. For example, you can configure your
    application to see uncommitted reads, which means that one transaction can see data that
    has been modified but not yet committed by another transaction. Doing this might mean
    your transaction reads data "dirtied" by another transaction, but which subsequently might
    change before that other transaction commits its changes. On the other hand, lowering your
    isolation requirements means that your application can experience improved throughput due
    to reduced lock contention.
    For more information on concurrency, on managing isolation levels, and on deadlock
    detection, see Concurrency (page 32).

  • How to delete the complete contents of database table ? should be empty !!

    Hi Guys,
    I have requirement where i have delete the contents of database table..i have make it empty (no records at all) and then i have to fill it with the records from the excel sheet.
    I can upload data from the excel sheet.
    Please tell me how to delete the complete contents of the database table ??
    Regards
    Rahul

    hi ,
    just write like this,
    delete from <database table>.
    commit work.
    sample code, here edpar is database table.
    delete from edpar." FROM TABLE g_tab_delete.
      call function 'DB_COMMIT'.
      loop at g_tab_edpar into g_wa_edpar.
        insert into edpar values g_wa_edpar.
        if sy-subrc  eq 0.
          move-corresponding g_wa_edpar to g_wa_edpar1.
          append g_wa_edpar1 to g_tab_edpar1.
        else.
          move-corresponding g_wa_edpar to g_wa_edpar2.
          append g_wa_edpar2 to g_tab_edpar2.
        endif.
      endloop.
    that's all it works.
    reward points if helpful.
    regards,
    seshu.

  • Does MM_EKKO  archive write job lock the tables?

    Archive experts,
    We run MM_EKKO archiving twice a week. From my understanding the write job just read the data and write it to archive files. But we run Replenishment jobs which hit EKPO tables, the jobs run slow, and I noticed that the archive write job is holding the locks on this table. As soon as I cancelled the write job, the replenishment jobs move faster. why this happens?  Archive write jobs should not be causing any performance issues, only the delete jobs will impact the performance. Am I correct?  Is any one experiencing similar issues?
    Sam

    Hi Sam,
    Interesting question! Your understanding is correct, write job just reads the data from tables and writes it into archive files... but....write job of MM_EKKO (and MM_EBAN) is a bit different. The MM_EKKO write job also takes care of setting the deletion indicator (depending on whether its a one step or two step archiving. So its possible that it puts a lock during the process of setting the deletion indicator, as its a change to database.
    please have a look at the folloing link for the explanation of one step and two step archiving:
    http://help.sap.com/saphelp_47x200/helpdata/en/9b/c0963457889b37e10000009b38f83b/frameset.htm
    Hope this explains the reason for the performance problem you are facing.
    Regards,
    Naveen

  • Berkeley DB needs too many write locks on specific size of the records

    Hi,
    I put records to the Berkeley db row by row in single transaction. And i have discovered significant increase of write locks on some specific size of the data.
    For example when i put 1000 records, where each record data size is around 3500 bytes, transaction uses 428 locks. On bigger or smaller data size transaction needs fewer locks.
    I put statistic in the table:
    Record size Lock number needed by transaction
    ~1400 169
    ~3500 428
    ~4300 6
    I think it is somehow related to the page size(16384) or cache size (64Mb)
    Could someone explain why transaction needs so many write locks with data size ~3500 and fewer locks with data size ~4300?
    Is there any way to avoid that raise of lock number? If not, I need to measure maximum number of locks needed for successful end of transactions. Understanding of the source of that issue would help me to prepare data which require the biggest number of locks for putting it in the database in one transaction.
    Thanks in advance.

    Please delete this post and repost in the appropriate forum. Thank you.

  • Operation can't be completed because the item "Database.sqlite3" is in use?

    "The operation can’t be completed because the item “Database.sqlite3” is in use."
    Every so often when I go to empty my trash I get this pop-up message from the Finder - any clues as to where this file is being generated? I can't figure out where this file is coming from - and google didn't have much on what that file even is. Is it something in the OS, or perhaps a third party app doing it? Anyone else ever have this message? Thanks.

    The Database.sqlite3 file (SO related) is here:
    ~(yourUserName)/Library/PubSub/Database/
    This link explains the purpose:
    http://www.schollnick.net/wordpress/2009/05/what-is-pubsub-agent/
    What is in your trash when you get this dialog?

  • The Microsoft Access database engine cannot open or write to the file in Report Builder 3.0

    I am trying to build a report in Report Builder 3.0.  I created the Data Source to point to my Excel file and the Data Set.  I drag a couple of fields on to the canvas and then choose Run.  I get the error:  "The Microsoft Access
    database engine cannot open or write to the file.  It is already opened exclusively by another user".  I am using the Excel driver.  Why am I getting this message?  How can I fix this?

    No, now I am getting the error message again.  It is quite long:
    ERROR [HY000] [Microsoft][ODBC Excel Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data.
    ERROR [01S00] [Microsoft][ODBC Excel Driver]Invalid connection string attribute Trusted_Connection
    Please help

Maybe you are looking for

  • Forms 6i to sql database using odbc driver

    am using orace forms 6i and i want to connect to sql database to use the tables there i can seem to do that with odbc cos it is asking for 'oracle open client adaptor', please can somebody tell me how and where i can get this adaptor driver.

  • ECC 6.0 Installation on windows

    Dear all, My question is ....can we install ECC 6.0 on Oracle 9i Database. we are useing windows as OS. does ECC 6.0 supports Oracle 9i database.....please help. Thanks and Regards Akumar

  • Vim colors in xterm

    I really like coding in vim, but with the current vim package in Arch Linux, the colors don't seem to work in all cases. In a standard xterm, the colors in the directory listings are working fine, but when I start vim, it only uses bold and underline

  • HT1386 Syncing without iCloud on iMac

    I have iCloud on my new iPhone 4, but not on my iMac.  I am trying to sync my calendar and address book.  It appears that items from my iMac go to my phone, but things I do on my phone don't go to my iMac.  How do I resolve this?  Everything else syn

  • Importing PPTX

    Hello. Maybe I'm doing this backwards, but I'm trying to import PPTX files (PowerPoint) into an existing Captivate project. Then, when it comes in, I clearly need to rescale the PowerPoints, or, what I'd really like to do is resize the PowerPoint to