Finding and fixing of the sequences that are out of sync

Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production version

Hello

Recently, our development database has been updated with production data, but have not been copied from the sequence.

Then of course the sequence numbers are very badly synchronized with the primary key for tables throwing errors in primary key.

How can I find the sequence names, names of tables, columns in primary key, and max values for the primary key columns that have values of key primary school max who are higher than the nextval of their corresponding sequences?

So far the nextval of sequence numbers were all less than the max value for the primary key for the corresponding tables.

We used the method:

SELECT max (primary key column)

TABLE;

SELECT sequence_name.nextval FROM dual;

Sequence_name ALTER SEQUENCE increment primary key value - current value of sequence max + 1;

SELECT sequence_name.nextval FROM dual;

SEQUENCE Sequence_name CHANGE INCREMENT OF 1;

But this is done when a record is inserted into a table and the error is thrown.

So I hope there is a much better way to remedy.

Please leave me a question.

Thank you

Joe

I don't know if this will help you or not, but here is what I used for the synchronization to the top of my sequences during the last upgrade/server database migration, I was involved with. You must be logged under the scheme that sequences need synchronization, linking of data back to the database, you are basing the sequences on and then let go and recreate sequences. It essentially creates a couple of other scripts and then executes them.

CREATE DATABASE LINK dblink
CONNECT to & schema
IDENTIFIED BY "& password»
USING ' & dbname';

set pages 0;
left head;
Set feedback off;
Set trimspool
fixed line 1000;

coil gen_seq_grants_spoolfile.sql

Select 'grants'. privilege: ' on ' | table_name |' to ' | dealer | « ; »
to user_sequences us,
USER_TAB_PRIVS PAO
where us.sequence_name = dtp.table_name;

spool off;

coil gen_seq_spoolfile.sql

Select 'remove the sequence'. o.object_name | ';' | Chr (10) | Chr (10) |
' create the sequence ' | o.object_name | Chr (10) |
"Start by ' | '. (to_number (s.last_number) + s.increment_by) | Chr (10) |
"maxvalue ' | s.MAX_VALUE | Chr (10) |
"minvalue ' | s.MIN_VALUE | Chr (10) |
"nocycle | Chr (10) |
'cache'. largest (s.cache_size, 20). Chr (10) |
"all." Chr (10)
of dba_objects@dblink o,.
s dba_sequences@dblink,
USER_SEQUENCES us
where o.owner = user
and o.object_name = s.sequence_name
and o.owner = s.sequence_owner
and s.sequence_name = us.sequence_name
and o.object_type = 'SEQUENCE '.
and us.last_number< s.last_number="" +="">
order of o.object_name;

spool off;

Set of feedback

@gen_seq_spoolfile.sql
@gen_seq_grants_spoolfile.sql

Drop database link dblink;

Tags: Database

