EXPDP tablespace and IMPDP tablespace - who owns the tablespace data?

Hi Gurus
Sorry - new to this. Thank you for replies in advance.
10.2.0.3 - Windows 2003. Done some googling but not got the answer.
Have been asked by developer to export multiple tablespaces (on one server) into a new database (on another server) but import into just one tablespace.
Unable to use transportable tablespaces because software owner says it doesn't work.
However, developer says can use data-pump in 10g to do this.
Have created the same repository on both databases under the system account and same path name on both servers.
Have used expdp system/password tablespace=(tablespace_name1, tablespace_name2, etc) to create the dmp file and copied it over to the new database server.
Now about to import it into the new database into just one tablespace.
If I export all the multiple tablespaces and then import them into the one tablespace - under the system account - how does Oracle work out who owns the tables in the tablespace?
The tables, themselves, are owned by multiple owners (not all these users are created in the new database as the developer's ultimate idea is that it is only one new schema is created for the multiple tablespace data).
Before doing it I wonder - even though I've specified no schema etc - seems to me that system owns this data and all the data in the tablespace if I do import it successfully using remap tablespace=source: new tablespace.
I saw the system tablespace increase (thought it would but not what is desired, I'm guessing as I can't identify it clearly when looking - so it maybe there unnecessarily forever.
Seems to me I've put stuff into my system tablespace that will be there forever (unless I do something about it) on database1.
But if I impdp to database2 to new tablespace - under the system owner - then it will still be in the system tablespace and still owned by the system schema.
Is this correct thinking?
Should I create the old owners of the schemas in order for the impdp to succeed?
And if correct - is it possible to then allocate those tables in that tablespace to a new schema owner - and is there a way to do it at the time of import or do I have to then do some clever magical guru stuff to change it?
Thanks Gurus.
Please ask questions if I've not made myself clear.
Thanks again.

Thank you Guru for your reply.
No, I am not trying to create the same database elsewhere.
I am definitely not trying to not create a clone.
I would like to understand that, as I have a dmp file created for multiple tablespaces via expdp - under the system user - as I now want to dmp that file under one user - and can do via impdp - who owns the data - and if I have transferred via system user - is it the system user who owns the data in the tablespace now - or can I transfer it to a new named user?
Thanks Gurus.

Similar Messages

  • Who owns the activation process - Apple or Sprint?

    I have a Sprint iPhone 4S with the original SIM card.   the only way I've gotten it to activate is through a complete restore via DFU mode (very similar to this discussion in 2012; iPhone 4S US/Sprint unable to activate!)
    An incremental update to 8.1.1 makes it ask to activate again :/
    I went to my local Sprint store today and they say they can't do anything about it and that I must go to an Apple Store.
    I'm trying to avoid getting bounced around here.   Who "owns" the activation process?   Is it Apple or Sprint?
    Who ultimately correct this annoying activation behavior when it activates from a full restore?
    I should not that I am not using the phone component of the iPhone and do not have a Sprint account. (for the record, I was a pretty happy Sprint customer back in the 90s... )

    udance4ever wrote:
    hey quick update on this front - i finally got a iPhone 5s so my 4S if officially a "glorified iPod Touch" (admittedly a good one at 64GB) - so I'm not going to bother using the phone component in it for now.
    Sure a bit irked and just grateful the days of "carrier locked phones" is fading behind us more and more every day (I bought a 2nd hand Verizon 5s and a happy camper on T-Mobile - didn't have to go through any hoops!)
    anyone know if I can close this thread as "no longer needs an answer" somehow?
    Yeah you mark one of the responses as 'Solved My Question'.

  • HT4157 I have an iPad 2 and it does not display the cellular data button under settings

    I have an iPad 2 and it does not display the cellular data button under settings.  It does display a Bluetooth button in its place. I have tried the reset but no luck

    Is the iPad the Cellular version? Does it have an active Data plan? Does it have a Sim card installed in inside it?

  • IPhoto 11 and PSE 11: where is the image data stored?

    I have been using iPhoto on my new macbook for the last 3 mos. It has some useful features such as quick editing,  easy sharing and making neat collages etc. However its editing capability is limited and so i just bought PSE 11 for mac.
    My questions:
    1. I am trying to figure out as I import new pictures, where do I keep them, iPhoto or PSE? The pictures I take from iPhone , iPad obviously go into iPhoto first. However it is the photos I take with my other digital cameras that I am not sure where to bring them in. 
    2. If I import first into iPhoto and then into PSE, does the image data get duplicated?
    3. If I bring a photo from iPhoto into PSe and edit it, the picture remains in PSE. How do I take it back into iPhoto? Should I delete the edited photo from PSE after exporting it to iPhoto to avoid duplicate images?
    Your recommendations appreciated.

    In general it’s best not to use Organizer and iPhoto together. It’s one or the other to avoid duplicating your images.
    If you already have lots of photos in iPhoto, you could set up the iPhoto prefs, to enable the PSE11 Editor application for external editing. You can then use Edit In or Cmd+E directly from you iPhoto thumbnails.
    See link below.
    http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-iphoto-mac-os.html

  • Expdp full and impdp full fails with error....pls help..!(Oracle 11g)

    Hi
    I wanted to refresh my dev environment quickly..
    As we also wanted to migrate from exp/imp to datapump, I tried these..
    Only thing worked for me is impdp on network mode using remap schema.
    1)First i wanted to implement expdp and impdp standard procedures(Full database export/import)
    My expdp failed with the following error on a full export..
    Pls see below:
    C:\Documents and Settings\oracle2>expdp system/<p.w> full=Y directory=DATA_PUMP_DIR dumpfile=OAPFULL.dmp logfile=OAPFULL.log
    Export: Release 11.1.0.7.0 - Production on Thursday, 26 April, 2012 16:12:49
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYSTEM"."SYS_EXPORT_FULL_02":  system/******** full=Y directory=DATA_PUMP_DIR dumpfile=OAPFULL.dmp logfile=OAPFULL.log
    Estimate in progress using BLOCKS method...
    Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 4.351 GB
    Processing object type DATABASE_EXPORT/TABLESPACE
    Processing object type DATABASE_EXPORT/PASSWORD_VERIFY_FUNCTION
    Processing object type DATABASE_EXPORT/PROFILE
    Processing object type DATABASE_EXPORT/SYS_USER/USER
    Processing object type DATABASE_EXPORT/SCHEMA/USER
    Processing object type DATABASE_EXPORT/ROLE
    Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT
    Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
    Processing object type DATABASE_EXPORT/SCHEMA/ROLE_GRANT
    Processing object type DATABASE_EXPORT/SCHEMA/DEFAULT_ROLE
    Processing object type DATABASE_EXPORT/SCHEMA/TABLESPACE_QUOTA
    Processing object type DATABASE_EXPORT/RESOURCE_COST
    Processing object type DATABASE_EXPORT/SCHEMA/DB_LINK
    Processing object type DATABASE_EXPORT/TRUSTED_DB_LINK
    Processing object type DATABASE_EXPORT/SCHEMA/SEQUENCE/SEQUENCE
    Processing object type DATABASE_EXPORT/SCHEMA/SEQUENCE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type DATABASE_EXPORT/DIRECTORY/DIRECTORY
    Processing object type DATABASE_EXPORT/DIRECTORY/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type DATABASE_EXPORT/CONTEXT
    Processing object type DATABASE_EXPORT/SCHEMA/PUBLIC_SYNONYM/SYNONYM
    Processing object type DATABASE_EXPORT/SCHEMA/SYNONYM
    ORA-39014: One or more workers have prematurely exited.
    ORA-39029: worker 1 with process name "DW01" prematurely terminated
    ORA-31672: Worker process DW01 died unexpectedly.
    Job "SYSTEM"."SYS_EXPORT_FULL_02" stopped due to fatal error at 16:14:562)As the above failed, I tried impdp with network_link import and full=y and its a different issue!
    impdp system/<p.w> NETWORK_LINK=OAPLIVE.WORLD full=y logfile=OAPDRfull2.log table_exists_
    action=REPLACE
    Import: Release 11.1.0.7.0 - Production on Thursday, 26 April, 2012 13:36:01
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** NETWORK_LINK=OAPLIVE.WORLD full=y logfile=OAPDRfull2.log table_exists_action=REPLACE
    Estimate in progress using BLOCKS method...
    Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 4.670 GB
    Processing object type DATABASE_EXPORT/TABLESPACE
    ORA-31684: Object type TABLESPACE:"SYSAUX" already exists
    *************lots more of object already exists errors here............(space limit so cant paste)***************
    ORA-31684: Object type SYNONYM:"GEOPROD"."EXT_POSTAIM_PRESORT_61" already exists
    ORA-39126: Worker unexpected fatal error in KUPW$WORKER.DISPATCH_WORK_ITEMS [SYNONYM:"GEOPROD"."EXT_POSTAIM_PRESORT_61"]
    ORA-31600: invalid input value 200001 for parameter HANDLE in function CLOSE
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.DBMS_METADATA", line 569
    ORA-06512: at "SYS.DBMS_METADATA", line 4731
    ORA-06512: at "SYS.DBMS_METADATA", line 792
    ORA-06512: at "SYS.DBMS_METADATA", line 4732
    ORA-06512: at "SYS.KUPW$WORKER", line 2718
    ORA-03113: end-of-file on communication channel
    ORA-02055: distributed update operation failed; rollback required
    ORA-02063: preceding lines from OAPLIVE.WORLD
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.KUPW$WORKER", line 7858
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    242F2F2C     18256  package body SYS.KUPW$WORKER
    242F2F2C      7885  package body SYS.KUPW$WORKER
    242F2F2C      8657  package body SYS.KUPW$WORKER
    242F2F2C      1545  package body SYS.KUPW$WORKER
    241DDF3C         2  anonymous block
    ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA []
    ORA-31642: the following SQL statement fails:
    SELECT unique ku$.seq# from sys.metanametrans$ ku$ WHERE ku$.htype='DATABASE_EXPORT' AND ku$.model='ORACLE' AND NOT ( ku$.seq#>=(select a.seq# from sys.metanametrans$ a where
       a.model='ORACLE' and a.htype='DATABASE_EXPORT' and a.name ='DATABASE_EXPORT/SCHEMA/SYNONYM')) order by ku$.seq#
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 5002
    ORA-01427: single-row subquery returns more than one row
    ORA-06512: at "SYS.DBMS_
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
    ORA-06512: at "SYS.KUPW$WORKER", line 7853
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    242F2F2C     18256  package body SYS.KUPW$WORKER
    242F2F2C      7885  package body SYS.KUPW$WORKER
    242F2F2C      2744  package body SYS.KUPW$WORKER
    242F2F2C      8523  package body SYS.KUPW$WORKER
    242F2F2C      1545  package body SYS.KUPW$WORKER
    241DDF3C         2  anonymous block
    Job "SYSTEM"."SYS_IMPORT_FULL_01" stopped due to fatal error at 13:39:48So its basically these 2 issues I want to know how to fix.
    1-expdp error cause and fix
    2-impdp error cause and fix -Also how to avoid object alreay exists error?
    Also for example the package etc. is the same name..but i want new package from LIVE so it means if the same name package, view, etc is there, it wouldnt get updated?
    Any way to overcome this?
    I need it exactly same as LIVE...(with a few exceptions which is small enough i can do after impdp finishes fine)
    Pleaseeeeeeee help!!
    Thanks&Regards.......

    Hi..
    Thanks for the links..I applied the tips on each of them but it didnt work.
    Also my database is 11g so it is not true that this happens on 10g only.
    Things tried:
    1)I tried with different values on parallel parameter but same error
    2)I applied the following:
    alter system set open_cursors=1024 scope=spfile;
    alter system set "_optimizer_cost_based_transformation"=off;
    commit;
    The 3rd link was bit better
    I tried to find out where exactly the error was causesusing
    expdp attach =SYS_EXPORT_FULL_03
    But I cant figure out what the object : PUBLIC
    oracle/context/isearch/GetPage
    is..?
    Does this needs to be excluded from the export?if so, how?
    Can someone help how to fix the error now?
    Processing object type DATABASE_EXPORT/SCHEMA/SYNONYM
    ORA-39014: One or more workers have prematurely exited.
    ORA-39029: worker 1 with process name "DW01" prematurely terminated
    ORA-31672: Worker process DW01 died unexpectedly.
    Job "SYSTEM"."SYS_EXPORT_FULL_03" stopped due to fatal error at 11:29:32
    C:\Documents and Settings\ora2>expdp attach=SYS_EXPORT_FULL_03
    Export: Release 11.1.0.7.0 - Production on Tuesday, 01 May, 2012 11:35:38
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Username: system
    Password:
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Job: SYS_EXPORT_FULL_03
      Owner: SYSTEM
      Operation: EXPORT
      Creator Privs: TRUE
      GUID: 8499C802F52A414A8BCACE552DDF6F11
      Start Time: Tuesday, 01 May, 2012 11:37:56
      Mode: FULL
      Instance: geooap
      Max Parallelism: 1
      EXPORT Job Parameters:
      Parameter Name      Parameter Value:
         CLIENT_COMMAND        system/******** parfile=h:\datapump\oapfull.par
      State: IDLING
      Bytes Processed: 0
      Current Parallelism: 1
      Job Error Count: 0
      Dump File: H:\datapump\oapfull.dmp
        bytes written: 4,096
    Worker 1 Status:
      Process Name: DW01
      State: UNDEFINED
      Object Schema: PUBLIC
      Object Name: oracle/context/isearch/GetPage
      Object Type: DATABASE_EXPORT/SCHEMA/PUBLIC_SYNONYM/SYNONYM
      Completed Objects: 766
      Total Objects: 766
      Worker Parallelism: 1

  • HT4113 I've lost the passcode and the Ipod is fully disabled and i know longer own the computer the Ipod was first connected to,what do i do?

    So i forgot the pass code to my Ipod and have fully disabled my Ipod, it is telling me to connect to Itunes to unlock it but i no longer own the computer that i first connected it to, what do i do?

    Place the iPod in Recovery Mode and restore via iTunes. Unless you have an iCloud backup you will have to restore to factory settings/new iPod.
    iOS: Wrong passcode results in red disabled screen
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Who has the Unlimited Data Plan and has Been Speed Capped when You went over 5Gig?

    Just checking to see how many others have been speed capped to 200Kb on the unlimited data plan when they went over 5Gig in a billing cycle? (you can get a one time reprieve if you call them at 1-888-483-7200)
    Did they ask you to change your plan to 10Gig and Update your Equipment and sign a new two year agreement?
    Did you know that Sprint is offering unlimited Data on their 4G network and that Verizon is trying to lock down customers that are not on 2 year contracts? (Gives them time to catch up with the competition) Marcus in Fraud and Investigation told me (when I told him that Sprint was offering Unlimited Data)  "...That is a better option..." 
    I am now looking into other options along with allot of the rest of you.

    I was instructed to call that Fraud Department number and was treated like I had broken some kind of law instead of going over the 5 Gig fine print limit on my unlimited grandfathered in account. They would not even consider giving me a one time do over for being a MiFi newbie. I am hearing class action suit rumblings out there!!

  • Logitech, Snow Leopard. and kernel panics: who's the culprit?

    Up until this morning, I'd been considering this a Logitech issue, but their tech support just emailed me blaming Apple, so I'm posting it here.
    With versions 3.1, 3.2, and now 3.3 of the Logitech Control Center (driver software for mice and keyboards), I've consistently seen kernel panics fly by my verbose login, always at odds with iokit:
    6/26/10 7:24:43 PM kernel dependency: com.apple.iokit.IOUSBFamily(4.0.2)@0x8623d000
    6/26/10 7:24:43 PM kernel dependency: com.apple.iokit.IOHIDFamily(1.6.4)@0x85ff6000
    6/26/10 7:24:43 PM kernel dependency: com.apple.iokit.IOUSBHIDDriver(4.0.2)@0x86865000
    The computer always finishes starting up, and it doesn't appear to crash anything after it does so. That makes it more of a curiosity than a crisis, I suppose, but at the same time, no kernel panic is a good kernel panic, right? It has to be compromising the system in some way, so I'd like to get to the bottom of it.
    I like Logitech products, so my theory was that the release of Snow Leopard a couple years ago had simply caught them off guard, and that they might need version or two to get their software to play nicely with 10.4. But the recently released 3.3 of the LCC generates the exact same panics.
    So I emailed Logitech support. A charmingly named "Ms. Valentine" quickly responded, but embedded in form language, she told me to "Please contact you computer manufacturer, because this is Internal Fatal Error."
    So 1) is this in fact an Apple problem, or the passing of a buck? and 2) whoever's to blame, is this kernel panic anything to worry about?
    Thanks in advance for your thoughts and theories.

    Perhaps I should add some more detail. If you verbose login, the startup process is detailed in code on your screen. In this case, so many "backtrace (with dependencies)" cycles are detailed that they do indeed fly by. The full detail of each cycle:
    6/27/10 12:59:52 PM kernel Trying to change a collection in the registry
    6/27/10 12:59:52 PM kernel Backtrace 0x4ff608 0x4ff3aa 0xa0269d 0x9f803a 0xa023ef 0xa023ac 0xa02e01
    6/27/10 12:59:52 PM kernel Kernel Extensions in backtrace (with dependencies):
    6/27/10 12:59:52 PM kernel com.Logitech.Control Center.HID Driver(3.3.0)@0x9e9000->0xa13fff
    6/27/10 12:59:52 PM kernel dependency: com.apple.iokit.IOUSBFamily(4.0.2)@0x976000
    6/27/10 12:59:52 PM kernel dependency: com.apple.iokit.IOHIDFamily(1.6.4)@0x9a7000
    6/27/10 12:59:52 PM kernel dependency: com.apple.iokit.IOUSBHIDDriver(4.0.2)@0x9e3000
    Most of the folks I've read discussing this issue have called this a kernel panic, but maybe they're using the term loosely.
    In any case, the question remains: is this persistent issue an OSX one, or a Logitech one; and either way, is it compromising anything?

  • My hard drive failed and I can't afford the professional data recovery.  Do I have any other options?

    I have a 13" Early 2011 Macbook Pro.  Last week the hard drive failed (for the second time), and when I took it to the Apple Store I was told it would cost $177 to replace the hard drive and the cables.  I intend on going through with this and getting it fixed, however the man I talked to said I should hold on to it a little longer before giving it to them for repair in case I want to recover my data.  When I researched how to recover the data, my answers mostly consisted of taking it to a professional to do so.  I found a local authorized service provider who said they could do so, however I was told it would cost at least $400 to recover my data (possibly more depending on how much data there is to recover).
    I can afford to pay $177 to fix the hard drive.  I cannot, however, afford to pay an additional $400+ to get all of my data back.  Yes I realize I should have backed my files up onto an external hard drive (I'm not the most computer-savvy person), but honestly, all I really need is my photos.  When my hard drive was in the process of failing, I got a flash drive and put a lot of my files onto it so I would at least have some of them when I got my Macbook fixed.  At this point, I can't even turn it on, so I am not able to go into iPhoto and get my pictures.
    Is there any way I can do this myself?  There is no way I can get this done professionally.  I would love to be able to all of my data and files back, but if I can just get some that is better than nothing.  Any help would be appreciated!

    obesity wrote:
    It was really empty. Clicked on, nothing.
    But no prohibited signs, like these:
    Get info on folder, zero kb. Just one user account on each mac.
    I did navigate back several days prior to my Mac dying. Still nothing.
    Sounds like it may have been excluded, or perhaps damaged. 
    Just for future reference, it's always a good idea to keep "secondary" backups.  See #27 in Time Machine - Frequently Asked Questions for some suggestions.

  • I use a SpeedPort W700V as WiFi Router. SpeedPort encrypt the WiFi data and iPAD doesn't deencrypt the WiFi data. How to initialize the Encrypt / Deencrypt function of iPAD ? (including shared keys)

    I use SpeedPort W700V from German Telekom as router for my WiFi and DSL access. DSL connection to Internet is proper running, WiFi with iPAS does only work if I switch of the Encryption mode of SpeedPort (Standard parameter in SpeedPort is WPA2 with shared key PSK).  Who can give a hint how to switch on the encryption / deencryption mode of iPAD 2. 3G Sim Card is currently not installed.

    Thanks for the quick response. No, I did not get any error messages or any terms-of-usage screen. The employee I told my problem to was not computer savvy either. She just suggested I move to different spots w/in the library to see if that would make a difference. It didn't. When I connected to the library WiFi it did change the Verizon 3G that is usually in the upper left corner to iPad with two to three emanating arcs. I may have to go to the library in the next town. I was able to connect to theirs in the past when I had to download something greater than 20 MB. Unless I really want it, I will probably not even try to download something more than 20 MB due to the hassle. Yeah, I may have been better off getting a normal desktop or laptop and getting WiFi at home. To do that now would mean having my iPad 2 and a desktop computer, which I feel is extravagant. (I know there are a lot of big spenders out there who got the iPad as additional gadget for fun. This is a rich country.) A Verizon rep told me I couldn't set up a WiFi router at home just using an iPad. So it seems like a person who just uses 3G is limited to surfing the net (not even much YouTube because it eats a lot of data) and using email. I read about an app that helps print wirelessly using 3G, but a reviewer said you had to be an engineer to get it done right. BTW, I like the Steelers. I'm old enough to remember Franco Harris and that blond guy whose name escapes me back in the '70s. Since I live in North Jersey I feel I have to support the Giants. But I know football about as well as computers.

  • I need a new phone and ipod, would I be able to use an iPhone as a phone and iPod only and not have to buy the internet data plan?

    I need a new phone and iPod, would I be able to use an iPhone as a phone and iPod, without having to purchase the internet date plan?

    You cannot do this.  iPhones have to be activated with a service plan before any of the features, including the iPod features can be used.

  • To extend SAP user date and to add months to the current date

    Hi All,
    I need to extent the user date in SAP based on one condition.
    If the condition is true extend the date by 12 monthd if false 6 months from the current date.
    Can i have the FM for user date extentions and FM for getting the date.
    Thanks,
    Chandu.

    Hi ,
    You can use this FM for exteding the date.
    CALL FUNCTION 'BAPI_USER_CHANGE'
        EXPORTING
          username   = us_username
          logondata  = e_bapilogond
          logondatax = e_bapilogondx
        TABLES
          return     = i_return.
    u need to pass date and correspoing flag also.
    For extension of the date by months u can use this FM.
          CALL FUNCTION 'MONTH_PLUS_DETERMINE'
            EXPORTING
              months  = 6 or 12 ( depending up on ur logic)
              olddate = sy-datum
            IMPORTING
              newdate = us_expdate.
    Thanks and regards.
    Sham

  • Min,Max for a time Range and Sum of Records for the last date/time

    Hi All,
    I have a table with the following structure/data:
    create table  Events   (
                                        [EventID]       
    int                   NOT NULL,
                                        [Title]            
    nvarchar(200)  NOT NULL,
                                        [SourceName]  nvarchar(20)    NOT NULL,
                                        [Type]             
    int                  NOT NULL,
                                        [eDate]           
    datetime
    insert into Events values(100, 'Event 1', 'S01', 3,'2014-01-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S07', 3,'2014-01-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S08', 3,'2014-01-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S09', 3,'2014-01-01 00:00:00.000')
    insert into Events values(101, 'Event 2', 'S010', 3,'2014-01-01 00:00:00.000')
    insert into Events values(102, 'Event 3', 'S03', 3,'2014-01-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S04', 3,'2014-01-01 00:00:00.000')
    insert into Events values(101, 'Event 2', 'S05', 3,'2014-01-01 00:00:00.000')
    insert into Events values(102, 'Event 3', 'S06', 3,'2014-01-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S01', 3,'2014-02-01 00:00:00.000')
    insert into Events values(101, 'Event 2', 'S02', 3,'2014-02-01 00:00:00.000')
    insert into Events values(102, 'Event 3', 'S03', 3,'2014-02-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S04', 3,'2014-02-01 00:00:00.000')
    insert into Events values(101, 'Event 2', 'S05', 3,'2014-02-01 00:00:00.000')
    insert into Events values(102, 'Event 3', 'S06', 3,'2014-02-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S01', 3,'2014-03-01 00:00:00.000')
    insert into Events values(101, 'Event 2', 'S02', 3,'2014-03-01 00:00:00.000')
    insert into Events values(102, 'Event 3', 'S03', 3,'2014-03-01 00:00:00.000')
    insert into Events values(100, 'Event 1', 'S04', 3,'2014-03-01 00:00:00.000')
    insert into Events values(101, 'Event 2', 'S05', 3,'2014-03-01 00:00:00.000')
    insert into Events values(102, 'Event 3', 'S06', 3,'2014-03-01 00:00:00.000')
    And I wrote the following query:
     select EventID as [Event ID],
           Title, 
           count(distinct(SourceName)) as [Instances], 
           Type,
           min(eDate) as  [First Detected],
           max(eDate) as [Last Detected],
           datediff(d,min(eDate),max(eDate)) as [Delta (days)]
    from  Events
    where type = 3
    group by EventID, Title, Type
    having max(eDate) <> min(eDate)
       and max(eDate) =(select top 1 eDate from Events order by eDate desc)
    and I get the following results (see the instance number)
    Event ID Title         Instances Type First Detected                      Last Detected                    
       Delta (days)
    =============================================================================================================================
    100         Event 1         5         3    2014-01-01 00:00:00.000     2014-03-01 00:00:00.000    
    59
    101         Event 2        
    3         3    2014-01-01 00:00:00.000     2014-03-01 00:00:00.000     59
    102         Event 3        
    2         3    2014-01-01 00:00:00.000     2014-03-01 00:00:00.000     59
    This is normal for this query however what I need to do is a little different.
    In other words, while I need to show when we recorded a specific event first and last time,
    I need to display the results for the last date/time when it was recorded. 
    For example what I need to provide should look like this:
    Event ID  Title                Instances        Type       First Detected                    
    Last Detected                          Delta (days)
    =============================================================================================================================
    100         Event 1            2                   3           
    2014-01-01 00:00:00.000     2014-03-01 00:00:00.000      59
    101         Event 2            2                   3           
    2014-01-01 00:00:00.000     2014-03-01 00:00:00.000      59
    102         Event 3           
    2                   3            2014-01-01 00:00:00.000     2014-03-01 00:00:00.000     
    59
    Could you please help me to fix this query?
    TIA,
    John

    ;With cte As
    (Select EventID as [Event ID],
    Title,
    SourceName,
    Type,
    min(eDate) Over(Partition By EventID, Title, Type) as [First Detected],
    max(eDate) Over(Partition By EventID, Title, Type) as [Last Detected],
    eDate,
    datediff(d,min(eDate) Over(Partition By EventID, Title, Type),max(eDate) Over(Partition By EventID, Title, Type)) as [Delta (days)],
    max(eDate) Over() As MaxEDate
    from Events
    where type = 3)
    Select [Event ID],
    Title,
    COUNT(Distinct SourceName) As Instances,
    Type,
    [First Detected],
    [Last Detected],
    [Delta (days)]
    From cte
    Where eDate = MaxEDate And [First Detected] <> [Last Detected]
    Group By [Event ID],
    Title,
    Type,
    [First Detected],
    [Last Detected],
    [Delta (days)];
    Tom
    P.S. Thanks for providing the DDL and data.  That is always very helpful.

  • I have a Mac Book (2006) All my saved emails for two and a half years have the same date. How do I get the original dates back?

    From the "date and time" I tried to drag the month and year to my menu bar. It did not stay, so I did it several times, but to no avail. I closed the window and went back to my Thunderbird email only to find that the date I tried to use became the date in the "date received" column of all of my emails from back to 2011. I changed the date a few days later, and then the date changed on all of my emails. I would like to undo whatever I did to the dates so that the emails show when they were originally received. I did manage to get "the order received" which helps a little, but I cannot see the original dates.
    I have checked "Set date and time automatically" but it doesn't change the dates on my saved emails.

    I at first thought it might be a Mac thing, but I couldn't find a solution. I realized that the date only affected my email, so then I thought it must be a Mozilla problem.

  • Create Registerform and a search possibility within the registered data

    Hi,
    what I am trying to figure out with Muse is to create a simple register form. And having a search engine within the site to search for several registered persons.
    For example:
    I am planning on building a site where people can register themselves through a form. Somehow all the registered people are saved in a database. And through a keyword all the people with that same keyword are shown in a result box.
    Is something like this possible with muse using several widgets?
    Larry

    Hi Larry,
    Take a look to this thread, discussing a similar scenario
    Re: How can someone create an account/register on my website?
    If you still have some doubts, you can ask here.

Maybe you are looking for

  • Custom XPath Function not working - ORABPEL-09503 error

    I wrote a simple date conversion custom xpath function. 1. Implemented IXPathFunction as mentioned in Clemens and Antony Reynolds blog. 2. Also changed the xpath-functions.xml kept at C:\product\10.1.3.1\OracleAS_1\bpel\system\config\xpath-functions.

  • Drop in speed and higher pings

    Hi, i guess this has been mentioned before on here but i think the G.inp activation has happened on my cabinet. i was using a Eci modem but read the huawei modem may solve the G.inp problem but didnt. I connected my Asus Vdsl/Router to the line and t

  • SAP  document or SAP help weblink for Periodic billing & Aperiodic bi

    Hi Experts, Please share the detail SAP  document or SAP help weblink  related following ISU billing process 1) Periodic billing 2) Aperiodic billing

  • Change the ring tone on Lync Mobile 2013

    Is there any way to change the ringtone played by the mobile device when a VoIP call comes in to the Lync 2013 mobile device client? There doesn't appear to be any option within the mobile client to set this. The device in question is iPhone, however

  • IPhone 5 has started rebooting randomly!!!

    My iPhone 5 (Model: A1429) had developed a quite strange and very annoying problem lately. It was running on iOS 7.0.4 when the problem started. I have been trying to recreate it but it happens randomly. I have concluded that the reboot intensifies w