Partition Query

On a Lenovo T61 running Vista there is a "hidden" 7 GB partition that is for a recovery operation.
The balance of the Hard Disk is C.
There is no D.
The CD/DVD Reader/Burner is E.
Am I able to use the Vista builtin facilities to shrink C to 20GB, and then create and format a second partition (D) on the now free/unallocated area?
If so, will this prevent me from doing a recovery as the PC was originally set up for?
Are there any hidden traps?
Is there a GOOD site/page that describes the operation?
Thanks.

Hello Kiwibrain, welcome to Lenovo forums.
I would suggest to burn your recovery cd/dvd´s at first.
Then have a look here, how the partitions work.
Then I would suggest to do a clean install, instead of messing with your partitions.
Please refer to this ThinkPad Superguide by Arkit3kt
Follow @LenovoForums on Twitter! Try the forum search, before first posting: Forum Search Option
Please insert your type, model (not S/N) number and used OS in your posts.
I´m a volunteer here using New X1 Carbon, ThinkPad Yoga, Yoga 11s, Yoga 13, T430s,T510, X220t, IdeaCentre B540.
TIP: If your computer runs satisfactorily now, it may not be necessary to update the system.
 English Community       Deutsche Community       Comunidad en Español

Similar Messages

  • Use of #tables in partition query definition

    hi everyone,
    I have  a cube with 10 partitions i am trying to use the query logic in each partition something like below
    create table #tmp1
    insert into #tmp1(col1)  select  col1 from bags  where month=01
    create table #tmp2
    insert into #tmp2(col2)
    select col1 from books where month=01
    create index on #tmp1
    create index on #tmp2
    select * from #tmp1 a inner join #tmp2 b on a.col1=b.col1
    the month in where conditions get changes for different partitions.
    error ::
    The SQL syntax is not valid. The relational database returned the following error message: The metadata could not be determined because statement 'SELECT col1 uses a temp table.
    please suggest any other alternatives. apart from usage of physical tables
    Thanks
    Praxykj
    Praxy

     I am using view already in the partition query. Rephrasing the queries used as shown below.
    create table #tmp1
    insert into #tmp1(col1)  select
     col1 from Vwbags  where month=01
    create table #tmp2
    insert into #tmp2(col2)
    select col1 from Vwbooks where month=01
    create index on #tmp1
    create index on #tmp2
    select * from #tmp1 a inner join #tmp2 b on a.col1=b.col1
    Praxy

  • Problem executing a partition query using occi in c++

    i am trying to execute a simple select query which returns a row from the table. The query is
    m_stmt->setSQL("select * from table partition(:1) where mdn = :2");
              m_stmt->setString(1,"P9329");
              //m_stmt->setInt(2,9320496213);
              ResultSet * rs = m_stmt->executeQuery();
              while(rs->next())
              cout<<"the value of preferences is aaaaaaaaaaaa"<< rs->getString(3);                    
    The problems that i am facing are as follows :
    1) if i execute the query using the actual values in the select query, it seems to be working fine, but when i try the above method to make it more dynamic (the values shown would be replaced by variables) it is giving me the following errors :
    a)if i put the partition value as a position parameter and put the mdn as the direct value in the query then it says the SQL command not ended properly
    b) if i put the partition value directly and put the mdn as a position parameter then the error is "Invalid Character "
    Any help would be much appreciated..ty in advance

    Hi Leonard,
    Thanks for letting me know that...thats pretty disappointing. Looks like I'll have to change my strategy in my implementation.
    Do you know if I can also develop functions using Acrobats SDK library methods such as "PDDocCreate()", "PDDocSave", etc. in OLE [MFC] applications?
    The reason why I ask is because I have previously created a plugin that creates a PDF file and embeds a 3D annotation... so this would be the same sort of idea that the 3D Tool Menu Item achieves.
    Now, if I were to use the function code within my OLE application, I will have to also include the PIMain.c file in my project as well correct?
    I hope this idea is a good one... please let me know if this approach is possible.
    Thanks.

  • Partitioning - query on large table v. query accessing several partitions

    Hi,
    We are using partitioning on a large fact table, however, in deciding partitioning strategy looking for advice regarding queries which have to access several partitions versus query against a large table.
    What is quicker - a query which acccesses a large table or a query which accesseses several partitions to return results. I
    Need to partition due to size/admin etc. but want to make sure queries which need to access > 1 partition are not significantly slower than ones which access a large table by comparison.
    Ones which access just one partition fine but some queries have to accesse several partitions
    Many Thanks

    Here are your choices stated another way. Is it better to:
    1. Get one weeks data by reading one month's data and throwing away 75% of it (assumes partitioning by month)
    2. Get one weeks data by reading three weeks of it and throwing away part of two weeks? (assumes partitioning by week)
    3. Get one weeks data by reading seven daily partitions and not having to throw away any of it? (assumes daily partitioning)
    I have partitioned as frequently as every 5-15 minutes (banking and telecom) and have yet to find a situation where partitions larger than the minimum date-range for the majority of queries makes sense.
    Anyone can insert data into a table ... an extra millisecond per insert is generally irrelevant. What you want to do is optimize reading the data where that extra millisecond per row, over millions of rows, adds up to measurable time.
    But this is Oracle so the best answer to your questions is to recommend you not take anyone advice on this but rather run some tests with real data, in real-world volumes, with real-world DML and queries.

  • Physical partitioning query performance wore than without

    Hello experts,
    I have copied InfoCube 0COPC_C04 to ZCPOC_C06 with a test-query and took over data from 0COPC_C04 to test the functionality of Repartitioning (~ 4 million records)
    I did Repartitioning following instructions from note 1008833 for 0FISCPER (I used se38 RSDU_SET_FV_TO_FIX_VALUE  to set 0FISCVARNT to constant) - starting-point is 001.2000 - end-point is 016.2010
    Indexes and Statistcs are re-created.
    We have Oracle 10.2.0.2.0 and SAPKW70022 on BW 700
    So - from my point of view everything is fine - BUT: Queryperformance is worst than before - shown in rsrv.
    Variable in Query is over 0FISCYEAR and 0FISCPER3 and NOT over 0FISCPER (a querytest with 0FISCPER brought the same bad performance result).
    Even I read, that with physical partitioning the query reads PARALLEL --- I can not see any parallel things in sm50 / sm66 - I have excpected to see parallel readings due to my query - I asked for results from 001.2006 - 12.2010 - and 13 partions were created (related to se14 ).
    What might be the problem?
    Thanks for your answer,
    Thomas
    Edited by: Thomas Liebschner on Jan 4, 2011 3:28 PM

    #1171650 is already implemented (since 14.12.2010) --- I asked my collegaue from Basis-Team to send me the report.
    > I read parallel-queryexcution in the SAP Press Galileo Press Book "SAP BW Peformanceoptimierung" written by Thomas Schröder (ISBN: 3-89842-718-8), Page 376. If you like, I can send this page as pdf to your mail stored in your business card.
    Would be interesting to see that excerpt, yes.
    > What I missed was to compress the F-Table.
    >
    > I'm wondering, that:
    > 1. After Compressing 0COPC_C04 with 8 million records gave a dramatically improvement of query-performance. No partitioning.
    Sure, usually a lot less data needs to be read now.
    > 2. After a new Full-load from 0COPC_C04 to ZCOPC_C06 with rebuilding indices and statistics I got similar query-performance compared to 1
    Also easy to understand.
    The F-Facttable contains data per load. So data concerning the same business items will be in that table multiple times and need to be aggregated on-the-fly during query execution.
    The E-Facttable in contrast just contains one entry per business item. Which is the same situation you'll find when you just have one single data load request.
    > 3. If I compress ZCOPC_C06, then query-performance drops dramatically down (needs double time, if I use 0FISCPER, needs 8 times more in query with 0FISCYEAR and 0FISCPER3)
    >
    > additional information: I have merged partitions from ZCOPC_C06 to one partition --> checked by se14 /BIC/FZCOPC_C06 -- storage parameters
    Hmm... ok, here we would really need to see what Oracle does with your Query and the partitioning scheme then.
    What seems obvious is that as soon as you have just one partition, then there is no way for Oracle to split up work and leave uninteresting data aside (partition-pruning),
    > Conclusion: it seems for me, that compression is enough - partitioning has no advantage in that dedicated scenario.
    > Do I think right?
    I think that compression is a must-do in 99% of all cases for SAP BI and that the partitioning of the E-Facttable should be reviewed on your system.
    Up to here there is too little information available to tell whether or not it could benefit your query execution time.
    Another aspect you might consider with partitioning the E-facttable is your data retention policy.
    If you're about to throw away your data on, say, a yearly basis, then having the table partitioned that way can provide huge benefits.
    My personal view to this is: you already payed for the most expensive and feature-rich database engine available for SAP BI - so why not go and exploit these features where possible?
    best regards
    Lars

  • Oracle licensing for partition query

    Hi experts
    For example if server server1 has 2 instances and let say both are using Partitioning option it will show that we have to be licensed for partitioning twice (for each instance).
    If the both running on the same server and make an argument that they are on the same oracle home how would the license cost work out
    is it per oracle home/database
    thanks

    912919 wrote:
    Hi experts
    For example if server server1 has 2 instances and let say both are using Partitioning option it will show that we have to be licensed for partitioning twice (for each instance).
    If the both running on the same server and make an argument that they are on the same oracle home how would the license cost work out
    is it per oracle home/database
    theres a leading question here in that partitioning is an add-on option to an enterprise edition license. So the question isnt if you need to buy the partitioning option twice but what are you adding it on to? have you 2 EE licenses already? If you have 1 CPU, 1 EE CPU license, you need to buy 1 partitioning add-on.

  • Disk Utility & Partition Query

    I've been asked to help someone get to grips with using a Mac (pretty sure it's running 10.5.8). The machine was set up for them about a year ago but has been little used since. Its internal hard drive has been partitioned into two and from the contents of the smaller partition, my guess is the intention was to use it for a second copy (I hesitate to call it a backup) of important files. Due to lack of knowledge this has not been done so the files on the small partition can if necessary be deleted. My question is, is it possible to delete the files on the small partition then combine the two partitions back to be just one internal hard drive volume without destroying the data (OS and user files etc.) on the large partition? (We'll then get an external drive to use Time Machine for a more conventional backup).

    Yes, provided the small partition is the second partition with the OS X boot volume being the first partition.
    Open Disk Utility in the Utilities folder. Select the topmost entry for the drive in the left sidebar then click on the Partition tab in the DU main window. You will see a graphical picture of the two partitions on the drive. Assuming the small partition is the bottom partition you're good to go. Click in the rectangle box representing the second partition. It will become outlined in a darker blue. Click on the Delete [-] button in the lower left corner. The partition will be removed and you will now see a gray area instead. At the lower right corner of the remaining partition is a triangular shaped sizing gadget. Grab it with the mouse and drag it all the way to the bottom of the partition area. Now click on the Apply button and wait patiently until the process is finished. If the procedure is successful then quit DU.

  • Query Optimization with partitioned/subpartitioned tables

    I have a 1 billion row table with 72 partitions by range and thousands of subpartitions by list. There is a bitmap index on the subpartition by list field.
    If I execute the following query which requests data from a single partition and a single subpartition:
    SQL> select * from cen00_demog_sf1_hp where
    ckey like '33011%' and demogname = 'P002006';
    the optimizer selects a single partition ('33...') and a single subpartition ('P002006'). The query takes only 6 seconds including displaying the 7,386 row result.
    However, if I then execute the following query which selects data from two partitions and a single subpartition within each partition:
    SQL> select * from cen00_demog_sf1_hp where
    (ckey like '33011%' or ckey like '35001%')
    and demogname = 'P002006';
    the optimizer scans all partitions rather than just scanning partitions 33 and 35. The query takes over 10 minutes to display the 17,972 row result. If this query is split into two separate queries, the same result set can be realized in a total 26 seconds including display the results to the screen.
    Any suggestions on how the multiple partition query can be modified to avoid an all rows scan?
    Thank you.

    I had previously tried reversing the WHERE clause statements in the query but it had no affect. The execution plan for the two partition query follows. Note the "ALL" on the partition range. I purposely did not index the ckey field believing that partitioning would be sufficent (ckey contains 8,262,363 unique keys out of 1,041,057,738 rows). As a test a query requesting a demogval based on a single ckey for a particular demogname returns a result in less than a second. Another test requesting data for a particular ckey without a demogname qualifier resulted in a full scan of a single partition (but not all the partitions) taking 4 minutes of elapsed time. Note that the only reason that there is a bitmap index on the demogname in table cen00_demog_sf1_hp is that normally the query is a join with another table containing an indexed demogname field. In sum, it appears that the optimizer defaults to an all partition scan when more than one partition is included in the query.
    Elapsed: 00:11:38.41
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=53824 Card=4 Bytes=148)
    1 0 PARTITION RANGE (ALL) (Cost=53824 Card=4 Bytes=148)
    2 1 PARTITION LIST (SINGLE) (Cost=53824 Card=4 Bytes=148)
    3 2 TABLE ACCESS (BY LOCAL INDEX ROWID) OF 'CEN00_DEMOG_SF1_HP' (TABLE) (Cost=53824 Card=4 Bytes=148)
    4 3 BITMAP CONVERSION (TO ROWIDS)
    5 4 BITMAP INDEX (SINGLE VALUE) OF 'CEN00_DEMOG_SF1_HP_IDX' (INDEX (BITMAP))
    The single partition query trace shows selectivity on the partition range.
    Elapsed: 00:00:09.69
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=42 Card=133 Bytes=4655)
    1 0 PARTITION RANGE (SINGLE) (Cost=42 Card=133 Bytes=4655)
    2 1 PARTITION LIST (SINGLE) (Cost=42 Card=133 Bytes=4655)
    3 2 TABLE ACCESS (BY LOCAL INDEX ROWID) OF 'CEN00_DEMOG_SF1_HP' (TABLE) (Cost=42 Card=133 Bytes=4655)
    4 3 BITMAP CONVERSION (TO ROWIDS)
    5 4 BITMAP INDEX (SINGLE VALUE) OF 'CEN00_DEMOG_SF1_HP_IDX' (INDEX (BITMAP))

  • SSAS 2008, Process Old partition

    Hi Experts ,
    I need an advice and suggestion.
    I am working on SSAS 2008, I have One Fact Table "Fact_sales".
    I have done yearly partion, I.e
    FAct_Sales_2010
    FAct_Sales_2011
    FAct_Sales_2012
    FAct_Sales_2013
    Every Year I create One Partition.
    Now in Year 2014 I added One More column i.e "Dept_key" in Fact Table and create FK PK relation with Dept_Dimension
    This Year I created partion again i.e FAct_Sales_2014 which have Dept_key in Select Statement of Partition Query.
    I do process Full , and my cube fails,Stating Dept_Key not found
    I need to know ,if new columns are added in Fact Table ,
    Is it require to Update or Recreate Old partition ??

    If you have created the partitions by Query Binding you should add Dept_key in query for each partition. After all perform full processing measure group.
    Best 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

  • A partition tab is needed in the schema-table browser and it's missing

    After a first sight with the product, I couldn't find a partition tab in the schema-table browser.
    For those having partitions it is absolutely essential.

    It's easy to add,
    create a file that has the following content
    <?xml version="1.0" encoding="UTF-8"?>
    <items>
    <item type="sharedQuery" id="PartSubPartkeys">
    <query minversion="9">
         <sql>
         <![CDATA[ select 'PARTITION KEYS' PARTITION_LEVEL,substr(sys_connect_by_path(column_name,','),2) "PARTITION KEYS"
                   from (select column_name, column_position
                   from all_part_key_columns
                   where owner = :OBJECT_OWNER
                   and name = :OBJECT_NAME
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1
                   union all
                   select 'SUBPARTITION KEYS' ,substr(sys_connect_by_path(column_name,','),2)
                   from (select column_name, column_position
                   from all_subpart_key_columns
                   where owner = :OBJECT_OWNER
                   and name = :OBJECT_NAME
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1]]></sql>
         </query>
         </item>
    <item type="sharedQuery" id="PartSubPartkeysFI">
    <query minversion="9">
         <sql>
         <![CDATA[ select 'PARTITION KEYS' PARTITION_LEVEL,substr(sys_connect_by_path(column_name,','),2) "PARTITION KEYS"
                   from (select column_name, column_position
                   from all_part_key_columns
                   where owner = :OBJECT_OWNER
                   and name = (select table_name
                             from all_indexes
                             where index_name=:OBJECT_NAME
                             and owner=:OBJECT_OWNER)
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1
                   union all
                   select 'SUBPARTITION KEYS' ,substr(sys_connect_by_path(column_name,','),2)
                   from (select column_name, column_position
                   from all_subpart_key_columns
                   where owner = :OBJECT_OWNER
                   and name =(select table_name
                             from all_indexes
                             where index_name=:OBJECT_NAME
                             and owner=:OBJECT_OWNER)
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1]]></sql>
         </query>
         </item>
    <item type="sharedQuery" id="Partitions">
    <query minversion="9">
         <sql>
         <![CDATA[ select partition_name,  num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_partitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME order by partition_position]]></sql>
         </query>
         </item>
    <item type="sharedQuery" id="SubPartitions">
    <query minversion="9">
         <sql>
         <![CDATA[ select subpartition_name, partition_name,  num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_subpartitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME order by partition_name,subpartition_position]]></sql>
         </query>
         </item>
    <item type="editor" node="TableNode" >
    <title><![CDATA[Partitions/SubPartitions]]></title>
    <query id="PartSubPartkeys" />
    <subquery>
    <title>Partitions/SubPartition</title>
    <query>
    <sql><![CDATA[select partition_position, partition_name "Partition/Subpartition",  tablespace_name,high_value,compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_partitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'PARTITION KEYS'=:PARTITION_LEVEL
             union all
             select subpartition_position, partition_name||'/'||subpartition_name, tablespace_name,high_value,compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_subpartitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'SUBPARTITION KEYS' =:PARTITION_LEVEL
             order by 2]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="MViewNode" >
    <title><![CDATA[Partitions/SubPartitions]]></title>
    <query id="PartSubPartkeys" />
    <subquery>
    <title>Partitions/SubPArtition</title>
    <query>
    <sql><![CDATA[select partition_position, partition_name "Partition/Subpartition",  tablespace_name,
             high_value,compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED
             from all_tab_partitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'PARTITION KEYS'=:PARTITION_LEVEL
             union all
             select subpartition_position, partition_name||'/'||subpartition_name, tablespace_name,high_value,
             compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED
             from all_tab_subpartitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'SUBPARTITION KEYS' =:PARTITION_LEVEL
             order by 2]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="IndexNode" >
    <title><![CDATA[Partitions/SubPartitions]]></title>
    <query id="PartSubPartkeysFI" />
    <subquery>
    <title>Partitions/SubPArtition</title>
    <query>
    <sql><![CDATA[select partition_position, partition_name "Partition/Subpartition",  tablespace_name,high_value,compression,
             Leaf_Blocks, Distinct_Keys, clustering_factor ,LAST_ANALYZED
             from all_ind_partitions where index_owner = :OBJECT_OWNER and index_name = :OBJECT_NAME
             and 'PARTITION KEYS'=:PARTITION_LEVEL
             union all
             select subpartition_position, partition_name||'/'||subpartition_name, tablespace_name,high_value,compression,
             Leaf_Blocks, Distinct_Keys, clustering_factor ,LAST_ANALYZED
             from all_ind_subpartitions
             where index_owner = :OBJECT_OWNER
             and index_name = :OBJECT_NAME
             and 'SUBPARTITION KEYS'=:PARTITION_LEVEL
             order by 2]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="TableNode">
    <title><![CDATA[Unabridged SQL]]></title>
    <query>
    <sql><![CDATA[select :OBJECT_OWNER OOWNER, :OBJECT_NAME ONAME, 'TABLE' OTYPE from dual union all select owner,index_name,'INDEX' from all_indexes where table_owner= :OBJECT_OWNER and table_name=:OBJECT_NAME ]]></sql>
    </query>
    <subquery type="code">
    <query>
    <sql><![CDATA[select dbms_metadata.get_ddl(:OTYPE,:ONAME, :OOWNER) "SQL Statements" from dual]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="TableNode">
    <title><![CDATA[Partition Columns Statistics]]></title>
    <query id="Partitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS
             from all_part_col_statistics where owner = :OBJECT_OWNER
             and table_name = :OBJECT_NAME
             and partition_name= :PARTITION_NAME
             order by column_name]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="TableNode">
    <title><![CDATA[SUBPartition Columns Statistics]]></title>
    <query id="SubPartitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS from all_subpart_col_statistics where owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and subpartition_name=:SUBPARTITION_NAME order by column_name]]></sql>
         </query>
    </subquery>
    </item>
    <item type="editor" node="MViewNode">
    <title><![CDATA[Partition Columns Statistics]]></title>
    <query id="Partitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS
             from all_part_col_statistics where owner = :OBJECT_OWNER
             and table_name = :OBJECT_NAME
             and partition_name= :PARTITION_NAME
             order by column_name]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="MViewNode">
    <title><![CDATA[SUBPartition Columns Statistics]]></title>
    <query id="SubPartitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS from all_subpart_col_statistics where owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and subpartition_name=:SUBPARTITION_NAME order by column_name]]></sql>
         </query>
    </subquery>
    </item>
    <item type="editor" node="SchemaFolder" minversion="10.1">
    <title><![CDATA[Sessions]]></title>
    <query>
    <sql><![CDATA[select sid,serial#,program,last_call_et,machine, status, sql_hash_value shv,sql_child_number scn
             from v$session
             order by 1]]></sql>
    </query>
    <subquery>
    <query>
    <sql><![CDATA[select * from table(dbms_xplan.display_cursor(:SHV,:SCN))]]></sql>
    </query>
    </subquery>
    </item>
    </items>
    and add the following line to your ide.conf file (in jdev/bin directory in the sqldev install dir)
    AddVMOption -Draptor.user.editors=fullpathofthefile(dir and name)
    and restart, you'll get several additional tabs to the ones displayed for tables.
    enjoy

  • ORA -00439 partition enable error with %s

    Hi
    I form following table partition query and faceing ORA-00439 "feature not enable %s" error at time of query execution
    Please help me to resolve this
    CREATE TABLE EMP2 (
    EMPNO NUMBER(4),
    ENAME VARCHAR2(10),
    JOB VARCHAR2(9),
    MGR NUMBER(4),
    HIREDATE DATE,
    SAL NUMBER(7,2),
    COMM NUMBER(7,2),
    DEPTNO NUMBER(2)
    PARTITION BY RANGE (hiredate)
    (PARTITION EMP_1981 VALUES LESS THAN (TO_DATE('01/01/1982', 'DD/MM/YYYY')),
    PARTITION EMP_1982 VALUES LESS THAN (MAXVALUE));
    Thanks in advance
    Regards
    Phani
    Edited by: Phani on Oct 19, 2010 1:36 AM

    Hi
    Thanks for reply
    I am using Oracle 10g Express edition (XE)
    I have executed following select query and I got value has "FALSE"
    select * from v$option where parameter = 'Partitioning';
    Regards
    Phani

  • Bin fitting with a counter using both analytics and model clause.

    11.2.0.3
    This falls under 'just want to figure out how to do it'. Its not critical for work. I want to try to see if its possible to do this with both analytic function and with a model clause. Just to see if its possible. It has been stumping me.
    I got the idea to look at this from this article about bin fitting. I have been playing with the model clause and I think you would do something with the 'increment' clause, but I dont see a way to reset it to 1 at a certain point.
    http://www.oracle.com/technetwork/issue-archive/2012/12-mar/o22asktom-1518271.html
    The case I want to look at is, bin fitting based on a counter and a partition by. In theory this should be simpler than the example in the link.
    [code]
    create table myrooms (
    room_number number,
    person_id        number);
    create unique index myrooms_ind on myrooms(room_number,person_id);
    [/code]
    Person_id is not unique. So row_number is more appropriate than rank or dense_rank.
    Problem: Partition by room_number, assign up to 50 people to a specific group with in the same room. This seems like it could be handled with a row_number() and a window clause, but that is not supported.
    I need to basically translate the old procedural counter into sql:
    pseudo-code that does not compile that would have a reason to use this logic.
    [code]
    declare
      cursor curGetRoom
         select room_number,person_id
            from my rooms
          order by room_number;
    counter number := 1;
    vCurrentRoom myroom.room_number%type;
    begin
        for i in curGetRoom loop
            if vCurrentRoom is null then
               vCurrentRoom := i.room_number;
            elsif vCurrentRoom = i.room_number then
                  if counter < 51 then counter :=counter+1;
                  else counter := 1;
            else
                 vCurrentRoom := i.room_number;
                counter :=1;
            end if;
    end;
    [/code]
    simple partition query., but I dont see a way to limit this to 50 and then start over. Window functions are not supported with row_number()
    [code]
    select room_number,person_id,row_number() over (partition by room_number order by person_id) rn
    from myrooms
    [/code]

    11.2.0.3
    This falls under 'just want to figure out how to do it'. Its not critical for work. I want to try to see if its possible to do this with both analytic function and with a model clause. Just to see if its possible. It has been stumping me.
    I got the idea to look at this from this article about bin fitting. I have been playing with the model clause and I think you would do something with the 'increment' clause, but I dont see a way to reset it to 1 at a certain point.
    http://www.oracle.com/technetwork/issue-archive/2012/12-mar/o22asktom-1518271.html
    The case I want to look at is, bin fitting based on a counter and a partition by. In theory this should be simpler than the example in the link.
    [code]
    create table myrooms (
    room_number number,
    person_id        number);
    create unique index myrooms_ind on myrooms(room_number,person_id);
    [/code]
    Person_id is not unique. So row_number is more appropriate than rank or dense_rank.
    Problem: Partition by room_number, assign up to 50 people to a specific group with in the same room. This seems like it could be handled with a row_number() and a window clause, but that is not supported.
    I need to basically translate the old procedural counter into sql:
    pseudo-code that does not compile that would have a reason to use this logic.
    [code]
    declare
      cursor curGetRoom
         select room_number,person_id
            from my rooms
          order by room_number;
    counter number := 1;
    vCurrentRoom myroom.room_number%type;
    begin
        for i in curGetRoom loop
            if vCurrentRoom is null then
               vCurrentRoom := i.room_number;
            elsif vCurrentRoom = i.room_number then
                  if counter < 51 then counter :=counter+1;
                  else counter := 1;
            else
                 vCurrentRoom := i.room_number;
                counter :=1;
            end if;
    end;
    [/code]
    simple partition query., but I dont see a way to limit this to 50 and then start over. Window functions are not supported with row_number()
    [code]
    select room_number,person_id,row_number() over (partition by room_number order by person_id) rn
    from myrooms
    [/code]

  • Unable to view alias on alternate Essbase hierarchy - Selecting POV

    Hi All
    I am just wondering if anyone is experiencing the following issue.
    I am using version 11.1.2.1 and creating a financial report that connects to an Essbase database.
    The issue is that I am unable to view the alias when trying to run the financial report via Workspace if I am looking a shared member (from the alternate hierarchy).
    I can see the alias if refer to the base member I am unable view it when trying to select a member from the POV selection screen in Workspace.
    I know I am able to do this in 11.1.1.3 but after upgrading to 11.1.2.1, I have lost the functionality.
    If anyone can shed any light it would be most helpful. I have logged a case with Oracle support.
    Thanks
    JT

    If you take the same retrieve and put it into the add-in, does it work?
    I know, I know, a SmartView forum, so maybe you don't have the add-in. Could you write a report script/MDX query that duplicates the layout?
    This:
    The retrieve will then take over two minutes then return the following error:Makes me think that you've got some kind of horrific (hugely sparse and/or very complex) formula on that member and that's what's causing the failure.
    You could, of course, just go into the outline and look at that member and see what's at that member.
    Regards,
    Cameron Lackpour
    P.S. Two other threads to look at:
    Partition query timeouts
    Smart View Adhoc Analysis Issue
    Is it possible that the db you are retrieving has a sparse calc per the first thread or is the target of a partition as per the second thread?
    Edited by: CL on Dec 29, 2010 9:22 AM

  • How to reduce Costing

    I have following query but the query takes too high costing, how should i reduce the cost.
    TRANCHE_BALANCE table having partition.
    query is
    SELECT /* + NO_USE_HASH(tbb) index(tbb XIE3TRANCHE_BALANCE) index (tbb XIE4TRANCHE_BALANCE) */
    tbb.project_id, tbb.tranche_nbr,
    tbb.summary_date,
    tbb.product_sub_type_code,
    tbb.product_type_code,
    CAST (tbb.crmcmt_usd_amt AS NUMBER) crmcmt_usd_amt,
    CAST (tbb.crmdout_usd_amt AS NUMBER) crmdout_usd_amt,
    CAST (tbb.crmmtm_usd_amt AS NUMBER) crmmtm_usd_amt,
    CAST (tbb.crmoleq_usd_amt AS NUMBER) crmoleq_usd_amt,
    CAST (tbb.crmunds_usd_amt AS NUMBER) crmunds_usd_amt,
    CAST (tbb.crmamtm_usd_amt AS NUMBER) crmamtm_usd_amt
    FROM mis.tranche_balance tbb,
    mis.product_categorization pc
    Where tbb.product_type_code = pc.product_type_code
    AND tbb.product_sub_type_code = pc.product_sub_type_code;
    PLAN SHOWS
    SELECT STATEMENT CHOOSE
    Cost :18,846 Bytes 97,768,6-368 Cardinality: 2,036,841
    # HASH JOIN
    Cost:18,846 Bytes :252 Cardinality : 2,036,841
    INDEX FULL SCAN UNIQUE MIS.XPKPRODUCT_CATGORIZATION
    Cost : 2 Bytes:252 Cardinality :36
    PARTITION RANGE ALL
    Partition #:3 Partition acessed #1 - #122
    TABLE ACCESS FULL MIS.TRANCHE_BALANCE
    Cost :18,789 Bytes : 83,510,481 Cardinality:2,036,841
    Partition #:3 Partition acessed #1 - #122
    Thanks for advance

    debasishghosh wrote:
    I have following query but the query takes too high costing, how should i reduce the cost.
    TRANCHE_BALANCE table having partition.Firstly, regardless of the "cost", is the query performant? If not, take a read of the following thread...
    When your query takes too long ...
    Secondly, it would be helpful, when you post code or data, if you put {noformat}{noformat} tags before and after it so that the formatting is retained on the forum.  I'll do that here for you for now...SELECT /* + NO_USE_HASH(tbb) index(tbb XIE3TRANCHE_BALANCE) index (tbb XIE4TRANCHE_BALANCE) */
    tbb.project_id, tbb.tranche_nbr,
    tbb.summary_date,
    tbb.product_sub_type_code,
    tbb.product_type_code,
    CAST (tbb.crmcmt_usd_amt AS NUMBER) crmcmt_usd_amt,
    CAST (tbb.crmdout_usd_amt AS NUMBER) crmdout_usd_amt,
    CAST (tbb.crmmtm_usd_amt AS NUMBER) crmmtm_usd_amt,
    CAST (tbb.crmoleq_usd_amt AS NUMBER) crmoleq_usd_amt,
    CAST (tbb.crmunds_usd_amt AS NUMBER) crmunds_usd_amt,
    CAST (tbb.crmamtm_usd_amt AS NUMBER) crmamtm_usd_amt
    FROM mis.tranche_balance tbb,
    mis.product_categorization pc
    Where tbb.product_type_code = pc.product_type_code
    AND tbb.product_sub_type_code = pc.product_sub_type_code;
    SELECT STATEMENT CHOOSE
    Cost :18,846 Bytes 97,768,6-368 Cardinality: 2,036,841
    # HASH JOIN
    Cost:18,846 Bytes :252 Cardinality : 2,036,841
    INDEX FULL SCAN UNIQUE MIS.XPKPRODUCT_CATGORIZATION
    Cost : 2 Bytes:252 Cardinality :36
    PARTITION RANGE ALL
    Partition #:3 Partition acessed #1 - #122
    TABLE ACCESS FULL MIS.TRANCHE_BALANCE
    Cost :18,789 Bytes : 83,510,481 Cardinality:2,036,841
    Partition #:3 Partition acessed #1 - #122
    Without knowing your tables and what indexes you have defined on them and without knowing the number of rows of data as well as the cardinality and selectivity of the data, we're not going to be able to give any real advice.
    What happens if you leave out the Hints?  (Index and Optimiser Hints shouldn't be used in production code, they should only be used for debugging - with the exception of the APPEND hints for inserts)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Error message when opening Indesign CS3

    After using Indesign CS3 without trouble for several years, today I reloaded it onto a new PC (generally identical to the old; a little more powerful) but when starting it up, keep getting the message 'Error 45.   Error String - Object invalid'.   Re

  • Failed to read WSDL - connectException and unknownHostException

    Hi Guys, I am starting out with a new installation of SOA Suite 10g on my local windows machine. I've tested out a simple BPEL process deployment and all works fine. My next step is to test an Invoke of an external webservice: http://www.w3schools.co

  • How do i change a pdf photo to jpeg

    I need some help please i am trying to change some photos i down loaded from internet to a jpeg file to use on my web page HELP

  • No images in e-mail

    After I ran iClean, the dreaded blue box with ? appears instead of images in most of my e-mail now. Strangely enough, it's also happening on my husband's PC, so I don't think it really has to do with Mail, since he uses webmail. We both use Firefox,

  • Computer specs for nice 3D rendering/ after effects rendering and video rendering in general ?

    Hi there! I would like to know what the perfect specs for a laptop/workstation/computer are, so that I could do my creative work from home..my old laptop (Macbook Pro, 8Gb Ram, V 2010) is not good enough for 3D rendering, not even Video rendering or