Similar Questions

  • Is windows media player can detect the songs that are out there, more than double and remove them, or not add syncing and if so HOW?

    During the synchronization of music files, you have 3 questions,

    1-WHY some said files already added to the device, even if the memory card is empty?

    2-is there a way to configure windows media player to detect songs appearing twice and automatically delete them or just simply not add syncing?  IF Yes please let me know how.

    3-How do you stop sync everything in windows media player when in sync I put only some songs, but it always adds all the music, 5 star music AND photos?  How we prevent that?

    Hello

    Follow these steps and check if they help.

    Step 1:

    You can re-create the database of Windows Media Player and see if that fixes the problem.
     
    To resolve this problem, delete the Windows Media Player database. To do this, follow these steps:
     
    a. exit Windows Media Player.


    b. Click Start, type %LOCALAPPDATA%\Microsoft\Media Player and then click OK.

    c. Select all files in the folder and then click on Delete on the file menu.
     
    Note You don't have to remove the folders that are in this folder.
     
    d. restart Windows Media Player.
     
    Note Windows Media Player automatically rebuilds the database.

    Step 2:


    If this does not resolve the problem, disable the Windows Media Player database cache files. To do this, follow these steps:
     
    a. exit Windows Media Player.

    b. Click Start, type % LOCALAPPDATA%\Microsoft and then click OK.

    c. Select the Media Player folder, and then click on Delete on the file menu.

    d. restart Windows Media Player.
     
    Note Windows Media Player automatically rebuilds the database.

    With respect to the timing, I would have you read the following article.

    Windows Media Player sync: frequently asked questions
    http://Windows.Microsoft.com/en-CA/Windows-Vista/Windows-Media-Player-sync-frequently-asked-questions

  • The audio files are out of sync with video clock?

    I record an audio book with premiere pro 2014, is therefore a larger file, then Adobe switched me to first pro 2015 and now it says that my audio files are out of sync from the video clock. I realize Adobe has no technical support so I googled a cure. They told me to remove CC 2015 and reinstall CC 2014. Of course, Adobe's download anything over three days old extremely difficult unless you are following specific steps that are simply in place to harass. Try as I could, download CC 2014 cannot be done. My question is this: How can I re - sync my files using only CC 2015? What is the best way?

    * UPDATE. Problem found! It turns out that when I opened my task manager my CPU or central processing unit, was filled to 99%. I just had to uninstall some programs needed and things much better brought.

  • NB100 and Toshiba DVD player - photo & audio are out of sync

    NB100-12 has during playback of DVD, photo & audio are out of sync - began to arrive after months of work perfectly!

    What can I do?

    Playing DVD doesn t mean a lot to me.
    What DVD? Original DVD movie, an avi file recorded on DVD, own created from the DVD, what exactly?
    Which player do you use?
    Have you noticed the same thing with a lot of different movies DVD playing with different players?

    Please provide more relevant information.

  • 8 - Drag and Drop - Bounce Back answers that are out of sequence of Captivate

    Sorry if it's addressed somewhere, but my search results find anything. I'm building a drag and drop in which objects should be waived in order in various targets. I can get an object of bounce if it fell in the wrong place, but I also want the object to bounce back if it broke down (in the wrong order). For example, if point 2 fell in the right place, but in the wrong order, it will be returned. But I can't find an option for that. Any ideas? Thank you!

    I don't think there's a way to get there. Only drag sources that cannot be accepted by a drop target can be bounced. But with the sequence, the drag source must be accepted even if it is not in the correct order.

  • My definition updates are not common even after downloading and installing all the updates that are available in my Norton product.

    On Norton 360 first Edition, my anti-virus definitions are obsolete. I can't update them even after download of Defender. I've tried everything.

    Jim McGlothan

    Hello

    Contact the Norton Support about problems with their product

    http://www.Symantec.com/support/index.jsp

    __________________________________________________

    and what do you mean you downloaded Defender

    Windows Defender is part of Vista

    you don't download it from anywhere

    Are you sure that you have not downloaded a fake malware program?

    read the links below

    http://www.bleepingcomputer.com/virus-removal/remove-Windows-PC-Defender

    http://www.bleepingcomputer.com/virus-removal/remove-desktop-Defender-2010

    http://www.bleepingcomputer.com/virus-removal/remove-total-PC-Defender

  • When I opened my project and it is unable to locate the files. I find the files that are 'missing' and open the project.

    Hi im quite new for first pro and I'm having a problem when I opened my project and it is unable to locate the files. I find the files that are 'missing' and open the project. Everytime I open the project everything I see is all that media have these red, pink, blue, green, yellow lines, where pictures should be. And there is also the title of my pictures in the upper left corner. No one knows what it is and how I could fix this?

    [title published by mod]

    [Please do not double post, deleted the other]

    Right-click on the images in the project window: recharge or replace it.

  • Not able to find new updates error the site has encountered a problem and cannot display the page you are trying to view

    Original title: get errors on Windows Update after installation of W2K3 SP1 (Web Edition)

    When I try to use the Windows Update site, it gives the following error:

    "The website has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem. "

    It is immediately after installing W2K3 Server Web Edition SP1 (it was the last version that I could find on MSDN Web publishing)

    This version is still supported by WU?  Pointers to get this working would be appreciated.

    -Thanks!

    Hello

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.

    Hope this information is useful.

  • How can I find and open/search the 32 GB of data that fills the disk for possible deletion?

    Using XP: I have only about 2 GB (2 000 MB) of the programs on my hard drive Go 37 and less than 3 GB of space left.

    How can I find and open/search the 32 GB of data that fills the disk for possible deletion?

    Thank you.

    * original title - full hard drive. *

    Using XP: I have only about 2 GB (2 000 MB) of the programs on my hard drive Go 37 and less than 3 GB of space left.

    How can I find and open/search the 32 GB of data that fills the disk for possible deletion?

    Thank you.

    Download and run JDiskReport.

    There are a number of things you can do to- temporarily - free up disk space.  The only real solution, however, is to get a larger hard drive.

    • You can run Disk Cleanup (start > run > cleanmgr > OK)
    • You can reduce the size allocated for the restoration of the system to about 1 GB (right click on desktop > properties > system restore > settings)
    • You can disable hibernation (if you don't use it) (right click on an empty spot on the desktop > properties > screen saver > power > Hibernate)
    • You can disable the indexing of the drive, which will also speed up your computer a bit (http://lifehacker.com/031440/turn-off-indexing-and-speed-up-windows-xp)
    • You can reduce the size of your Internet browser cache (depending on the browser that you use)
    • You can remove most of the $NTUninstallKBxxxxxx files $ following the directions here: http://windowsxp.mvps.org/Hotfix_backup.htm (read the warnings in the gray box first)

    But none of these answers you will earn really large amounts of space for very long.  The term solution time is a bigger hard drive.

    In the meantime, download and run JDiskReport, that will show you graphically what files take up more space and seem to so indicate what files to delete or uninstall applications.

  • After the update of Photoshop 2015 CC welcomes "check spelling...". "and"find and replace text... "are disabled.

    Welcomes to "check spelling...". "and"find and replace text... "are disabled after I updated to Photoshop 2015 CC.

    Does anyone have a solution?

    Thank you
    Eli

    Someone has found a work around that.

    The link below.

    But is not ideal could be useful as the current problems with the point highlight text/right click on/off "check spelling" options disabled after that update CC 2015 is ruining your workflow.

    Spellchecker not available in Photoshop CC 2015

  • How is possible to create a smart collection to find all the photos that are not belongs to any collection?

    Hello

    How is possible to create a Smart Collection to find all the photos are not belongs to any collection?

    "Yesterday I was importing a lot of photo when my camera battery died then I succeeded him and continued to import without thinking that the previous import collection literally means" previous import. "

    So I need to find a way to create a smart collection that will reveal all the photos that do not belong to any collection.

    I solved the problem with a workaround is creating a collection based on the date of the photo which worked well, but must be nice to have a more general collection to find all the photo that are not from the collections.

    Thanks in advance,

    Marco.

    Another way to do

    1. Select all photos in the catalog

    2 dismiss a color label

    3. go to collections and multi select all your collections (ctrl)

    4. select images and give them a color

    5. return to the catalogue

    6. filter by color label - No

  • Unable to find the models that are supposed to come with...

    Cannot find the models that are supposed to come with Dreamweaver.

    On this page: http://www.adobe.com/devnet/dreamweaver/articles/css_page_layout_basics.html
    It is said to "Dreamweaver makes it easy for you to build pages with CSS layouts by providing over 30 predefined page layouts that work in different browsers."

    Where are they? I have the CS3 and CS4 Design Premium. I'm trying to dig deeper in the CSS by using some of the tutorials. These models would be helpful. :)

    I think I found them. We find them by going to 'new document '. Sorry ' end that.

  • Command BACK to find the MAC address of the computers that are connected with any windows Server

    Y at - it a DOS command to find the MAC address of the computers that are connected with any windows Server

    Usually, net view command is used to display computers on a particular network.

    To find the MAC address, it is best to ask the question here:
  • Hi, my camera is a nikon d 5300. Lighrtoom is 5.7.1. Lightroom can't read and develop the pictures that are taken in raw. If I sort to import raw photos - there is the error report that lightroom does not have this kind of raw format.

    Hi, my camera is a nikon d 5300. Lightroom is 5.7.1. Lightroom cann not read or develop the photographs that are taken in raw. If I try to import raw photos - there is the error report that lightroom does not know this kind of raw format. My computer is 1 year (Win 7 HP). Who could help me?

    Eugen

    DJ, the version number is in the subject line: 5.7.1. It's weird because this version should support the D5300 very well. My main guess would be a bad player or a bad USB cable.

    Eugen, you can try plug the camera directly and download the images like this?

  • Find the columns that are partitioned.

    Hello guys,.

    use views DBA_TAB_PARTITIONS, USER_TAB_PARTITIONS, ALL_TAB_PARTITIONS, we can find what are the partition names, number of rows in each partition etc. How we can find on the columns that are partitioned. I tried, but couldn't. help please.

    user_part_key_columns

Maybe you are looking for