ORA-14758: Last partition in the range section cannot be dropped

Hi,
I am trying to  truncate table for 30 days or older records but I am getting below error.
I ran an block like below
FOR i IN (SELECT *
               FROM user_tab_partitions
              WHERE table_name = 'XXX' AND partition_position > 1)
   LOOP
      vHIGH_VALUE := i.HIGH_VALUE;
      IF vHIGH_VALUE <
            ('TO_DATE('' ' || TO_CHAR (SYSDATE - 30, 'YYYY-MM-DD'))
      THEN
         vSQL :=
               'alter table XXXX drop partition '
            || i.partition_name
            || ' -- '
            || SUBSTR (vHIGH_VALUE, 1, 20);
         DBMS_OUTPUT.put_line (vSQL);
         EXECUTE IMMEDIATE vSQL;
ORA-14758: Last partition in the range section cannot be dropped
Thanks for your help.

I am trying to  truncate table for 30 days or older records but I am getting below error.
No - you are not. You are trying to DROP those partitions, not just truncate them.
               'alter table XXXX drop partition '
ORA-14758: Last partition in the range section cannot be dropped 
You CANNOT drop the last non-interval partition. Period. There are no WORK-AROUNDS.
Go ahead and TRUNCATE that partition if you want.

Similar Messages

  • Print range does not print the last page in the range.

    Adobe Reader for New IPAD - The print range function does not print the last page in the range. For example, if you enter a print range of 2-18, pages 2-17 print and page 18 does not print.  Also, if you enter a print range of 9-9, page 8 prints and page 9 does not print.

    I have the Epson 4540 printer. I don't know for sure if it connects via AirPrint.  I didn't do any thing to set up Air Print.  The printer is attached directly to my network router and it shows up IPad apps.  I have not printed docs from other apps, but I will give it try and let you know.
    Christopher J. Bilcz
    [email protected]

  • Crystal Report error - "the group section cannot be printed..."

    Hello to everyone.
    I have a CR report based on a database view.
    Everything is ok when i run the report in the CR designer but choosing the option to preview the report or run it from the SAP Business One (8.81 PL 08) i get an error:
    "the group section cannot be printed because its condition field is nonexistent or invalid. Format the section to choose another condition field. Error in file "the Report name".rpt. Invalid group condition".
    i must say that this happens in all my reports where i have group data. Also i must say that all those reports were ok some days before...
    Is there a way for me to know what field is it refering to?
    I have verified the DB and it is pointing correctly and the also the View returns data.
    Thanks in advance

    Hello Gordon,
    thanks for your response. the reports were working fine until 8.81 PL05
    We have upgraded the customer from PL05 - > PL08 a week ago.
    Do you think that maybe this is the problem?
    Thanks in advance

  • The certificate 'instance' cannot be dropped because it is bound to one or more database encryption key.

    my question is the as this one on this link
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/55deada2-95f1-46a9-82be-c7e684a4bddb/the-certificate-certname-cannot-be-dropped-because-it-is-bound-to-one-or-more-database-encryption?forum=sqlreplication. but there is no clear answer what to
    do . would anyone please help me and give me guidance?
    i had create a master key and a certificate under master database. and now i want to drop these certificate and master key from  this database and face with this error  :sg 3716, Level 16, State 15, Line 1
    The certificate 'TDECert' cannot be dropped because it is bound to one or more database encryption key .
    thanks in advance

    Have you enaled TDE for any user database? if yes, and you do not want to continue with having TDE encryption, then you need to run the first command by changing the dbname to that user database instead of master.
    ALTER DATABASE DBName SET ENCRYPTION OFF
    You can run below command to see if any database are encrypted using TDE
    Select is_encrypted,* from sys.databases
    Keerthi Deep | Blog SQLServerF1 |
    Facebook

  • Resize last partition on external disk

    Hi, All!
    I have a 1.5 TB external disk that I use for storing large media files and for Time Machine backups.
    Since Time Machine tends to use all space available in a disk, I decided to partition the available space giving 1 TB for data and 500 GB for Time Machine. My internal disk was 250 GB, so 500 GB was enough for some history in the backup.
    I upgraded my internal disk to 500GB, so the space available for Time Machine is a bit constrained now. I thought I could shrink the data partition (it is still mostly empty) and enlarge the Time Machine partition, but Disk Utility isn't allowing me to do that.
    The data partition is the first one on the disk. I've already successfully shrank it to 700 GB. The Time Machine is the second and last partition.
    The trouble is that the resizing "handle" is at the "bottom" of the partition, and can't be moved "down". Disk Utility doesn't allow me to grab the "top" of the partition and move it "up".
    The disk is partitioned using GUID and I'm running Snow Leopard 10.6.2.
    My doubt is: should this work or I'm expecting too much from Disk Utility resizing capabilities?
    Is there any way to do what I've been trying to do without reformatting any of the two partitions?
    Regards!

    What I did was:
    1. Resize the first HFS+ partition to about half disk, leaving blank space between it and the second partition.
    2. Boot the MacBook with a Ubuntu Live CD (last version). It works perfectly!
    3. Run GParted and move the second partition to the beginning of the free space;
    4. Reboot to Mac OS X.
    5. Verify and repair the external disk with Disk Utility. It found a minor error on the volume header of the second partition.
    6. Resize the second partition to the end of free space.
    It took about 9 hours to complete, but it is working and Time Machine is doing its first backup now.

  • Partitioning the database from the most recent to the last partitioned

    Hi everyone
    We have a huge database which is partitioned based on datetime column and for each month. The last partition that we have on it was for 12/1/2013. And since then we have accumulated data with millions of rows already till 3/1/2015.
    We want to continue to add partitions for the next two years to it now.
    Since splitting the last partition from 12/1/2013 to 1/1/2014 is pretty painful and then to split 1/1/2014 to 2/1/2014, We were thinking if there is a way to split from the back. Like add a partition for 2/1/2015 so that data for Feb only
    goes there and the 1/1/2015 and then making our way back to 1/1/2014.
    So far I have a script for going from 12/1/2013 to 1/1/2014 and the 1/1/2014 to 2/1/2014. Something like this
    ALTER
    PARTITION SCHEME MonthlyPartitionScheme
    NEXT
    USED [PRIMARY]
    GO
    ALTER
    PARTITION
    FUNCTION PartitionByMonth()
    SPLIT
    RANGE
    ('1/1/2014')
    Go
    ALTER
    PARTITION SCHEME MonthlyPartitionScheme
    NEXT
    USED [PRIMARY]
    GO
    ALTER
    PARTITION
    FUNCTION PartitionByMonth()
    SPLIT
    RANGE
    ('2/1/2014')
    Go
    How can I change to make it work backwards from 2/1/2015 to 1/1/2015 and then 1/1/2015 to 12/1/2014 and so on. I am looking at more resources online, any help with this would be appreciated.
    Thanks much
    -Sarah

    yes, i also think merge partition maybe can help you solve problem, you want to move some data to a new partition, so i also suggest you to use this one way, because splitting partition is time-consuming. Once i read one article, which can do this task,
    more information click here:
    how to merge partitions. It seems some partition software can do this, some reviews like:  http://dottech.org/95676/windows-best-free-partition-and-disk-manager-review  among them, i used aomei partition assistant, its server version is supported
    in server OS, maybe it is useful for you.You also can use another partition manager, merge partitions instead of splitting partition. 

  • Have a 802.11n time capsule, the range of the wireless network has shrunk down to nothing over last few days. Used to be able to use wireless network anywhere in house, but now can only use in my office. Will not connect to iphones, ipad, itouch, or noteb

    Have a 802.11n time capsule, the range of the wireless network has shrunk down to nothing over last few days. Used to be able to use wireless network anywhere in house, but now can only use in my office. Will not connect to iphones, ipad, itouch, or notebook. Worked fine last week, but over weekend just started having issues.

    It is very possible that you may have some form of Wi-Fi interference that has appeared recently that is preventing your Time Capsule (TC) from providing a clean RF signal.
    I suggest you perform a simple site survey, using utilities like iStumbler, or AirRadar to determine potential areas of interference, and then, try to either eliminate or significantly reduce them where possible. Look for other Wi-Fis that may be operating nearby. Note those with the strongest signals and which channels they are operating on ... then change the channel used by the TC to be at least 3-5 channels away.

  • I am unable to mount my NTFS partition after the last update

    I usually mounted my NTFS partition with the "gnome-disk" utility. It works no longer, only if I start it with "sudo". But in this case the mount point will be in a directory called "root" and this cause several problems, eg.: old hardcoded paths stop working in scripts. What can I do to make the gnome-disk utility work as an ordinary user.

    Thx, maybe I could use the fstab to mount the partition, am I right? But I don't know how to do it properly, because when I tried it in the past native hungarian characters iny the file and directory names always caused problems. If I somehow could capture the command sequence which the gnome-disk utility passes to the kernel / bash, would be helpful.

  • "ORA-14400: inserted partition key does not map to any partition"

    Hi Experts,
    While loading from DSO to Infocube, we are facing the below issue.,
    Database error text........: "ORA-14400: inserted partition key does no
    any partition"
    Internal call code.........: "[RSQL/INSR//BIC/FZORIMB08C ]"
    Please check the entries in the system log (Transaction SM21).
    "DBIF_RSQL_SQL_ERROR" "CX_SY_OPEN_SQL_DB"
    "GP4JNZKXF93GTRTVQO7A5J3Z2VD" or "GP4JNZKXF93GTRTVQO7A5J3Z2VD"
    "WRITE_ICFACT"
    Information on where terminated:
    Termination occurred in the ABAP program "GP4JNZKXF93GTRTVQO7A5J3Z2VD" - in
    "WRITE_ICFACT".
    The main program was "RSBATCH_EXECUTE_PROZESS ".
    In the source code you have the termination point in line 5185
    of the (Include) program "GP4JNZKXF93GTRTVQO7A5J3Z2VD".
    The program "GP4JNZKXF93GTRTVQO7A5J3Z2VD" was started as a background job.
    Job Name....... "BIDTPR_1999057_1"
    Job Initiator.. "ALE_POS"
    Job Number..... 09074400
    The termination is caused because exception "CX_SY_OPEN_SQL_DB" occurred in
    procedure "WRITE_ICFACT" "(FORM)", but it was neither handled locally nor
    declared
    in the RAISING clause of its signature.
    The procedure is in program "GP4JNZKXF93GTRTVQO7A5J3Z2VD "; its source code
    begins in line
    5147 of the (Include program "GP4JNZKXF93GTRTVQO7A5J3Z2VD ".
    Can anyone help me.
    Regards,
    Aaryan

    Hi Aaryan,
    From an Oracle point of view the error ORA-14400 is due to the partition range where an insert rows with a value out-of-bound of partition range
    The system displays the error message if you want to load data into a partitioned table where the partitions have not been defined correctly.
    Please run the RSRV test "Entries Not Used in the Dimension of an InfoCube " for the relevant Infocube and afterwards repair any errors with "Correct error" button.
    Please have a look at the following notes:
      #509660 - ORACLE ERROR 14400 during update to the InfoCube
      #590370 - too many uncompressed request (f table partitions)
    Finally please do not leave the infocube uncompressed.
    Rgds,
    Colum

  • Locator Error ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine

    I am trying to setup Intermedia Locator and am trying to create the Locator index per the code below. Any ideas why I am getting the below error, and what I can do about it.
    Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
    With the Partitioning option
    JServer Release 8.1.6.0.0 - Production
    SQL> desc zip_codes
    Name Null? Type
    ZIPC_ZIP5 NOT NULL VARCHAR2(5)
    ZIPC_SDO_GEOMETRY MDSYS.SDO_GEOMETRY
    ZIPC_GEOCODE_RESULT MDSYS.GEOCODE_RESULT
    SQL> execute geocoder_http.setup_locator_index('zip_codes','zipc_sdo_geometry');
    BEGIN geocoder_http.setup_locator_index('zip_codes','zipc_sdo_geometry'); END;
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13224: specified index name is too long for a spatial index
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 7
    ORA-06512: at line 1
    ORA-06512: at "MDSYS.GEOCODER_HTTP", line 168
    ORA-06512: at line 1
    Thanks,
    Bob Mann

    Hi Raju,
    There are a few things I would change below.
    The first is that optimized rectangles (which you are using) need to be specified as lower left then upper right, assuming the lowest values are in the lower left corner of the coordinate system.
    The way you've specified them is upper left, lower right which will not work.
    The second thing I would change is your create index statement. You shouldn't be using locater to create the index - locator is a separate product should be used only with point geometries.
    Your create index statement should look something like this:
    create index zonetemp_sidx on zonetemp(shape)
    indextype is mdsys.spatial_index
    parameters ('sdo_level=NN');
    where NN above is an integer number representing the tiling level you are going to use for the index. This is workload dependent, but I will give you a range of 8-12 to start with - you can protype using real data and figure out what gives you the best performance - if it is 12 you may want to go higher.
    Also, you will have had to preload user_sdo_geom_metadata.
    Finally, your query looks good, although I would change it slightly to set the third ordinate to NULL rather than 0, i.e.:
    SELECT NAME
    FROM ZONETEMP A
    WHERE SDO_FILTER (A.SHAPE,
    MDSYS.SDO_GEOMETRY(2001,null,
    MDSYS.SDO_POINT_TYPE(20,20,NULL),
    NULL, NULL)),'QUERYTYPE='WINDOW')
    ='TRUE'
    Hope this helps,
    dan

  • Partitioning on the base of date

    hi,
    im having a PROBLEM IN CREATING A TABLE containing a date column having range partitioning on it. my table an accompanying error is :
    CREATE TABLE A123 (A NUMBER, B DATE)
    PARTITION BY RANGE (B)
    (PARTITION B1 VALUES LESS THAN (TO_DATE((SYSDATE - INTERVAL '30' DAY),'DD-MON-YYYY')))
    (PARTITION B1 VALUES LESS THAN (TO_DATE((SYSDATE - INTERVAL '30' DAY),'DD-MON-YYYY')))
    ERROR at line 3:
    ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE
    i'v also tried it as:
    CREATE TABLE A123 (A NUMBER, B DATE)
    PARTITION BY RANGE (B)
    (PARTITION B1 VALUES LESS THAN (TO_DATE(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')))
    (PARTITION B1 VALUES LESS THAN (TO_DATE(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')))
    ERROR at line 3:
    ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE
    as shown above,,i want to create partitions of the table A123 column b which is of date datatype,,i want to have a partition which stores data of SYSDATE - 30,.
    Any suggestions/recommendations would be appreciated.
    thanx
    Regards

    hi,
    sorry im calling u again for support,,
    the way u told for creating a table based on date column partitions creates a table with fixed date as a HIGH/UPPER BOUND,,for example if i create a table A123 as :
    begin
    execute immediate 'CREATE TABLE A123 (A NUMBER, B DATE)
    PARTITION BY RANGE (B)
    (PARTITION B4 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '90' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
    ,PARTITION B3 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '60' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
    ,PARTITION B2 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
    ,PARTITION B1 VALUES LESS THAN (MAXVALUE))';
    end;
    ALTER TABLE A123 ENABLE ROW MOVEMENT
    now the HIGH VALUE for partition B2 is January 03,2005...
    while i want it to be dynamic.
    means after 2 months the high value for B2 partition should be (Jan 03,2005 + 2 months)..
    can we do this in oracle??
    Regards.

  • Sliding Window Table Partitioning Problems with RANGE RIGHT, SPLIT, MERGE using Multiple File Groups

    There is misleading information in two system views (sys.data_spaces & sys.destination_data_spaces) about the physical location of data after a partitioning MERGE and before an INDEX REBUILD operation on a partitioned table. In SQL Server 2012 SP1 CU6,
    the script below (SQLCMD mode, set DataDrive  & LogDrive variables  for the runtime environment) will create a test database with file groups and files to support a partitioned table. The partition function and scheme spread the test data across
    4 files groups, an empty partition, file group and file are maintained at the start and end of the range. A problem occurs after the SWITCH and MERGE RANGE operations, the views sys.data_spaces & sys.destination_data_spaces show the logical, not the physical,
    location of data.
    --=================================================================================
    -- PartitionLabSetup_RangeRight.sql
    -- 001. Create test database
    -- 002. Add file groups and files
    -- 003. Create partition function and schema
    -- 004. Create and populate a test table
    --=================================================================================
    USE [master]
    GO
    -- 001 - Create Test Database
    :SETVAR DataDrive "D:\SQL\Data\"
    :SETVAR LogDrive "D:\SQL\Logs\"
    :SETVAR DatabaseName "workspace"
    :SETVAR TableName "TestTable"
    -- Drop if exists and create Database
    IF DATABASEPROPERTYEX(N'$(databasename)','Status') IS NOT NULL
    BEGIN
    ALTER DATABASE $(DatabaseName) SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    DROP DATABASE $(DatabaseName)
    END
    CREATE DATABASE $(DatabaseName)
    ON
    ( NAME = $(DatabaseName)_data,
    FILENAME = N'$(DataDrive)$(DatabaseName)_data.mdf',
    SIZE = 10,
    MAXSIZE = 500,
    FILEGROWTH = 5 )
    LOG ON
    ( NAME = $(DatabaseName)_log,
    FILENAME = N'$(LogDrive)$(DatabaseName).ldf',
    SIZE = 5MB,
    MAXSIZE = 5000MB,
    FILEGROWTH = 5MB ) ;
    GO
    -- 002. Add file groups and files
    --:SETVAR DatabaseName "workspace"
    --:SETVAR TableName "TestTable"
    --:SETVAR DataDrive "D:\SQL\Data\"
    --:SETVAR LogDrive "D:\SQL\Logs\"
    DECLARE @nSQL NVARCHAR(2000) ;
    DECLARE @x INT = 1;
    WHILE @x <= 6
    BEGIN
    SELECT @nSQL =
    'ALTER DATABASE $(DatabaseName)
    ADD FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';
    ALTER DATABASE $(DatabaseName)
    ADD FILE
    NAME= ''$(TableName)_f' + CAST(@x AS CHAR(5)) + ''',
    FILENAME = ''$(DataDrive)\$(TableName)_f' + RTRIM(CAST(@x AS CHAR(5))) + '.ndf''
    TO FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';'
    EXEC sp_executeSQL @nSQL;
    SET @x = @x + 1;
    END
    -- 003. Create partition function and schema
    --:SETVAR TableName "TestTable"
    --:SETVAR DatabaseName "workspace"
    USE $(DatabaseName);
    CREATE PARTITION FUNCTION $(TableName)_func (int)
    AS RANGE RIGHT FOR VALUES
    0,
    15,
    30,
    45,
    60
    CREATE PARTITION SCHEME $(TableName)_scheme
    AS
    PARTITION $(TableName)_func
    TO
    $(TableName)_fg1,
    $(TableName)_fg2,
    $(TableName)_fg3,
    $(TableName)_fg4,
    $(TableName)_fg5,
    $(TableName)_fg6
    -- Create TestTable
    --:SETVAR TableName "TestTable"
    --:SETVAR BackupDrive "D:\SQL\Backups\"
    --:SETVAR DatabaseName "workspace"
    CREATE TABLE [dbo].$(TableName)(
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_scheme(Partition_PK)
    ) ON $(TableName)_scheme(Partition_PK)
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_GUID_PK] DEFAULT (newid()) FOR [GUID_PK]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateServer] DEFAULT (@@servername) FOR [CreateServer]
    -- 004. Create and populate a test table
    -- Load TestTable Data - Seconds 0-59 are used as the Partitoning Key
    --:SETVAR TableName "TestTable"
    SET NOCOUNT ON;
    DECLARE @Now DATETIME = GETDATE()
    WHILE @Now > DATEADD(minute,-1,GETDATE())
    BEGIN
    INSERT INTO [dbo].$(TableName)
    ([Partition_PK]
    ,[RandomNbr])
    VALUES
    DATEPART(second,GETDATE())
    ,ROUND((RAND() * 100),0)
    END
    -- Confirm table partitioning - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber
    --=================================================================================
    -- SECTION 2 - SWITCH OUT
    -- 001 - Create TestTableOut
    -- 002 - Switch out partition in range 0-14
    -- 003 - Merge range 0 -29
    -- 001. TestTableOut
    :SETVAR TableName "TestTable"
    IF OBJECT_ID('dbo.$(TableName)Out') IS NOT NULL
    DROP TABLE [dbo].[$(TableName)Out]
    CREATE TABLE [dbo].[$(TableName)Out](
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)Out] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_fg2;
    GO
    -- 002 - Switch out partition in range 0-14
    --:SETVAR TableName "TestTable"
    ALTER TABLE dbo.$(TableName)
    SWITCH PARTITION 2 TO dbo.$(TableName)Out;
    -- 003 - Merge range 0 - 29
    --:SETVAR TableName "TestTable"
    ALTER PARTITION FUNCTION $(TableName)_func()
    MERGE RANGE (15);
    -- Confirm table partitioning
    -- Original source of this query - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber  
    The table below shows the results of the ‘Confirm Table Partitioning’ query, before and after the MERGE.
    The T-SQL code below illustrates the problem.
    -- PartitionLab_RangeRight
    USE workspace;
    DROP TABLE dbo.TestTableOut;
    USE master;
    ALTER DATABASE workspace
    REMOVE FILE TestTable_f3 ;
    -- ERROR
    --Msg 5042, Level 16, State 1, Line 1
    --The file 'TestTable_f3 ' cannot be removed because it is not empty.
    ALTER DATABASE workspace
    REMOVE FILE TestTable_f2 ;
    -- Works surprisingly!!
    use workspace;
    ALTER INDEX [PK_TestTable] ON [dbo].[TestTable] REBUILD PARTITION = 2;
    --Msg 622, Level 16, State 3, Line 2
    --The filegroup "TestTable_fg2" has no files assigned to it. Tables, indexes, text columns, ntext columns, and image columns cannot be populated on this filegroup until a file is added.
    --The statement has been terminated.
    If you run ALTER INDEX REBUILD before trying to remove files from File Group 3, it works. Rerun the database setup script then the code below.
    -- RANGE RIGHT
    -- Rerun PartitionLabSetup_RangeRight.sql before the code below
    USE workspace;
    DROP TABLE dbo.TestTableOut;
    ALTER INDEX [PK_TestTable] ON [dbo].[TestTable] REBUILD PARTITION = 2;
    USE master;
    ALTER DATABASE workspace
    REMOVE FILE TestTable_f3;
    -- Works as expected!!
    The file in File Group 2 appears to contain data but it can be dropped. Although the system views are reporting the data in File Group 2, it still physically resides in File Group 3 and isn’t moved until the index is rebuilt. The RANGE RIGHT function means
    the left file group (File Group 2) is retained when splitting ranges.
    RANGE LEFT would have retained the data in File Group 3 where it already resided, no INDEX REBUILD is necessary to effectively complete the MERGE operation. The script below implements the same partitioning strategy (data distribution between partitions)
    on the test table but uses different boundary definitions and RANGE LEFT.
    --=================================================================================
    -- PartitionLabSetup_RangeLeft.sql
    -- 001. Create test database
    -- 002. Add file groups and files
    -- 003. Create partition function and schema
    -- 004. Create and populate a test table
    --=================================================================================
    USE [master]
    GO
    -- 001 - Create Test Database
    :SETVAR DataDrive "D:\SQL\Data\"
    :SETVAR LogDrive "D:\SQL\Logs\"
    :SETVAR DatabaseName "workspace"
    :SETVAR TableName "TestTable"
    -- Drop if exists and create Database
    IF DATABASEPROPERTYEX(N'$(databasename)','Status') IS NOT NULL
    BEGIN
    ALTER DATABASE $(DatabaseName) SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    DROP DATABASE $(DatabaseName)
    END
    CREATE DATABASE $(DatabaseName)
    ON
    ( NAME = $(DatabaseName)_data,
    FILENAME = N'$(DataDrive)$(DatabaseName)_data.mdf',
    SIZE = 10,
    MAXSIZE = 500,
    FILEGROWTH = 5 )
    LOG ON
    ( NAME = $(DatabaseName)_log,
    FILENAME = N'$(LogDrive)$(DatabaseName).ldf',
    SIZE = 5MB,
    MAXSIZE = 5000MB,
    FILEGROWTH = 5MB ) ;
    GO
    -- 002. Add file groups and files
    --:SETVAR DatabaseName "workspace"
    --:SETVAR TableName "TestTable"
    --:SETVAR DataDrive "D:\SQL\Data\"
    --:SETVAR LogDrive "D:\SQL\Logs\"
    DECLARE @nSQL NVARCHAR(2000) ;
    DECLARE @x INT = 1;
    WHILE @x <= 6
    BEGIN
    SELECT @nSQL =
    'ALTER DATABASE $(DatabaseName)
    ADD FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';
    ALTER DATABASE $(DatabaseName)
    ADD FILE
    NAME= ''$(TableName)_f' + CAST(@x AS CHAR(5)) + ''',
    FILENAME = ''$(DataDrive)\$(TableName)_f' + RTRIM(CAST(@x AS CHAR(5))) + '.ndf''
    TO FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';'
    EXEC sp_executeSQL @nSQL;
    SET @x = @x + 1;
    END
    -- 003. Create partition function and schema
    --:SETVAR TableName "TestTable"
    --:SETVAR DatabaseName "workspace"
    USE $(DatabaseName);
    CREATE PARTITION FUNCTION $(TableName)_func (int)
    AS RANGE LEFT FOR VALUES
    -1,
    14,
    29,
    44,
    59
    CREATE PARTITION SCHEME $(TableName)_scheme
    AS
    PARTITION $(TableName)_func
    TO
    $(TableName)_fg1,
    $(TableName)_fg2,
    $(TableName)_fg3,
    $(TableName)_fg4,
    $(TableName)_fg5,
    $(TableName)_fg6
    -- Create TestTable
    --:SETVAR TableName "TestTable"
    --:SETVAR BackupDrive "D:\SQL\Backups\"
    --:SETVAR DatabaseName "workspace"
    CREATE TABLE [dbo].$(TableName)(
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_scheme(Partition_PK)
    ) ON $(TableName)_scheme(Partition_PK)
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_GUID_PK] DEFAULT (newid()) FOR [GUID_PK]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateServer] DEFAULT (@@servername) FOR [CreateServer]
    -- 004. Create and populate a test table
    -- Load TestTable Data - Seconds 0-59 are used as the Partitoning Key
    --:SETVAR TableName "TestTable"
    SET NOCOUNT ON;
    DECLARE @Now DATETIME = GETDATE()
    WHILE @Now > DATEADD(minute,-1,GETDATE())
    BEGIN
    INSERT INTO [dbo].$(TableName)
    ([Partition_PK]
    ,[RandomNbr])
    VALUES
    DATEPART(second,GETDATE())
    ,ROUND((RAND() * 100),0)
    END
    -- Confirm table partitioning - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber
    --=================================================================================
    -- SECTION 2 - SWITCH OUT
    -- 001 - Create TestTableOut
    -- 002 - Switch out partition in range 0-14
    -- 003 - Merge range 0 -29
    -- 001. TestTableOut
    :SETVAR TableName "TestTable"
    IF OBJECT_ID('dbo.$(TableName)Out') IS NOT NULL
    DROP TABLE [dbo].[$(TableName)Out]
    CREATE TABLE [dbo].[$(TableName)Out](
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)Out] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_fg2;
    GO
    -- 002 - Switch out partition in range 0-14
    --:SETVAR TableName "TestTable"
    ALTER TABLE dbo.$(TableName)
    SWITCH PARTITION 2 TO dbo.$(TableName)Out;
    -- 003 - Merge range 0 - 29
    :SETVAR TableName "TestTable"
    ALTER PARTITION FUNCTION $(TableName)_func()
    MERGE RANGE (14);
    -- Confirm table partitioning
    -- Original source of this query - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber
    The table below shows the results of the ‘Confirm Table Partitioning’ query, before and after the MERGE.
    The data in the File and File Group to be dropped (File Group 2) has already been switched out; File Group 3 contains the data so no index rebuild is needed to move data and complete the MERGE.
    RANGE RIGHT would not be a problem in a ‘Sliding Window’ if the same file group is used for all partitions, when they are created and dropped it introduces a dependency on full index rebuilds. Larger tables are typically partitioned and a full index rebuild
    might be an expensive operation. I’m not sure how a RANGE RIGHT partitioning strategy could be implemented, with an ascending partitioning key, using multiple file groups without having to move data. Using a single file group (multiple files) for all partitions
    within a table would avoid physically moving data between file groups; no index rebuild would be necessary to complete a MERGE and system views would accurately reflect the physical location of data. 
    If a RANGE RIGHT partition function is used, the data is physically in the wrong file group after the MERGE assuming a typical ascending partitioning key, and the 'Data Spaces' system views might be misleading. Thanks to Manuj and Chris for a lot of help
    investigating this.
    NOTE 10/03/2014 - The solution
    The solution is so easy it's embarrassing, I was using the wrong boundary points for the MERGE (both RANGE LEFT & RANGE RIGHT) to get rid of historic data.
    -- Wrong Boundary Point Range Right
    --ALTER PARTITION FUNCTION $(TableName)_func()
    --MERGE RANGE (15);
    -- Wrong Boundary Point Range Left
    --ALTER PARTITION FUNCTION $(TableName)_func()
    --MERGE RANGE (14);
    -- Correct Boundary Pounts for MERGE
    ALTER PARTITION FUNCTION $(TableName)_func()
    MERGE RANGE (0); -- or -1 for RANGE LEFT
    The empty, switched out partition (on File Group 2) is then MERGED with the empty partition maintained at the start of the range and no data movement is necessary. I retract the suggestion that a problem exists with RANGE RIGHT Sliding Windows using multiple
    file groups and apologize :-)

    Hi Paul Brewer,
    Thanks for your post and glad to hear that the issue is resolved. It is kind of you post a reply to share your solution. That way, other community members could benefit from your sharing.
    Regards.
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Imp error - ORA-14400: inserted partition key does not map to any partition

    Hi,
    We have a table (table t) with partitions (p1, p2, ... p12) and two of the partitions (p11 and p12) need to be imported into
    another database with different schema. Both the partitions to be imported are in two different export dumps. So, I started
    by dropping the table t and then import with the first export dump (p12). The first import went fine, but the second import
    failed with error:
    IMP-00058: ORACLE error 14400 encountered
    ORA-14400: inserted partition key does not map to any partition
    IMP-00057: Warning: Dump file may not contain data of all partitions of this table
    About to enable constraints...
    Import terminated successfully with warnings.
    The imp command used is:
    imp user/pwd tables=t log=imp.log file=exp.dmp fromuser=db1user touser=db2user ignore=Y grants=n indexes=n constraints=n
    statistics=none
    Please let me know where is the problem and what is the solution? I need to import the second partition (p11) also
    successfully.
    Thanks.
    BNetra

    Created a new partition REST_VALUES with higher range value and all my imports worked fine. But now I have two related issues:
    1) All the data got imported into the new partition instead of correct partitions.
    2) I observed that the column on which the table is partitioned CREATE_DATE values have been changed to today's (import) date for all rows imported into the new partition.
    How do I import properly into respective partitions and not into temporary new partition?
    Why did the CREATE_DATE value got changed automatically during import?
    Thanks.

  • |Error SQL: ORA-14400: inserted partition key does not map to any partition

    I have an installation of ECC6 with BI7 in which consolidated through SEM-BCS OBCS_C10 with the cube, which I have version 100 for fiscal data, 101 data for IFRS and IFRS Copying a 301 version.
    The client will ask me the empty version of the 301 in the cube OBCS_C10.
    Before switching to empty the cube "Target Real-Time Data Can Be Loaded With Data; Planning Not Allowed."
    To empty the cube using transaction RSA1 / manage / contents / Delete Selection.
    However, the data is not erased and revise the job gives me the error:
    Resumen log job para job BI_INDXD51A1NTCIYWU06OKZZESN1R94 / 07520600
    Log job
    Hora
    Txt.mje.no codificado
    04.02.2009
    07:52:06
    El job ha sido lanzado.
    04.02.2009
    07:52:06
    Paso 001 iniciado (programa RSINDEX1, variante &0000000000108, usuario ACHUY)
    04.02.2009
    07:52:10
    SQL: 04.02.2009 07:52:10 ACHUY
    04.02.2009
    07:52:10
    DELETE FROM DDSTORAGE WHERE DBSYSABBR = 'ORA'
    04.02.2009
    07:52:10
    AND INDEXNAME = ' ' AND TABNAME =
    04.02.2009
    07:52:10
    '/BI0/D0BCS_C101
    04.02.2009
    07:52:10
    SQL-END: 04.02.2009 07:52:10 00:00:00
    04.02.2009
    07:52:10
    SQL: 04.02.2009 07:52:10 ACHUY
    04.02.2009
    07:52:10
    DELETE FROM DDSTORAGE WHERE DBSYSABBR = 'ORA'
    04.02.2009
    07:52:10
    AND INDEXNAME = ' ' AND TABNAME =
    04.02.2009
    07:52:10
    '/BI0/D0BCS_C101
    04.02.2009
    07:52:10
    SQL-END: 04.02.2009 07:52:10 00:00:00
    04.02.2009
    07:52:10
    SQL: 04.02.2009 07:52:10 ACHUY
    04.02.2009
    07:52:10
    CREATE TABLE "/BI0/0100000076" PCTFREE 00
    04.02.2009
    07:52:10
    PCTUSED 00 INITRANS 001 TABLESPACE PSAPSR3
    04.02.2009
    07:52:10
    STORAGE (INITIAL     0000000016 K NEXT
    04.02.2009
    07:52:10
    0000000016 K MINEXTENTS  0000000001 MAXEXTENTS
    04.02.2009
    07:52:10
    UNLIMITED PCTINCREASE 0000 FREELISTS   001
    04.02.2009
    07:52:10
    FREELIST GROUPS 01) AS SELECT DISTINCT DIMID FROM
    04.02.2009
    07:52:10
    "/BI0/D0BCS_C101" "DIM" , "/BI0/SCS_VERSION"
    04.02.2009
    07:52:10
    "MD1" WHERE "DIM"."SID_0CS_VERSION" = "MD1"."SID"
    04.02.2009
    07:52:10
    AND ( "MD1"."CS_VERSION" BETWEEN '301' AND '301'
    04.02.2009
    07:52:10
    SQL-END: 04.02.2009 07:52:10 00:00:00
    04.02.2009
    07:52:25
    SQL: 04.02.2009 07:52:25 ACHUY
    04.02.2009
    07:52:25
    DELETE FROM DDSTORAGE WHERE DBSYSABBR = 'ORA'
    04.02.2009
    07:52:25
    AND INDEXNAME = ' ' AND TABNAME = '/BI0/F0BCS_C10
    04.02.2009
    07:52:25
    SQL-END: 04.02.2009 07:52:25 00:00:00
    04.02.2009
    07:52:25
    SQL: 04.02.2009 07:52:25 ACHUY
    04.02.2009
    07:52:25
    DELETE FROM DDSTORAGE WHERE DBSYSABBR = 'ORA'
    04.02.2009
    07:52:25
    AND INDEXNAME = ' ' AND TABNAME = '/BI0/F0BCS_C10
    04.02.2009
    07:52:25
    SQL-END: 04.02.2009 07:52:25 00:00:00
    04.02.2009
    07:52:25
    SQL: 04.02.2009 07:52:25 ACHUY
    04.02.2009
    07:52:25
    CREATE TABLE "/BI0/0100000030" PCTFREE 10
    04.02.2009
    07:52:25
    PCTUSED 00 INITRANS 001 TABLESPACE PSAPSR3
    04.02.2009
    07:52:25
    STORAGE (INITIAL     0000000016 K NEXT
    04.02.2009
    07:52:25
    0000000000 K MINEXTENTS  0000000001 MAXEXTENTS
    04.02.2009
    07:52:25
    2147483645 PCTINCREASE 0000 FREELISTS   001
    04.02.2009
    07:52:25
    FREELIST GROUPS 01) PARTITION BY RANGE
    04.02.2009
    07:52:25
    ("KEY_0BCS_C10P") ( PARTITION "/BI0/F0BCS_C100"
    04.02.2009
    07:52:25
    VALUES LESS THAN (0) TABLESPACE "PSAPSR3",
    04.02.2009
    07:52:25
    PARTITION "/BI0/F0BCS_C100000000019" VALUES LESS
    04.02.2009
    07:52:25
    THAN (0000000019) TABLESPACE "PSAPSR3", PARTITION
                  |
    04.02.2009
    07:52:25
    "/BI0/F0BCS_C100000000276" VALUES LESS THAN
    04.02.2009
    07:52:25
    (0000000276) TABLESPACE "PSAPSR3", PARTITION
    04.02.2009
    07:52:25
    "/BI0/F0BCS_C100000000277" VALUES LESS THAN
    04.02.2009
    07:52:25
    (0000000277) TABLESPACE "PSAPSR3") AS SELECT *
    04.02.2009
    07:52:25
    FROM "/BI0/F0BCS_C10" WHERE "KEY_0BCS_C101" NOT
    04.02.2009
    07:52:25
    IN ( SELECT "DIMID" FROM "/BI0/0100000076"
    04.02.2009
    07:52:29
    SQL-END: 04.02.2009 07:52:29 00:00:04
    04.02.2009
    07:52:29
    Error SQL: ORA-14400: inserted partition key does not map to any partition
    04.02.2009
    07:52:29
    Error de sistema: CREATE_TABLE_AS_SELECT/RSDU_EXEC_SQL /BI0/0100000030 14400
    04.02.2009
    07:52:29
    El job ha sido cancelado tras excepción de sistema ERROR_MESSAGE.
    Someone has an idea how to fix this?

    This is the SQL of the insert
    The partition condition of the table is the column ("KEY_0BCS_C10P")
    SELECT * FROM "/BI0/F0BCS_C10" WHERE "KEY_0BCS_C101" NOT IN ( SELECT "DIMID" FROM "/BI0/0100000076" )
    This is the info of the /BIO/0100000076 TABLE
    SQL> SELECT "DIMID" FROM sapsr3."/BI0/0100000076";
         DIMID
             6
    SQL>
    And this are the rows that I think are not included in the partitions of the table
      1  SELECT DISTINCT KEY_0BCS_C10P, KEY_0BCS_C101 FROM SAPSR3."/BI0/F0BCS_C10"
      2  WHERE KEY_0BCS_C10P > 277
      3* AND "KEY_0BCS_C101" NOT IN ( SELECT "DIMID" FROM SAPSR3."/BI0/0100000076" )
    SQL> /
    KEY_0BCS_C10P KEY_0BCS_C101
              284             4
              285             4
              293             3
              292             4
              293             4
              293             5
              285             3
              290             4
              292             5
              283             4
              285             5
    KEY_0BCS_C10P KEY_0BCS_C101
              291             5
              292             3
              291             4
    14 rows selected.
    SQL>

  • Sqlldr returns ORA-14400 although partition exists

    Hi,
    I have encountered an error with SQL Loader which I was hoping that someone here could help me out.
    I am loading records from a file which have different length. Which type of record it is is identifiable by a field called record_type and all the records in the file are loaded into the same table.
    The problem I encounter is that in average one record out of each 10000 is rejected with the errors:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-14400: inserted partition key does not map to any partition
    These records end up in a .bad file and I look at the date, which the partition is based on, then I don't find anything that can explain why it was rejected since the partition is there.
    When I try to load the content .bad file into the table then it works without any of the previously rejected records being rejected again.
    What I don't understand is why the records are rejected in the first place, but then at a second attempt successfully loaded although no modification has been done to the table (no new added, nor removed partitions). Am I somehow using the SQL loader in a way that it is not meant to be used, or might I have forgotten a setting in the .ctl file?
    Oracle version is 11.1.0.7.0.
    The control file I am using looks like this (subset, got altogether 6 different record types)
    LOAD DATA
    INFILE *
    APPEND
    INTO TABLE ROAM5
    WHEN (41:43) = 'CA3'
    TRAILING NULLCOLS
    FILE_NAME POSITION(1:40) CHAR(40) "TRIM(:FILE_NAME)",
    RECORD_TYPE POSITION(41:43) CHAR(3),
    IMSI POSITION(44:58) CHAR(15) "TRIM(:IMSI)",
    IMSI_TYPE POSITION(59:60) CHAR(2) "TRIM(:IMSI_TYPE)",
    SENDER_ID POSITION(61:80) CHAR(20) "TRIM(:SENDER_ID)",
    CUSTOMER_TAG POSITION(81:134) CHAR(54) "TRIM(:CUSTOMER_TAG)",
    DATE_FROM_CDR POSITION(135:148) Date "YYYYMMDDHH24MISS",
    CALL_EVENT_DATE POSITION(149:162) Date "YYYYMMDDHH24MISS",
    TOTAL_CHARGED_UNITS POSITION(163:167) CHAR(5) "TRIM(:TOTAL_CHARGED_UNITS)",
    FINAL_CHARGE_RATE POSITION(168:179) CHAR(12) "TRIM(:FINAL_CHARGE_RATE)",
    TOTAL_CHARGEABLE_UNITS POSITION(180:184) CHAR(5) "TRIM(:TOTAL_CHARGEABLE_UNITS)",
    CURRENCY_CODE POSITION(185:189) CHAR(5) "TRIM(:CURRENCY_CODE)",
    USAGE_TYPE POSITION(190:194) CHAR(5) "TRIM(:USAGE_TYPE)",
    TAX_RATE POSITION(195:206) CHAR(12) "TRIM(:TAX_RATE)",
    CAMEL_SERVICE_LEVEL POSITION(207:207) CHAR(1) "TRIM(:CAMEL_SERVICE_LEVEL)",
    CALLED_NUMBER POSITION(208:228) CHAR(21) "TRIM(:CALLED_NUMBER)",
    ANNOTATION POSITION(229:483) CHAR(255) "TRIM(:ANNOTATION)",
    CALLING_NUMBER POSITION(484:488) CHAR(5) "TRIM(:CALLING_NUMBER)"
    INTO TABLE ROAM5
    WHEN (41:43) = 'GC3'
    TRAILING NULLCOLS
    FILE_NAME POSITION(1:40) CHAR(40) "TRIM(:FILE_NAME)",
    RECORD_TYPE POSITION(41:43) CHAR(3),
    IMSI POSITION(44:58) CHAR(15) "TRIM(:IMSI)",
    IMSI_TYPE POSITION(59:60) CHAR(2) "TRIM(:IMSI_TYPE)",
    SENDER_ID POSITION(61:80) CHAR(20) "TRIM(:SENDER_ID)",
    CUSTOMER_TAG POSITION(81:159) CHAR(79) "TRIM(:CUSTOMER_TAG)",
    CALLING_NUMBER POSITION(160:164) CHAR(5) "TRIM(:CALLING_NUMBER)",
    DATE_FROM_CDR POSITION(165:178) Date "YYYYMMDDHH24MISS",
    CALL_EVENT_DATE POSITION(179:192) Date "YYYYMMDDHH24MISS",
    DATE_FROM_CDR POSITION(165:178) Date "YYYYMMDDHH24MISS",
    CALL_EVENT_DATE POSITION(179:192) Date "YYYYMMDDHH24MISS",
    TOTAL_CHARGED_UNITS POSITION(193:204) CHAR(12) "TRIM(:TOTAL_CHARGED_UNITS)",
    FINAL_CHARGE_RATE POSITION(205:216) CHAR(12) "TRIM(:FINAL_CHARGE_RATE)",
    TOTAL_CHARGEABLE_UNITS POSITION(217:228) CHAR(12) "TRIM(:TOTAL_CHARGEABLE_UNITS)",
    TAX_RATE POSITION(229:240) CHAR(12) "TRIM(:TAX_RATE)",
    CURRENCY_CODE POSITION(241:245) CHAR(5) "TRIM(:CURRENCY_CODE)",
    USAGE_TYPE POSITION(246:250) CHAR(5) "TRIM(:USAGE_TYPE)",
    ANNOTATION POSITION(251:442) CHAR(192) "TRIM(:ANNOTATION)",
    APN_NI POSITION(443:447) CHAR(5) "TRIM(:APN_NI)"
    The partitioning is based around a syntax like this:
    TABLESPACE REVASS_DATA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    PARTITION BY RANGE (DATE_FROM_CDR)
    PARTITION CDR_20121014 VALUES LESS THAN (TO_DATE(' 2012-10-15 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    I am thankful for any hint or help that you could give me.
    Best regards,
    Jesper
    Edited by: 967860 on Oct 26, 2012 4:10 AM - Added Oracle version

    Of course, here is one GC3 record which failed this morning:
    CDDEUM3CHEM208006.dat GC3228123456789123 6DEUM30800600011331012672649480101111593 7
    7 DEUM3201210281252372012102812523712288 0 11378 1 37530 41791234567 10.128.128.128
    +0100 F 3 4 13070002469860 20121028125237+0100X+0100 0 internet
    Which I would have expected to have been loaded into this partition in the ROAM5 table:
    PARTITION CDR_20121028 VALUES LESS THAN (TO_DATE(' 2012-10-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE REVASS_DATA
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 80K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    The record:
    CDFRAM3CHEM217542.dat GC3228123456789123 6FRAM3175420000197801328900564420996812 1
    14 FRAM3201210241700532012102417005312288 6 11342 1 37530 41761234567 10.128.128.128
    3 4 012841007464311620121024170053+0200X+0200 0 internet
    Should have ended up in this partition:
    PARTITION CDR_20121024 VALUES LESS THAN (TO_DATE(' 2012-10-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE REVASS_DATA
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 80K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    Best regards,
    Jesper
    Edited by: Jesper967860 on Oct 29, 2012 12:55 AM
    Edited by: Jesper967860 on Oct 29, 2012 12:59 AM

Maybe you are looking for

  • File Adapter vs BPEL interaction issue on high availability environment

    Hi all, i would really appreciate your help on a matter i'm facing about a composite (SCA) deployed on a clustered environment configured for high availability. To help you better understand the issue i briefly describe what my composite does. Compos

  • Reset iphone 3gs

    Via settings erase I cleared my Iphone. Resetting via Itunes does`nt work. Itunes does`nt recognize the Iphone. Help!

  • ITunes library over a network

    I've just bought a MacBook (my first ever Mac, so I'm completely n00b) and want to know the best way to manage MP3's on OS X. What I want to do is play my MP3's on my MacBook which are stored on my PC and access them over the network. I have about 10

  • What is my Skype password and ID?

    I downloaded the Skype app and it asked for user ID and password. Where do I get that?

  • Security update 2014-002 won't install, stuck on gray Software update screen

    My mac mini has been trying to install this security update the past week.  It asks for me to restart, when I do it gets stuck on a Software Updater page or gray screen.  The only way I can proceed is the shut the computer down by manually holding do